• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
MaxieQ

Databases in your games

19 posts in this topic

I have a hobby RPG project going called Endtime. My aim is to match the technical, game-play and artistic level of things like Fallout 2, Ultima, etc. Ten year old games. I think that's a feasible ambition for a solitary coder.


However, I won't really get away from a lot of data-shuffling for things like quests and items and such, and I was considering employing a database for easier back-end quest writing and such.

I mean, if I end up having more than 100 quests in my game, it is probably going to be easier to fill out the quest data in a form in a database than it would be to hard-code it in. I could store bulk quest data, dialog trees, the full item list in a database and call those when needed.


So, my question is simply because I am a bit fuzzy about how it would be done, do you use databases in your games and would it be worth trying to think up a bridge? Do you use databases in your games at all? If you do, do you use SQL or non-SQL ones?

Or if not, is it a really bad idea to use databases from an efficiency standpoint? Are they just too slow for things?
0

Share this post


Link to post
Share on other sites
Unless you are running massive numbers, most database systems are massive overkill for what you need. That said, they do solve a lot of problems that you might encounter ( transactions, concurrent request/race situations ) and theoretically are well optimized. If your data fits nicely to the database format it may certainly be a good way to go.

Consider a lightweight embeddable database like [url="http://www.firebirdsql.org/"]Firebird[/url]. It has ADO.net and ODBC connectors, making it fairly easy to access. ApochPiQ is right though, in many cases a database isn't really the best solution. In this case, embedding your data as code is a good fit. The above mentioned JSON, as well as LUA are both quite capable in this regard.
1

Share this post


Link to post
Share on other sites
[quote name='ApochPiQ' timestamp='1353950088' post='5004236']
Databases are not the be-all and end-all of storing information.

I'd suggest looking into building a simple tool set that stores your data in a custom format or leverages an existing tool like XML/JSON/YAML/etc. You can knock together a tool to edit your game content in C# in a few hours; in the same time it'd take to integrate a database, design a schema, and start filling out "forms in a database", you could have some custom solutions that do precisely what you need and can be extended as you see fit whenever you like.

For perspective, most major game engines use custom data storage systems for precisely these reasons.
[/quote]

I agree with ApochPiQ. I worked on a game where we used MySQL databases to manage everything -- quests, stats, players, items, etc. If I had to go back and do it again, I would have just wrote a custom storage format. The amount of trouble that those databases caused was unbelievable; especially when you have more than one programmer working on the game.
1

Share this post


Link to post
Share on other sites
Thanks guys. I really appreciate your comments. I'll have a look at XML or JSON if I can get that to work with Unity Free, which is my engine of choice.
0

Share this post


Link to post
Share on other sites
In my opinion, databases are meant to solve a different problem than what you describe. They are designed for (hundreds) thousands (millions) of users to insert/remove/query the information in them concurrently. Not for a single programmer to store inter-related program data. As others have pointed out, if you use a professional database solution, you will add complexity to your own life with very little return on investment.
2

Share this post


Link to post
Share on other sites
[quote name='Steve_Segreto' timestamp='1353952332' post='5004249']
In my opinion, databases are meant to solve a different problem than what you describe. They are designed for (hundreds) thousands (millions) of users to insert/remove/query the information in them concurrently. Not for a single programmer to store inter-related program data. As others have pointed out, if you use a professional database solution, you will add complexity to your own life with very little return on investment.
[/quote]

Oh, there is a massive return on investment, especially if you are creating say.... an MMO.

But it all comes down to weighing the upsides vs the downsides, and the reality is, most games dont use a portion of the ability of most databases on the market.

That said, MySQL is a notorious pain in the ass, so that would be a big part of it. There are many databases that were designed specifically to be embedded in an application and they will give a much different experience.
1

Share this post


Link to post
Share on other sites
I'm an on- and off player of Eve Online, and my thinking about databases in games started because I know that Eve invests a lot in their database. Of course, Eve is an MMO with hundreds of thousands of players, so there is the question of scale. But it got me started thinking about the utility of databases in games.

