Save/Load
Displaying 1-5 of 5 total.
1
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
jedi_knight_krazy

I'm making my very first game with Verge, which is a game based off of LEGO's BIONICLE theme. It's mainly to show off Verge's power to a bunch of RPG Maker users, and Verge is gonna get bad marks if it can't save or load. So how DO you save and load in Verge? I know it's not built-in...

Sorry for being such an annoying new user,
++Krazy++

Posted on 2006-10-25 19:02:24

Jesse

Saving and loading is done via writing and reading files. Take a look at the File Functions for reference. A basic outline is:


void save( ) {
int f = FileOpen("save.dat", 2);
FileWriteQuad(f, hitPoints);
FileWriteQuad(f, xPosition);
FileWriteString(f, curmap.path);
// etc... write everything you want to save
FileClose(f);
}

void load() {
int f = FileOpen("save.dat", 1);
hitPoints = FileReadQuad(f);
xPosition = FileReadQuad(f);
string map = FileReadString(f);
// etc... load back all that stuff in the same order
FileClose(f);
Map(map);
}


Or something like that. Anyone have a good example of this in action? (that isn't as large as sully?)

Posted on 2006-10-25 21:12:50

Jesse

Perhaps I should mention that I just made up xPosition and hitPoints as hypothetical things you might keep track of. curmap.path does exist, though.

Posted on 2006-10-25 21:16:18

Technetium

Just want to add that, when you write your save/load code, you should think ahead as much as possible about what saveable variables your game will need. When you introduce a new variable, you want it to already be taken into account in the saving/loading functions. If it isn't, then you're going have a problem trying to load previous save files, and most likely you'll have to start at the beginning of the game just to have a compatible save file. For example, my game has had "airshipx" and "airshipy" variables saved and loaded since I started the game, but they haven't been used for anything yet, and won't be for quite a while still. But when I need it, I won't have to restart my game (which could take a long time).

Posted on 2006-10-28 13:57:43

Jesse

You could also have a version number early on in the file that you can use to detect which fields are present, and so fill in default values for old versions that are missing variables.

Posted on 2006-10-28 21:16:27


Displaying 1-5 of 5 total.
1
 
Newest messages

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.