Help with a checkpoint save system?


#21

Basically, the drawbacks to having multiple sets of variables are readability, performance, and ease of updating. *gosub and various other methods could improve on any or all of these sometimes, but choicescript games have a massive safety margin for performance, this case is pretty straightforwardly readable, and no updates are expected, so I’d recommend against using them.

Simple number of variables is not really going to be an issue here; if you wanted to do a Prince Of Persia thing and let people go back some number of choices whenever and thus needed a save point after literally every choice then it might start mattering. And a copy-paste plus swapping numbers is all the effort that will be required to create them so that’s probably easier than using gosub.

I might use gosub to have a centralized load routine, but it’s not really necessary and I wouldn’t recommend it unless already comfortable with using it. You could almost certainly do it in fewer lines of code but it would be harder to follow per line.


#22

Actually, that’s exactly what I was saying.

And that, too.

Fewer lines of code mean fewer chances of mistakes, usually. That’s why we try to code efficiently.


#23

Yes but a gosub is more complicated than a variable assignment or a branch.

Specific recommendation: if you already know how to do it with a gosub do it with a gosub; if you don’t this isn’t hard enough to merit learning. Though it’d also be a good place to start practicing, if you want to learn how.

Gosub is one of many instances of things which make hard things easier and easy things harder, and it particularly makes it easier to handle things that become harder than anticipated. So for serious coding it’s better to use it too much rather than not enough, but for a basic Choicescript game you don’t really need it. Just, uh, don’t try to write Choice Of Magics without it.


#24

Yo, guys.
What am I missing?


#25

People who probably all have programming backgrounds debating what advice to give someone who probably doesn’t, basically.


#26

I don’t have a programming background, but I think the trick to giving advice to a fellow professional in a different field is just to try and avoid jargon as much as possible. :slight_smile:


#27

In that case, I’d like to lead you guys to this thread.

She made a super easy checkpoint system…
Well, it’s not really that easy, but I’ve personally tried it and it works super well. But TBH, I prefer creating my own system since I can actively track, develop, and tune it as what I need.

Nevertheless, if you need a how-to-do for her system, give me a call.


#28

Generally, yeah; the question is whether to recommend the better but harder way or the easier way.

Okay, that’s probably the best option. If you have a chance to use code someone else already wrote to solve your problem always take it.


#29

A game which has already a Checkpoint System which is because of it one of my favourites is Mecha Ace.