Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Where should I store data?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
8 replies to this topic

#1 Zubadar   Members   -  Reputation: 102

Like
0Likes
Like

Posted 21 June 2012 - 08:35 PM

Hey everyone.

First year university student here studying games programming.

I'm designing a very primitive system to simulate realistic AI and virtual relationships (not uni stuff). There is going to be a LOT of data, so I'll need a database of some sort.

Here's an example of 2 snippets of tables I might have to store:
Posted Image

Obviously it's very relational.

I've looked into databases for games, and I'm not really sure how I should go about tackling this. Apparently SQL is a bad choice and mostly used for online games and such. How would something like Skyrim store data? Flat file databases?

I want to be able to manipulate some sort of database using Visual C# 2010.

Sponsor:

#2 fastcall22   Crossbones+   -  Reputation: 4475

Like
0Likes
Like

Posted 21 June 2012 - 09:03 PM

Apparently SQL is a bad choice and mostly used for online games and such.

Why is SQL a bad choice? What are your requirements? How much data do you expect to store? Keep in mind that the SQL language is very expressive; you can do more with fewer lines of code than you can otherwise, SQL is very adapt to database changes, and SQL has already been invented; there's no need for you to reinvent it!

How would something like Skyrim store data? Flat file databases?

Skyrim most likely uses some sort of SQL server. Flat file databases have (or may have) been phased out when memory/disk space requirements were tight (i.e., the DOS era).

I want to be able to manipulate some sort of database using Visual C# 2010.


You're in luck. You can get SQL Server Express for free, and .NET library interfaces amazingly well with databases. It's basically a service that runs on the client machine and acts as a professional SQL Server. This is a plus, since your application interfacing with the database won't need to care about where the data is stored. You can also get SQL Server Management Studio Express for free and use it to interact with your SQL Server on your local machine.

If you're not sure of what you want, then install SQL Server Express and try it out for yourself.

Edited by fastcall22, 21 June 2012 - 09:20 PM.

c3RhdGljIGNoYXIgeW91cl9tb21bMVVMTCA8PCA2NF07CnNwcmludGYoeW91cl9tb20sICJpcyBmYXQiKTs=

#3 fastcall22   Crossbones+   -  Reputation: 4475

Like
0Likes
Like

Posted 21 June 2012 - 09:23 PM

Also, another option available to you is to use various free libraries such as LumenWorks.Framework.IO.Csv and Ionic.Zip to create your own sort of "flat-file database" and use the C# LINQ to do SQL-like queries on System.Data.Datasets. The only disadvantage to this approach that I can think of is that the entire database will need to be read into memory, and any changes to a table will require rewriting the entire file the table is in...

Edited by fastcall22, 21 June 2012 - 09:35 PM.

c3RhdGljIGNoYXIgeW91cl9tb21bMVVMTCA8PCA2NF07CnNwcmludGYoeW91cl9tb20sICJpcyBmYXQiKTs=

#4 Zubadar   Members   -  Reputation: 102

Like
0Likes
Like

Posted 21 June 2012 - 09:24 PM

Thanks for the reply. Posted Image

What if I were to build the program and send it to somebody? Wouldn't they need to have an SQL service running on their PC for it to work properly? I just want to make sure it can be portable.

EDIT: With your second response, I think storing the whole database into the memory would be quite a disadvantage, because I can see this database getting very large.

Edited by Zubadar, 21 June 2012 - 09:26 PM.


#5 fastcall22   Crossbones+   -  Reputation: 4475

Like
0Likes
Like

Posted 21 June 2012 - 09:26 PM

I haven't done it myself, but this looks promising.
c3RhdGljIGNoYXIgeW91cl9tb21bMVVMTCA8PCA2NF07CnNwcmludGYoeW91cl9tb20sICJpcyBmYXQiKTs=

#6 Zubadar   Members   -  Reputation: 102

Like
0Likes
Like

Posted 21 June 2012 - 09:36 PM

I don't really want an SQL server to be running in the background for this to work, unfortunately. It seems messy and bloated to me, and I've never heard of games running servers in the background to keep single-player data.

Here's what I need for this database:
  • Relational capability
  • Portability
  • Preferably doesn't have to load the entire database to memory to do things as that would be incredibly slow
  • Manipulable via Visual C# 2010
Any ideas?

Edited by Zubadar, 21 June 2012 - 11:00 PM.


#7 SHilbert   Members   -  Reputation: 647

Like
0Likes
Like

Posted 22 June 2012 - 12:24 AM

You could look into SQLite.

SQLite is written in C but there are a few ways to use it from C#:

http://system.data.sqlite.org/index.html/doc/trunk/www/index.wiki provides .NET bindings to SQLite.
http://code.google.com/p/csharp-sqlite/ is a C# re-implementation (or more like a translation) of SQLite.

SQLite is absurdly portable and well-tested, and it's designed for embedding into applications (there is no separate server process.)

#8 Cornstalks   Crossbones+   -  Reputation: 6991

Like
0Likes
Like

Posted 22 June 2012 - 12:26 AM

SQLite3? Contrary to what you may believe, you don't have to use a separate process, service, or even thread to use SQL. SQLite creates a database file which you can access through your code, where you can create queries and execute them.

[edit]

ninja'd

[edit edit]

You may be interested in this article on using SQLite and LINQ in C#.

Edited by Cornstalks, 22 June 2012 - 12:55 AM.

[ I was ninja'd 71 times before I stopped counting a long time ago ] [ f.k.a. MikeTacular ] [ My Blog ] [ SWFer: Gaplessly looped MP3s in your Flash games ]

#9 Zubadar   Members   -  Reputation: 102

Like
0Likes
Like

Posted 22 June 2012 - 01:30 AM

Thanks everyone for the responses.

I'll definitely be using SQLite as it suits my needs perfectly.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS