How to make save/loads?

Hey there!!

So I need help on understanding on creating a save/loading feature in choicescript. I’ve been looking through the choicescript wiki, but it doesn’t quite make sense and is a little confusing to me.

I’ve even downloaded that one saving system java script, but it doesn’t seem to work for me.

Can someone help me out in creating a save/loading system? I’d love to hear some tips and feedback.

The *sm_init plugin only works when you upload it into dashingdon, and will give you an error if you try to play test it in the choicescript IDE. So you have to remove it if you want to go through your game first. You can add it in if you’re using any other app to code your game I believe, but I could be wrong.

7 Likes

Oooh! I see!!!

I was trying to upload it into my choice of games and going through the steps but, if it’s to go through dashingdon, that would make more sense! Thank you!!!

What is the reason for this, if I may ask?

The choicescript IDE doesn’t support that function as far as I know. So if you want to play test different parts of your story then you need to create a *goto_scene choice in the beginning of your game to quickly move around.

2 Likes

So… does dashingdon NOT use choicescript? I guess I’m confused why people can code their entire games with a feature, then have to remove that feature before release. Is there a drawback to having this command that dashingdon doesn’t have?

Well dashingdon is a hosting website that supports choicescript, to allow players to test games. My knowledge is limited, but I assume the plug-in was made with dashingdon in mind to stop people from having to go through blocks of text and choices to reach where they once were.

I believe that there is a thread that talks about this. I’m not a hundred percent sure about the process myself, so I might have to do some research too.

1 Like

the plug-in was made by @CJW for choicescript and it works in general but it is not official so it will cause both quickest and randomtest to fail.

@dashingdon is the one who hosts the website and made it so it works with the plug-in on the website.

All you have to do to run randomtest or quick test is put *comment in front of every line which has the plug-in code and the tests will skip it.

If you want to submit the game to Choice of Games or Hosted Games you will have to remove the code completely as well.

The plug-in is solely for the testing period, its not something you can currently have in your finished, released game.

3 Likes

But…why?

Because it’s an unofficial plug-in that the testing code does not recognise so throws up an error.

1 Like

Is there something keeping it from becoming an official feature, rather than a testing feature? There seemed to be a lot of discussion at one point about implementing a save feature. It seems like it’d be easier to do so with one that EVERYBODY uses.

Not that I am aware of but I believe it might be by a design choice where CoG wants players to experience consequences with their actions and being able to reload saves detracts from that.

Whereas testing wise it can be useful as it allows players to skip to later points of your game to experience new content quicker

2 Likes

No I understand that aspect. That’s a whole other discussion. I meant from a coding standpoint, is there anything keeping it from being implemented, or is it just a choice?

Saving and restoring has a problem: if you upgrade the game, it can break all existing saved games. The most obvious way this can happen is if you *create a new stat, which gets set in the first chapter. Anyone restoring their games in subsequent chapter won’t have that stat set.

It’s easy to write code that improperly assumes that a certain stat is set to a valid value, e.g. *if/*else chains that consider only three possibilities, but don’t consider the fourth possibility that the variable is unset. These *if/*else chains contain a bug that only happens when upgrading an old saved game; there’s no way to find those bugs through ordinary play. Quicktest and Randomtest will be useless for finding bugs like this; they only test the game as it is, not as the game used to be / could have been.

There are a bunch of subtle ways that saved games can be invalidated. Maybe someone saves a game in the maze.txt chapter, but in the current latest version, there are new restrictions to access that chapter (maybe you had to befriend a minotaur before you can enter the maze). During the maze, your minotaur friend is supposed to say a few lines of dialogue, but you don’t have a minotaur friend, because you restored a save from the old version, where you could enter the maze without one.

This is why Choice of the Vampire recently threw out all of its existing saved games when Volume 4 was released. The old saved games were severely invalid. Too much had changed in the earlier volumes.

If you’re very very careful with upgrades, you can find and fix all of these bugs, but we felt that offering CS authors an unrestricted save/restore mechanism was like handing authors a gun to shoot themselves in the foot.

12 Likes

Removed as Dan has explained it much better and from an official stand point

That makes sense. Thank you to @Skillzerk , @Nocturnal_Stillness , and @dfabulich for indulging my curiosity, it was very helpful.

1 Like

This topic was automatically closed 24 hours after the last reply. If you want to reopen your WiP, contact the @moderators.