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.
How To Store A Giant Amount Of Data Efficiently?
Started by
Serefan
, Sep 10 2008 01:28 PM
5 replies to this topic
#1
Posted 10 September 2008 - 01:28 PM
#2
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.
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
Posted 22 September 2008 - 11:06 AM
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
Posted 22 September 2008 - 06:24 PM
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.
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
Posted 23 September 2008 - 10:24 AM
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?
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
Posted 02 October 2008 - 08:46 AM
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.
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!












