Download

Help me design content storing. is file streamin slow for this?

When I think about data in video games, I usually think about them in files. All the character stats written and read by using file streaming. But when I think about role playing games and skills, such as blacksmithing, mining, carpentry, tailoring and such, I just go nuts. I could easily create a skill tree, so big, it would take thousands of lines. And I’m not talking about code, I’m speaking of lines in a file, that is used to make a combo box of what you can make…
Now, I find sql a bit much of an overkill, and I don’t think that a single player game would use an sql code to read and write data (correct me if I’m wrong).
Should I go for an sql code for the matter of speed, or are there other ways around this?
Last time I started off making a game, I found out that designing how to code your game can be very important. You can easily reuse a well made code, but reusing a gameplay… just not gonna happen. So yeah, I like to spin the game as I code. (I’m sorry about this, people tell me it’s bad practice to spin the game as you code; you should always know what you intend to do before opening any of the tools. I just happen to find designing the code more important).

If you’re always going to load it all into memory, then I’d just use a text file (or other flat file, such as JSON, etc) and be done.

If you’re going to constantly searching that data, filtering, etc, then SQL (especially something like sqlite) is a perfectly valid way to go, and probably quite a bit faster than writing your own routines. (Assuming there really is a lot of data. Thousands of lines doesn’t seem like a lot to me. But then, I work on databases with millions of rows, so I might be jaded.)

The other solution and its one that I use for my Game Flow service is a combination of traditional SQL storage and in memory storage on the server. I then use a Web-Service call to make calls against and retrieve the data I need from in-memory storage.

I used PostgreSQL for my standard SQL and HSQLDB for my in-memory storage. I am currently working on getting weapon options using this type of setup that will allow me to tweak weapons and power-ups without the need of having to update clients.

My idea is to have my game server (which is dedicated) connect to the Game Flow web-service and load all the weapon and power-up options in to memory. I don’t have many weapons and power-ups so this is the best solution for me. Because the weapons are spawned on the server … this solution works well. This also allows me to game balance weapons and power-ups remotely via a web-based interface that I wrote.

The in-memory storage is purely used to keep the latest data in place and make it easier to access … I could also look at an object cache solution like Redis instead.

Thanks allot for these two answers: ‘William Crawford’ and ‘qdelpeche’. Usually when I discuss my ideas with my friends or classmates, there is too often a much better and easier overlooked simple solution to my problems, that replaces my ideas in all areas. Guess this is not one of them.