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.

  • intensely_human@lemm.ee
    link
    fedilink
    arrow-up
    4
    ·
    8 hours 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.