Author Topic: ship save/load script  (Read 10605 times)

0 Members and 1 Guest are viewing this topic.

Re: ship save/load script
Well, the script is more than 6 years old and I would do many things different today. Especially the limited length of a scripting call required several workarounds that are not necessary anymore.

Both of your suggestions don't seem to be hard to implement there is still the issue of backwards compatibility. All missions have to be changed, old savefiles might be broken,... People also use ScreenCam which comes with this script, so if the mod used an older version saving/loading might not work anymore.


The question is how many people use this script at all and if there is any real interest in an improved version. If yes then I would do the modifications...
Here goes scripting and copy paste coding
Freespace RTS Mod
Checkpoint/Shipsaveload script

 

Offline Darius

  • 211
Re: ship save/load script
Your ship save script is amazing and the cornerstone of our checkpoint system, so there is at least one modding team that has an interest in anything you can do to improve it!

 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Anims: 418, Cutscenes: 8, Mainhalls: 7, Logos: 52
    • Steam
    • Twitter
    • Mix-Hai Productions
Re: ship save/load script
Likewise. BtA makes heavy use of it.
Cutscene Upgrade Project - Mainhall Remakes - MixaelANITools - Between the Ashes - MjnMixael's Render Boutique - Mix-Hai Productions
Youtube Channel - P3D Model Box - Photobucket Albums - Model Releases - Downloads
Between the Ashes is looking for committed testers, PM me for details.
Report MediaVP issues, now on the MediaVP Mantis! Read all about it Here!

 
Re: ship save/load script
BtA, BP and whatever Goober does are the projects using the script that I know of.

Goobers suggestions won't add any features or actual functionality to the script. It would just streamline how the script works internally and how it is used in FRED. This means that I have to change a lot and you would have to modify all missions with checkpoints.
My question is if there is any real need for these things. A reason could be that the script slows down the game due to too many savecalls or feature ideas/additions that would be easier to use/implement in a modified script. Otherwise it would just create work for me and the modding teams while the script was already fine before.

What I have in mind is a structure like:
openfile 'filename' (loads data from a file into temporary table, without 'name' just creates an empty table or clears the table)
saveship/savevar 'name' (saves shipdata/variable from mission in temporary table)
loadship/loadvar 'name' (loads shipdata/variable from temporary table into mission)
savefile 'filename' (saves temporary table in file)
removeship/removevar 'name' (removes shipdata/variable from temporary table)

Here goes scripting and copy paste coding
Freespace RTS Mod
Checkpoint/Shipsaveload script

 

Offline Goober5000

  • HLP Loremaster
  • Administrator
  • 214
    • Goober5000 Productions
Re: ship save/load script
I'm using the script for two missions in Scroll of Atankharzim so far, and I will almost certainly use it for more.  One of these missions has two checkpoints and would have been quite intractable to playtest without the script.

Your proposed changes sound good.  They are not, strictly speaking, needed, since the script is very satisfactory already (especially now that you've fixed the variable saving).  But they would definitely be appreciated and would improve the ease-of-use of the script for future missions.

The deferred file writing would be welcome.  The complicated Scroll mission I mentioned has a noticeable freeze for about a half-second when a large checkpoint, involving lots of variables and ships, is saved.

I don't think you would need to worry about backwards compatibility.  Just create a new script with a new filename, and make sure that all the function calls are different from the old ones.  To make this obvious, you could use e.g. saveship2 rather than the original saveship.  You should not need to worry about the savefile format because presumably only newly released missions would use the new savefile.

 

Offline Goober5000

  • HLP Loremaster
  • Administrator
  • 214
    • Goober5000 Productions
I thought I'd post my version of the ship save/load script.  The only major change is to implement the deferred file writing I mentioned above, since I encountered significant pauses in both Scroll and Deneb III when using the script in certain missions.  With this new version, the pauses are not noticeable.

The new functionality required a few changes to the API.  When saving a file, you must call save_init before all of the save calls, followed by save_done after all of them.  (The save_done call is what actually writes the data to the file.)  When loading a file, you must call load_init before all of the load calls.  There is no corresponding load_done.

NB: In this script, I used "Invisible Target" instead of "Shipsave" for the temp class ship entry.

 
Oh, so you already made these changes, that's nice :)
I'll add your version to the package, update the readme and maybe rename the shipclass back to Shipsave for consistency. You could have sent me a PM though - I didn't notice any new posts in here despite checking the forum nearly every day.
Here goes scripting and copy paste coding
Freespace RTS Mod
Checkpoint/Shipsaveload script

  

Offline Goober5000

  • HLP Loremaster
  • Administrator
  • 214
    • Goober5000 Productions
Oh, well, I thought you would have thread notifications enabled.

(Actually, we have had issues with the forum not sending emails to some members, so you may not have seen it.)