this post was submitted on 16 Dec 2024
19 points (100.0% liked)

Game Development

3534 readers
2 users here now

Welcome to the game development community! This is a place to talk about and post anything related to the field of game development.

Community Wiki

founded 2 years ago
MODERATORS
 

I'm making an RPG in C++ and the items (loot/gear) will have immutable base versions, but then the player can get instantiations of them which can change with use and modification. These mutable instantiations will be saved in the DB. But I'm wondering if the base versions should be defined in JSON, or a separate DB (with the same schema), or maybe the same DB (seems dangerous), or if I should just hardcode them in C++ in the ItemFactory.

How have you approached this problem in your games? How do game engines do it? I'm using SDL2 so I'm doing most of these systems from scratch.

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 5 points 6 days ago

In some of my apps (web apps, not games), I put a folder called “data” for files that just contain data that’s better suited for csv, xml, json, etc than it is for either hard coded object definitions or database.

Another term for this kind of thing, at least in the web dev world, at least in 2020 which was when I last was a developer, is “assets”.

A logo for a website is an example of an asset, as is a font file.

Assets is data that’s designed to be immutable.

One thing to keep in mind, however, is that balancing the game will likely involve changing the parameters of the base objects as well as the modifications they can get. After balancing is done, the data won’t change. But during balancing, the data might change quite a bit.

For this reason, it might be worth it to have a set of functions for manipulating these parameters, instead of just going into a big json file and manually altering numbers.

Balancing in this way might make storing this stuff in the database more useful.

Just some thoughts. Again, not a game developer. But I have written a lot of code, and fiddled with lots of “balancing” in systems.

It may seem like overkill to put such data in the DB, but there’s not as much downside as one might expect in my experience.