Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Dreddnafious Maelstrom

To Database or Not to Database, TITQ

This topic is 5801 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok gaming guru''s, i''m currently taking all of my data and writing it too a text file and then looping through a parser to load my maps, and other mesh object info. I thought about switching to binary to decrease the load times and then I began to wonder, do professional games do this or do they use a database to store there config files? Anyone want to spill their guts on this issue? It seems like i could use mySQL and have a much better, more secure Datawarehouse. NE1? Dreddnafious Maelstrom "If i saw farther, it was because I stood on the shoulders of giants." Sir Isaac Newton

Share this post


Link to post
Share on other sites
Advertisement
Usually, games make their own small databases or just load individual binary files. Using something like mySQL for a non-server situation is going a little overboard.

Share this post


Link to post
Share on other sites
"real" databases are optimized for a ton of data and/or complex queries. They would be overkill (and probably slower) for something like a config file unless the configuration is very complex.

Share this post


Link to post
Share on other sites
I don''t understand how you would use a commercial database like Oracle or Sybase without having the player having to have a copy of that database on their machine... Isn''t a bit too much to ask?

Easier to roll your own database. The only kind of database in my projects is a ResourceManager class. Maybe if you are doing a MMORPG you''d want all your data to be on a separate server and in this case you might want to use a commercial database. Commercial databases are really really high performance, but they''re very generalized and there are a lot of layers of drivers, FAPs, transaction monitors, and other junk going on between the client and the server. I''m not sure how this would compare performancewise to what you could produce in shop... If someone knows otherwise, please do say

I know lots of RTS companies keep Excel spreadsheets of all their unit stats and such, I''m not sure if they export the data into flatfile format to read it into the game or not ...

Share this post


Link to post
Share on other sites
Well mySQL is free so distribution isn''t a prob. (feel free to correct me if anyone knows otherwise) Which is why i based my example on this. By rolling your own do you mean writing to a file and reading from it? (text, binary, etc..) or could i use old ass FoxPro or something? Mostly just tired of re-writing my parser everytime i add a new function to my game that has to be saved. But i am also interested in doing it right. I know there are a hundred or so ways to do this but if i write a front-end GUI for a db, then i could have a really easy way to write an editor for maps and such. Performance isn''t that big of a deal, unless you are saying it would probably be slower than parsing text files, which is what i am doing now.

Share this post


Link to post
Share on other sites
Most of the time you write directly to binary files. Some engines, the Quake seires for example, use a pack file system that bunches all the individual files into one big file. This allows you to compress the entire thing and get better peerformace.

The engine doew all the work; opening the file, seeking to the right place in the file, reading the information into memory, then closing the file.

A file loading system is important for good performance.

Share this post


Link to post
Share on other sites
By roll your own database system, I meant you might want to write your own custom database system. Whatever file format you choose is up to you.

Honestly, I don''t see the need for a database for mesh objects and maps and stuff.

One approach is that your classes should know what data they need and be able to load it by themselves. Another is to have a ResourceManager class that all your data classes can "petition" to load the required data that it needs. The ResourceManager is a really handy concept, because it encapsulates all the file handling, loading data and allocating memory. It could even have more advanced functions like swapping out resources that haven''t been reused recently (priority queue) to make space for resources its trying to load. It could load some resources at the beginning of the level, and stream in other resources in the background on demand. Plus, because you have a centralizes ResourceManager class, its very easy to track memory leaks, and make sure all your resources get unloaded at the end of the level/game.

It sounds like what you''re asking for is a file system & resource manager, rather than a database. Maybe take a look at the 4th and 6th Code on the Cob series, this might give you some ideas:
http://gamedev.net/reference/articles/article825.asp
http://gamedev.net/reference/articles/article827.asp

Share this post


Link to post
Share on other sites
I raised a similar suggestion a while ago. I don''t know if it''s a good solution for your problem, but I find it interesting. It would include using MySQL, in such way that you include the server code (it''s open-source) into the game/program itself, and read it reads the data from MySQL table files. This would not mean that you need to install/run an MySQL server, you only include the part of the code that interpret the query, and extract the data from the table files. The main advantage is if you store much data in a complex way, as the MySQL code if very stable and debugged already. It could take you a year or so to reach that quality. Another good thing is that you can use existing tools to build the databases. You could probably save hundreds of hours and end up with a much better system. The downside is that it could be tricky to include this in a comercial game, unless you pay for a license (which I think is cheap).

Share this post


Link to post
Share on other sites
I'm quite sure it would be simpler and easier to write your own file system.

[edited by - smanches on August 30, 2002 6:22:05 PM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!