Save-Point
Best Practices for Adding New Data to Saves - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Games Development (https://www.save-point.org/forum-4.html)
+--- Forum: Code Support (https://www.save-point.org/forum-20.html)
+--- Thread: Best Practices for Adding New Data to Saves (/thread-5385.html)



Best Practices for Adding New Data to Saves - tnsi - 02-14-2015

I'm currently beginning work on a significant collection of scripts, which adds significant functionality to an RM game- but also handles a large amount of new data that doesn't exist within the default scriptset of RPG Maker. Is there a best practice for adding new data- while retaining compatibility?

Basically, what I'm seeking to do is define a new set of data within the save file that handles another set of variables, and I don't want to conflict with existing scripts or access variables accessible in the RM GUI.


RE: Best Practices for Adding New Data to Saves - DerVVulfman - 02-15-2015

Aliasing would be best, and I do have a method of sorts you may wish to look at: Game Data Sneak. That may not work COMPLETELY with VXAce, due to its use of a new manager class for the data... but it is a start.


RE: Best Practices for Adding New Data to Saves - Taylor - 02-15-2015

It depends on what you're asking? What you're talking about my instinct was handling "header" data for save files. In VXAce, instead of accessing the main body of saved data in actors, system, etc, it creates a set of data that's used for showing in the save menu.

This is in the DataManager module for my own game, albeit slimmed down:
PHP Code:
<?php 
def self
.make_save_header
header
= {}
header[:characters] = $game_party.characters_for_savefile
header
[:partysize] = $game_party.members.size
header
[:playtime] = $game_system.playtime
header
[:location] = $game_map.display_name
header
[:day] = $game_variables[4]
header[:image] = $game_variables[5]
header
end
Through this, I can access particular information (like specific variables) in the save file display.

However, if you're asking specifically about just saving that data, then I'm not sure what to suggest. I've honestly always just aliased related inits of certain Game_ classes, like System for general things. I've avoided creating whole new modules or classes because of how older RMs treated them in the past. As I recall, if you didn't save and load data in the same order in RMXP, it would cause problems. (Never mind data being absent.)

Of course, checking the Game Data Sneak script/tutorial link, that could be a method around it. It performs the aliasing of Game_ classes without bogging them down. As for the save/load for RMVXA, I suspect it avoids the issues RMXP has: make_save_contents and extract_save_contents in DataManager look a lot more efficient than RMXP's method.
PHP Code:
<?php 
def self
.make_save_contents
contents
= {}
contents[:system] = $game_system
[...]
def self.extract_save_contents(contents)
$game_system = contents[:system]
[...]



RE: Best Practices for Adding New Data to Saves - tnsi - 02-16-2015

Looks like aliasing the make/extra save contents did the trick. Thanks guys.