Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'll begin by saying that I feel my level of expertise matters here, and so I have about a year worth of experience as a programmer in the C# language and most of the .NET framework as a whole, but have scarcely worked with databases at all throughout my career so far. Can't exactly say why. Either way, I'm a bit of a beginner, although SQL/LINQ I am capable of working with once I have this question resolved. Moving on...

At home, I am developing a single-player (so only one person needs to access it) turn-based RPG in XNA. I have a lot of the logic done and the time has come for me to begin building a database for it.

THE REQUIREMENTS: There will be both dynamically written data not included with the program (such as the location in the world at which a player saved his game, that he may load in the same place) and read data that needs to be capable of being distributed easily with the program (such as a table containing stats of every monster).

THE DESIRED BUT OPTIONAL PERKS: Beyond these absolute requirements, ease of use is a second priority I want to focus on. My amatuer nature doesn't want me digging around on ground I am too unfamiliar with.

MY ATTEMPTS AT RESEARCH: I understand Access to be a simple-to-use (though oft frowned upon) choice that could work based on needing only one user to access the database at a time. SQL Server could also work, but I understand it to be more difficult to use based on my needs. And in both cases, I am not sure if there are complications associated with the distrubution of pre-loaded data with the programs. In this case, I think I should use an XML file to hold the data I want the game to come with, but I am not sure. Amidst all of this, I have also considered creating the .dbml right there in Visual Studio because it seems the simplest, but same issue: I don't know the limitations of capability and distribution.

I have tried to outline what I know and what I need to accomplish, as well as some of the options I have attempted to research, but ultimately, my knowledge has holes in it I can't find the answers to and I can't form a conclusive answer. Thus, I ask you kind people, based on the above, what is my best option for how to start building my game's database?

share|improve this question
    
What is the intended platform: desktop, xbox, or phone? –  PlayDeezGames Mar 14 '12 at 19:48
    
Primary intent is desktop. XBox, maybe if I can do it easy enough. –  Zabby Mar 14 '12 at 20:00
    
Pretty sure you have to interact with the HDD on the Xbox though the Microsoft storage classes. I don't see how you would go about installing/setting up a database there. –  ClassicThunder Mar 14 '12 at 20:33

2 Answers 2

up vote 6 down vote accepted

You don't need a database for a turn-based RPG, just store your save game data in an object and serialize it to disk. You can serialize binary or serialize to something readable like XML which you can then later import easily via the content pipeline importer.

Requiring users to have Access, or any other non-integrated database, installed next to your game is going to be quite the hassle. If you really really really need a relational database you should look at something that you can integrate so that users don't need to install a fully fledged database. An example is SQL server compact http://msdn.microsoft.com/en-us/library/aa983326.aspx.

share|improve this answer
4  
Also worth examining for integration is sqlite, since it was made for this sort of thing. There's a c# wrapper here. –  user9485 Mar 14 '12 at 20:29
    
This seems to be right up the alley of what I am looking for. Thank you very much. As a closing note, does anyone have any links to examples of serializing to disk in C#? EDIT: I mean links that people with more expertise than me find to be of particular clarity. I'm still trying some basic google research on my own. –  Zabby Mar 14 '12 at 22:03

Here is a link to a similar question

Basically any flat file (XML, JSON to name two) will do, you can also use SQLite with XNA 4.0. Or like Roy T stated, you can save game data in an object (Lists, custom class, dictionary list can provide very fast lookup)

Here are some samples from microsoft

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.