Jump to content
Sign in to follow this  
Tsukihime

Dynamically modifying data files

Recommended Posts

What are your thoughts on dumping new data directly into rvdata files?

 

I'm trying to write a custom weapon creation system but it looks like I have to actually write new data out, otherwise the next time you load the game the data won't be there.

 

It would have to be for separate save games as well.

 

Best way to approach this?

 

I'm thinking of just creating subfolders in /data for the corresponding save number.

There, I would dump a copy of the data files for the corresponding save file.

 

If we're continuing from a previous save, then we would load from the custom folder.

Otherwise, we load from normal database.

 

Of course, I would prefer if I could just separate the normal database objects from the custom database objects that are created at run-time, but I can't think of any good way to do this.

Share this post


Link to post
Share on other sites

With our last couple of Aveyond games, I had a blacksmith and an apothecary system. Done in XP, I actually created Blacksmith.rxdata and Apothecary.rxdata files, and I treated them just like the other database files - they were read into $data_blacksmith and $data_apothecary. No save files necessary - they became part of the database.

 

To do this, I first created classes for each, with their definition and methods. These stayed in the shipped games. Then I created "setup" scripts that populated $data_blacksmith and $data_apothecary initially and dumped the contents out to the .rxdata files. THOSE scripts ran every time I tested the game, so I could add and change items as much as I liked. When it came time to ship, I just removed those scripts so the game loaded everything from the .rxdata files instead.

Edited by shaz
  • Like 1

Share this post


Link to post
Share on other sites

The data files I'm modifying are weapons and actors.

 

Since the default scripts use numbers to ID objects, I figure there will be conflicts between different save files if one one game I created 20 actors, and in another game I created another 20 actors, but they all had the same ID's.

 

That's where the idea of having separate rvdata files comes from.

I'm guessing you used some sort of unique ID system for the blacksmith and apothecary objects so that different save files could go into the same file and pick out the correct data?

Share this post


Link to post
Share on other sites

Oh, I think I misinterpreted your requirements.

 

Are you adding to the content or functionality of those classes (modifying the database structure itself)? Or are you just adding new items to the database as you go? If the latter, I'd just tell it to save $data_weapons and $data_actors to the save file along with all the other stuff (actually, doesn't it already do that with actors? Or that might be a mod I'm thinking of) and make it read those things from the save file rather than the .rvdata2 files.

  • Like 1

Share this post


Link to post
Share on other sites

Yes, I'm just adding content as I go. I imagine it would be similar to that blacksmith/apothecary features.

Create your own actors in-game, create your own weapons, monsters, etc.

 

Fairly simple things that just append new entries to these data hashes.

 

I like the idea of dumping custom data with the savefile. That would seem like the most logical thing to do, since data associated with an instance of that game should be kept with it.

 

I'll try keeping hashes for CUSTOM data which will be updated whenever I create custom content, dump the custom data to the save file, and on load-time just merge the custom data with the original data.

 

That way all changes are isolated to a single load method rather than having to hack around with the rest of the load/save system.

 

EDIT: solution found. As suggested, I went with dumping data into save files and merging data with the normal database :)

 

Now the game loads properly and all of the custom data is retained.

Edited by Tsukihime

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted