Sign in to follow this  

RPG data holding

This topic is 4810 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Well, if you have NWN, toy with the tooleset a little.
I think they've done a really great way of managing areas/npcs/scripts/etc.
Basically all npcs have a set of scripts assigned to different events. For instance, if you want to talk to them, script1 will be called. When you attack them, script2 will be called and when you poke them with a stick, script3 will be called. Of course, you can easily change those scripts and assign new ones (as well as define your own triggers).
At the same time, all actions are manage through and action-queue. Quite logical, once an NPC finishes an action, he starts the other and so on. Of course, scripts can assign actions (so for the "onAttack" trigger, you would give the NPC a script that assigns a "attack player" command to him).

This sounds like a really good and flexible system to me :P

Share this post


Link to post
Share on other sites

This topic is 4810 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this