Again thanks everyone for your comments. It's most instructive.
0

Share this post


Link to post
Share on other sites
Even traditional relational (SQL-oriented) databases are of questionable utility to a modern MMO. Reliable distributed data storage is often more valuable than strict ACID compliance and the other features of relational DBs, at least until you get to the archival/long-term-retention state of affairs.
1

Share this post


Link to post
Share on other sites
http://www.sqlite.org/

Writing a storage solution is not going to be quicker than it would take to implement a mature database product like sqlite. Something like this product gets you focusing on what you want to store rather than how you are going to store it. Oh, and the license is "public domain".

There are a vast number of existing tools out there that are already available to work with existing database products. You don't have to create any tools for this.
0

Share this post


Link to post
Share on other sites
Having seen SQLite used for game development in the past, I'm actually more against using that than using more traditional DB systems. It claims to be ACID compliant but it's easy to break that aspect if you implement it wrong, and treating it like a genuine database is begging for weird bugs.

I stand by my original statement: by the time you integrate even something like SQLite, get up to speed on the tools, etc. you can hammer out a fully custom solution that beats the pants off a generic database system. Existing libraries for storage formats are so prevalent that there's no call for rolling your own storage solution. You can save all the effort of integration and convert it into effort making your ecosystem better, and that pays off a lot more over time in my experience.
1

Share this post


Link to post
Share on other sites
[quote name='ApochPiQ' timestamp='1353977580' post='5004369']
Having seen SQLite used for game development in the past, I'm actually more against using that than using more traditional DB systems. It claims to be ACID compliant but it's easy to break that aspect if you implement it wrong, and treating it like a genuine database is begging for weird bugs.
[/quote]

This is just my curiosity here but what situation did you see SQLite used that it didn't achieve what it was designed to do? Was the problem just programmer error?

I was just thinking for his situation he's looking at storing a limited amount of data without much need for high end database features.
0

Share this post


Link to post
Share on other sites
MaxieQ,

Game development office database and online game server database are things to research and eventually launch. As your organization grows, the need for these two databases will surely increase.


Game source code modulization might be better served by avoiding a database integration in the game source code. It is quite easy for data in a database to get lost or detached from the game source code. If changes in game code will require a change of database structure, then you just doubled your work and multiplied your risk of a broken game.

On the other hand, maintaining a database can make changes to data itself quick and easy if the coding is safe and reliable. Tree and kinds of data hierarchy would be a must for complex games in general if you are going to use a database.

I am sure that fans of game databases will tell you that they are glad they learned and integrated them. On the other hand, with games slowly getting more complex by the day, the need for dynamic writing with modulization seems to me to work against a database.


Clinton
0

Share this post


Link to post
Share on other sites
I personally cant imagine an MMO-scale project not using a traditional database... But then again im a profesional plsql developer who spends his work day writing tedious finance and stock related batch jobs or designing and implementing new bussiness applications starting wit the database and ending with the actual application so I might be biased... In my personal project http://www.gamedev.net/blog/blog-807/cat-252-strife I use an oracle database and for me it fits in perfectly. Although. I dont store any quests or items in the database, I have a custom format for that since it makes more sense to me. The database is instead is used to store things like accounts, characters and links from a character to all its items and quests. Meaning it only stores id's for quests and items in the database but the actual items and quests are stored elsewhere since It doesn't seem benificial to store static data in the database (items and quest doesnt change while the server is running).

EDIT: Another reason why you dont want to store static quest and item information on your server side database is that the client also needs access to it... If a player wants to read a quest the server doesnt (or at elast shouldnt) send over the complete quest dialogue and everything else about about the quest. Instead it should only send over a quest id and then the client should look it up from its own data) Edited by Wilhelm van Huyssteen
0

Share this post


Link to post
Share on other sites
[quote name='ApochPiQ' timestamp='1353967074' post='5004329']
Even traditional relational (SQL-oriented) databases are of questionable utility to a modern MMO. Reliable distributed data storage is often more valuable than strict ACID compliance and the other features of relational DBs, at least until you get to the archival/long-term-retention state of affairs.
[/quote]


