RPG data holding

Started by
9 comments, last by Koobazaur 19 years, 7 months ago
im not making an rpg right now but i hope to eventually (it will be my crowning acivement before i go 3d) but i was wondering how they store the scripts and the events and all the massive data that gose into an rpg like the movements of npc and sound effects do they hard code it all? or do they have a modifyed map maker were they can add these things?
____________________________"This just in, 9 out of 10 americans agree that 1 out of 10 americans will disagree with the other 9"- Colin Mochrie
Advertisement
Hard-coding data for a massive game is problematic for at least two reasons- One: it's a pain to edit some massive data sets, such as maps, with just a text editor. Two: Any modification of the data requires recompiling the entire project. Hogging lots of RAM probably has problems too, but I can't speak for that really.
Most professional companies, as far as I can tell. Put all of their data into external files, and read and dump data as its appropriate. Files are often consolidated into large, archive files, like zip files, and there are libraries for picking particular data from large archive files.
geeze sound complicated when would each file know when to be opened and such ?
____________________________"This just in, 9 out of 10 americans agree that 1 out of 10 americans will disagree with the other 9"- Colin Mochrie
In my RPG, I query a list of NPCs in the scene, load the list into memory, and then reference another NPC file by name (the list is just a pile of filenames for the individual NPC definitions) when the script engine wants them to move, or when they need to be talked to.
If your game is simple enough, you could probably get away with hard coding all of your data. Otherwise, your program has to know what files it needs to have in memory.

One possible solution:
You could break-up your game into sub-sections. Whenever the main character enters a sub-section then the program can load the appropriate map and other objects. You could have some sort of table (array) which stores the names of the needed files for each sub-section. Remember as you allocate new maps and other objects you also want to de-allocate the old stuff.
Hey, what's up.

I'm in the process of making an RPG. And I'm gonna break it up.
As Kelly G said, sub-sections.

My game is going to work as follows. First of all, the world is going to be broken up into smaller sections. I've written a level editor where I can import a maximum of 2000 meshes per section. I then save that info to a file. Doing it this way I can have a large amount of data but only use one at a time, I also don't have to worry about cutting it up. For NPC's or anything for that matter, I'm going to use scripts. So say I have 5 NPC scripts. Each one will have an index, when I import a NPC into the game/lvel editor I will give it an index to use. I will probably store those scripts in a file, thereby enabling me to add as many as I want but only use what I need. I'm also going to apply this principle to everything; players, enemies, particles etc.

Hope this helped.

[Edited by - Mr_Ridd on October 11, 2004 6:45:53 AM]
The ability to succeed is the ability to adapt
Quote:Original post by Kelly G
Two: Any modification of the data requires recompiling the entire project.


You know, there are compilers which compile only the modified file, not the whole project every time you change something.
Quote:Original post by Feidias
Quote:Original post by Kelly G
Two: Any modification of the data requires recompiling the entire project.


You know, there are compilers which compile only the modified file, not the whole project every time you change something.


true but any file that references your data will have to be recompiled as well ... and as i'm guessing most code in an RPG's would reference game data most of it would need to be recompiled. Even if it is only 1 file its still a major hassle, being able to leave a leave a level, edit it while the game is still open, then reload the level once you've save it out with your editor is very handy!
Quote:Original post by kaysik
and as i'm guessing most code in an RPG's would reference game data most of it would need to be recompiled.


Only the parts that use the data. If you use all data all over the source code I would call that poor programming. Learn the wonders of splitting the code to modules..

Quote:being able to leave a leave a level, edit it while the game is still open, then reload the level once you've save it out with your editor is very handy!


It is. But usually RPG's have many other sequences of data which can be included in the source code direcly. Level and object editors are those where you would use an editor to make things easier.
Quote:Original post by raptorstrike
geeze sound complicated when would each file know when to be opened and such ?


When you make your map file you'd include information about what files are need to properly use the map. For example (a rather simplistic one at that), you might associate the byte value 1 in your map with a grass tile, the value 2 with a tree tile and so on. If your map format was more complex you might also store event information in your map as well so that when the player say step on a certain tile a script would run.

I hope this helps.
Patrick

This topic is closed to new replies.

Advertisement