Jump to content


How To Store A Giant Amount Of Data Efficiently?


  • Please log in to reply
5 replies to this topic

#1 Serefan

Serefan

    Advanced Member

  • Members
  • PipPipPip
  • 61 posts
  • Gender:Male
  • Location:Belgium

Posted 10 September 2008 - 01:28 PM

Hi everybody,

I am currently working at a game in JAVA for over a few months now, and now I've come to a standstill, I really don't know how to do what I want to do 'as efficiently as possible'.

What's the exact problem: The game is an RPG, and an RPG means having an awful lot of computer-controlled characters, each with their own statistics, i.e. name, picture, level, and so on. More importantly: with each character comes a giant amount of text that is used when talking to the characters, this is how it works: Every character responds with some text to the words 'look', 'name' and 'job'. After that, the player has the possibility to further talk to the character by expressing keywords found in the sentences of that character.

All in all, this means I have a HUGE amount of variables, strings and whatnot for each character, and what's more, I'll have a real load of characters.

Can anyone now tell me how I could store all info of the characters efficiently, and make the game load everything without having an awful lot of coding? More importantly, I should be able to add new characters without a lot of problems, i.e. only by editing a text file or something like that, without having to do extra coding...

Any help will be very greatly appreciated.

#2 ami

ami

    Advanced Member

  • Members
  • PipPipPip
  • 86 posts
  • Gender:Male
  • Location:Poland

Posted 20 September 2008 - 01:09 PM

Hi!

I guess database should be used in every circumstance, where there's lots of data. Each object of your game should have embeded connection to database and store there its properties, history of used words, and other things you'll find necessary. Use methods from javax.sql - they're more efficient and save resources, but require more knowledge from you. There's always easy to use connectivity from java.sql.

#3 Kraicheck

Kraicheck

    Advanced Member

  • Members
  • PipPipPip
  • 879 posts
  • Gender:Male
  • Location:Belgium

Posted 22 September 2008 - 11:06 AM

QUOTE(ami @ Sep 20 2008, 03:09 PM) View Post
Each object of your game should have embeded connection to database

That's not a good idea. If you work with a database, you should shield this from as much modules that don't need to know about it.

The best thing I can think of to reduce the load is to make sure you only load the characters and environment when they are necessary, unload them the moment they will no longer be used, and reuse loaded objects where possible.

#4 Serefan

Serefan

    Advanced Member

  • Members
  • PipPipPip
  • 61 posts
  • Gender:Male
  • Location:Belgium

Posted 22 September 2008 - 06:24 PM

QUOTE(Kraicheck @ Sep 22 2008, 01:06 PM) View Post
That's not a good idea. If you work with a database, you should shield this from as much modules that don't need to know about it.

The best thing I can think of to reduce the load is to make sure you only load the characters and environment when they are necessary, unload them the moment they will no longer be used, and reuse loaded objects where possible.


Thanks for the answers, and yes, that's a very good idea, I already thought a bit about going that way when looking around on the web for answers. But my problem is: from the way I see it, there is no way around the fact that I'll still have a huge text file from which I'll have to load... Or is there another way?

And working with a database is something I have no clue of how to do... Or do I have no need of it?

PS: What do you mean with 'unloading' characters? How would I have to do that? (Picture my characters being a separate class)

#5 Kraicheck

Kraicheck

    Advanced Member

  • Members
  • PipPipPip
  • 879 posts
  • Gender:Male
  • Location:Belgium

Posted 23 September 2008 - 10:24 AM

QUOTE(Serefan @ Sep 22 2008, 08:24 PM) View Post
Thanks for the answers, and yes, that's a very good idea, I already thought a bit about going that way when looking around on the web for answers. But my problem is: from the way I see it, there is no way around the fact that I'll still have a huge text file from which I'll have to load... Or is there another way?

And working with a database is something I have no clue of how to do... Or do I have no need of it?

Maybe you can look at how real/modern games store their data and follow the same route or a simplified version of it.

QUOTE
PS: What do you mean with 'unloading' characters? How would I have to do that? (Picture my characters being a separate class)

Making sure that you don't keep any references to objects you don't need any more.
You could for example store characters in an array or list and then forget to remove them from that list when they are no longer needed.

#6 Serefan

Serefan

    Advanced Member

  • Members
  • PipPipPip
  • 61 posts
  • Gender:Male
  • Location:Belgium

Posted 02 October 2008 - 08:46 AM

QUOTE(Kraicheck @ Sep 23 2008, 12:24 PM) View Post
Maybe you can look at how real/modern games store their data and follow the same route or a simplified version of it.
Making sure that you don't keep any references to objects you don't need any more.
You could for example store characters in an array or list and then forget to remove them from that list when they are no longer needed.


Yes, that's something I would've forgotten, thank you all, if anything else comes to mind, please tell me!  wink.gif