what you suggest for manipulating data in a game? (c#)

Started by
6 comments, last by jHaskell 10 years, 3 months ago

ok first of all im a beginner with no experience in game programming.

im still learning and making tutorials every day in my process to understand c#

ok here is my question, what is the "best" (or most convenient) way to handle game data?

for example i have a classic battlefield which is basically a n X n square, is it convenient to use sql or just an array is enough and more fast?

what if i have dynamic database? for example if i make an RTS(no im not even thinking of making one, dont worry :D ) the unit list would be changing in number (when i create or destroy them) and maybe even changing in data (upgrade units, damage them etc)

is in this case best to go sql or again just a simpler solution would be enough?

what you suggest as general rule of thumbs for a general basic enviroment(map+ entities+entities stats) ?

Advertisement

first, if you wanna update these infomation(unit lost, damage change, hp change...) you can just do it in your game, no need to save them into database.

second, sometime you want to save these infomation(player want to save game) you can save them to text file, or binary file, database system is not needed.

in case i dont understand your question :D and you really want to save your data while game is running. i think it's impossible. because every frame, your game changes(unit move, fight, ....) and you must query EVERY frame, which intensely rape your fps.

first, if you wanna update these infomation(unit lost, damage change, hp change...) you can just do it in your game, no need to save them into database.

second, sometime you want to save these infomation(player want to save game) you can save them to text file, or binary file, database system is not needed.

in case i dont understand your question biggrin.png and you really want to save your data while game is running. i think it's impossible. because every frame, your game changes(unit move, fight, ....) and you must query EVERY frame, which intensely rape your fps.

thnx very much this answer a good part of the question, so basically you say querying is too heavy for a game and it can be easily handed elseway

ok i think i got it but then what should i use? is the same thought applied to LINQ ?

I'm sure not. My advice right now: learn the language more, learn about file handling, how it works and what you can do with it and forget about databases.
That is an own topic which you should first handle after you understand how programming works in is simplest ways!

well i never thought of stopping to learn the basics i miss or even to keep learning to improve the (few) things i know

i just wanted some objective to look forward instead of just keeping to learn and learn abstract stuff...

but thnx anyway for your suggestions

Personally, most of my experience is actually database experience, and unless you are able to think a lot better in databases and use those to define your objects or components if you are doing component entity design, I agree that skipping the database would be best. I haven't actually worked on an MMO, but that would be the best reason to use a database from my own understanding.

Programming is not just the language, but the concepts that make the language possible. If you want something dynamic I actually recommend XML for the save format, as it is easy to learn and use and very dynamic. Just make sure to properly define each item that goes in so that you can parse it out.

Otherwise, I recommend reading up on data structures to get an idea of ways people store things and why they do.

thnx

im keeping to read stuff on msdn and around about this topic in these days

its just that i wanted to "unabstract" a bit my learning experience trying to focus on something a bit more concrete cause you know it gets boring after weeks of reading new stuff you only try to understand and memorize, sometime you feel the need to try and *do* something even if i get this might be a long step atm

Sounds like you want to read about and learn to use the various containers provided by the language. For C# see:

http://msdn.microsoft.com/en-us/library/system.collections.generic(v=vs.110).aspx

This also requires learning how to use generics (otherwise known as templates in the C++ world).

Those collections/containers allow you to add and remove items from them dynamically.

This topic is closed to new replies.

Advertisement