Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
Hello i was wondering how one would go about creating savegames within coppercube. I figured it would probably be having a button or something call a js action but im not very fermiliar with scripting coppercube so i was hoping someone could maybe link to some recourses or post a quick explenation. |
||||
|
there really is no quick explication for saving games in CC. here is a link to search the Forum https://www.ambiera.com/forum.ph... you can type in what you what to know about (load/save game?) and it will pull up the posts it finds about the subject... |
||||
|
the saving procedure is varies from game to game so it depends on the type of game you are developing in most cases saving all the variables right before the game exits and load them all before the first drawing does the required stuff. but sometimes the game condition is that it is also required to save positions and all those stuff so this needs a more stuff to be added and sometime a game need to save high-scores only and nothing else... so it is completely dependent on the type of game how you want to save it.... It will be easy if it will automatically access all the variables and there will be an option to save and load them all at once..but sadly there is currently no option to do this. |
||||
|
I never use the inbuilt save variable menu item in CC - its far too limited and slow. Very easy to just record all your data in arrays instead and save that in one simple step: if you have an array called 'arrayData' and want to save inside a folder "insideFolderIfWanted': var data = arrayData.toString(); ccbWriteFileContent('insideFolderIfWanted/save.dat', data); You can open this DAT file using notepad to view it you want also. To load again just use: var data = ccbReadFileContent('insideFolderIfWanted/save.dat'); If you have multiple variables in the save file then you will need a template to match the variable name to the value under it and just for loop over each one to setup on load. |
||||
|
An easy way to save any game (coppercube or not) is to simply snapshot the RAM and then load the snapshot back to RAM when you restart the game. This is something you'd would do by calling a 3RD party RAM snapshot program from within coppercube using a command to save and load. |
|