Having played around with NoSQL databases recently ( CouchDB ), I can't imagine they are the answer! Maybe my brain is too wired to think in terms of tables, but my god the experience sucked beyond simple document storage. If you are storing your data as a blob ( say a chunk of JSON ) that you grab, update then push back to the database, it works smashingly, but updating a single value within that document causes an entire new revision to be created. Now, storing files in a NoSQL database is an order of magnitude easier then a relational database, but actual data, not so much.
0

Share this post


Link to post
Share on other sites
[quote name='Serapth' timestamp='1354027879' post='5004528']
Having played around with NoSQL databases recently ( CouchDB ), I can't imagine they are the answer! Maybe my brain is too wired to think in terms of tables, but my god the experience sucked beyond simple document storage. If you are storing your data as a blob ( say a chunk of JSON ) that you grab, update then push back to the database, it works smashingly, but updating a single value within that document causes an entire new revision to be created. Now, storing files in a NoSQL database is an order of magnitude easier then a relational database, but actual data, not so much.
[/quote]

Well.. that's one example of a NoSQL database. Compare that to Redis ([url="http://www.redis.io"]http://www.redis.io[/url]) which is used by Blizzard Entertainment, Stackoverflow, Github, Flickr, Craigslist.. we use Redis for custom news views on the frontpage as well as for real-time access to member data in the Top Members section ([url="http://www.gamedev.net/sm/"]http://www.gamedev.net/sm/[/url])

Blizzard uses an 8 node redis cluster for serving avatars in World of Warcraft. Redis is an in-memory data structure server with persistence capabilities.

Also with your situation games not necessarily save in realtime to disk.. with most it's sufficient to do periodic checkpoint saves. Edited by Michael Tanczos
0

Share this post


Link to post
Share on other sites
[quote name='Michael Tanczos' timestamp='1354029681' post='5004533']
[quote name='Serapth' timestamp='1354027879' post='5004528']
Having played around with NoSQL databases recently ( CouchDB ), I can't imagine they are the answer! Maybe my brain is too wired to think in terms of tables, but my god the experience sucked beyond simple document storage. If you are storing your data as a blob ( say a chunk of JSON ) that you grab, update then push back to the database, it works smashingly, but updating a single value within that document causes an entire new revision to be created. Now, storing files in a NoSQL database is an order of magnitude easier then a relational database, but actual data, not so much.
[/quote]

Well.. that's one example of a NoSQL database. Compare that to Redis ([url="http://www.redis.io"]http://www.redis.io[/url]) which is used by Blizzard Entertainment, Stackoverflow, Github, Flickr, Craigslist.. we use Redis for custom news views on the frontpage as well as for real-time access to member data in the Top Members section ([url="http://www.gamedev.net/sm/"]http://www.gamedev.net/sm/[/url])

Blizzard uses an 8 node redis cluster for serving avatars in World of Warcraft. Redis is an in-memory data structure server with persistence capabilities.

Also with your situation games not necessarily save in realtime to disk.. with most it's sufficient to do periodic checkpoint saves.
[/quote]

I actually wanted to use Redis, it seemed like the much more sane option than CouchDB. There is a gigantic problem I ran into here.

Redis isn't on Windows yet, at least not in any official capacity. It has been in a "coming soon" state for far too long. What I heard about stability of the Windows port was... not good.
0

Share this post


Link to post
Share on other sites
[quote name='Serapth' timestamp='1354036241' post='5004570']
Redis isn't on Windows yet, at least not in any official capacity. It has been in a "coming soon" state for far too long. What I heard about stability of the Windows port was... not good.
[/quote]

Yeah Redis isn't one of those solutions you package with a game for distribution. You'd need to be running servers users will connect to. It's lean enough though that on any LAN you could always throw an old box up with linux and run it for testing purposes (or run linux inside a VM with Redis on it).
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0