|
|
|
|
|
by optforfon
3556 days ago
|
|
I've never had the occasion to use an SQL database. But say I was writing a game using C++ - at what point would I go from managing a bunch of maps or vectors of entities to using a SQL database? If I was writing a ray tracer and needed to store vertices, would it makes sense to use a SQL database? How about for a list of object? Or textures? In general I often need to filter on objects, update object state, generate new objects, remove some others, etc. but I never know when I should stop thinking containers and start thinking "aha! time for SQL" |
|
You should use a database to store data that you want to keep after the program terminates, not so much transient things like in-memory data structures. It's also best used for relational data- stuff that is logically linked together.
For developing a game, maybe storing item tables with items and stats or the player's inventory might be good candidates. Sqlite in particular is good for this because it's easily embedded and a lot of games use it from what I know.
This is oversimplifying a good bit, but it's hard to completely describe the scope of relational DBs.