Creating A Save File

11 posts

Flag Post

I’m working on an rpg currently, and instead of completing the action-ish first (I have graphics drawn, etc, but haven’t implemented a battle system) I’m working on creating a save file and inventory system. I don’t know how to save data to a users profile on Kong. I’m aware that this may not be the best way to design my game, but I want to tackle the harder (for me, at least) stuff first. Any help would be appreciated!

I’m using AS2.0 and CS5.

 
Flag Post
Originally posted by epicfail1994:

I’m working on an rpg currently, and instead of completing the action-ish first (I have graphics drawn, etc, but haven’t implemented a battle system) I’m working on creating a save file and inventory system. I don’t know how to save data to a users profile on Kong. I’m aware that this may not be the best way to design my game, but I want to tackle the harder (for me, at least) stuff first. Any help would be appreciated!

I’m using AS2.0 and CS5.

That’s not how saving works. Try accessing save data on a kong game from two different computers and you’ll notice that you can’t. You can’t even load the same data on different browsers.

What you can do to save data in a flash game is export it to a .sol file that is stored wherever the browser stores it’s temporary files and then the game loads that when you tell it to.

When writing your game you can use the Kong API to submit data such as high scores and achievement stuff to the Kong server and the game will display the scores in the table next to the game, but it’s up to Kong admins to decide to give real achievements based on what you submit.

You have no way of modifying a player’s profile directly.

 
Flag Post

Also, look up SharedObjects. They’re used for saving data to a user’s computer.

 
Flag Post

Unless you have a server and database, you can only store data locally.

 
Flag Post
Originally posted by draganviper:
Originally posted by epicfail1994:

I’m working on an rpg currently, and instead of completing the action-ish first (I have graphics drawn, etc, but haven’t implemented a battle system) I’m working on creating a save file and inventory system. I don’t know how to save data to a users profile on Kong. I’m aware that this may not be the best way to design my game, but I want to tackle the harder (for me, at least) stuff first. Any help would be appreciated!

I’m using AS2.0 and CS5.

That’s not how saving works. Try accessing save data on a kong game from two different computers and you’ll notice that you can’t. You can’t even load the same data on different browsers.

What you can do to save data in a flash game is export it to a .sol file that is stored wherever the browser stores it’s temporary files and then the game loads that when you tell it to.

When writing your game you can use the Kong API to submit data such as high scores and achievement stuff to the Kong server and the game will display the scores in the table next to the game, but it’s up to Kong admins to decide to give real achievements based on what you submit.

You have no way of modifying a player’s profile directly.

Ah thank you. Let me rephrase, then: how can a save data locally to a player’s computer?

 
Flag Post
Originally posted by epicfail1994:
Originally posted by draganviper:
Originally posted by epicfail1994:

I’m working on an rpg currently, and instead of completing the action-ish first (I have graphics drawn, etc, but haven’t implemented a battle system) I’m working on creating a save file and inventory system. I don’t know how to save data to a users profile on Kong. I’m aware that this may not be the best way to design my game, but I want to tackle the harder (for me, at least) stuff first. Any help would be appreciated!

I’m using AS2.0 and CS5.

That’s not how saving works. Try accessing save data on a kong game from two different computers and you’ll notice that you can’t. You can’t even load the same data on different browsers.

What you can do to save data in a flash game is export it to a .sol file that is stored wherever the browser stores it’s temporary files and then the game loads that when you tell it to.

When writing your game you can use the Kong API to submit data such as high scores and achievement stuff to the Kong server and the game will display the scores in the table next to the game, but it’s up to Kong admins to decide to give real achievements based on what you submit.

You have no way of modifying a player’s profile directly.

Ah thank you. Let me rephrase, then: how can a save data locally to a player’s computer?

There are two ways that I know of: You can use Shared Objects or prompt the user to save a file.

 
Flag Post
Originally posted by epicfail1994:

I’m using AS2.0 and CS5.

If you’re just getting into flash, I suggest you do so in AS3 rather than AS2.

Having said that, saving is actually really easy as long as you don’t try what I did in a rather recent topic (saving a vector of saved data objects was a mistake). If you insist on using AS2, be careful about saving objects directly—clone them first. In AS3, you can use ByteArrays to do that for you.

 
Flag Post

A way to achieve this would be to use Kong’s shared content API, passing the username and only loading it if the loaded name matches the current user.

But there are two issues:
1: The user won’t be able to play as a guest.
2: The user will need to browse the shared saves and find his/her own (unless Kong restored the page which used to link to your shared content).

 
Flag Post

You can use Gamersafe’s, but you may have to do some messy stuff to get it to work well with users, as well as add micro-transactions. And as Senekis said, guests create problems.

Kong’s system currently has several problems with it (it can be public, as well as it’s not displying correctly on user profiles anymore). I’m not sure if it’s worth using as saved data for a RPG.

If you have your own server, you can use this to make shared objects work across multiple domains, I think: http://jodieorourke.com/view.php?id=115&blog=news

 
Flag Post
Originally posted by Senekis93:

A way to achieve this would be to use Kong’s shared content API, passing the username and only loading it if the loaded name matches the current user.

But there are two issues:
1: The user won’t be able to play as a guest.
2: The user will need to browse the shared saves and find his/her own (unless Kong restored the page which used to link to your shared content).

You can use the kong user name as a filter, so there won’t be any trouble finding previous saves. Other issues with using Kong API for save games:

  • No automatic saving – if the player forgets to save before closing the browser, progress lost
  • If the kong API connection is lost, player can’t save. Progress lost
  • Manual saving is slow
  • Saved games will clutter up your profile page. Can’t overwrite saves; they have to be manually deleted
  • The shared services API is AS3 only
  • Your game won’t save on other websites

I’d go with shared objects.

 
Flag Post

Keep in mind that I’m pretty noob at AS2 – I’m just finishing up my first game now, a top-down game, similar to Stick RPG. I don’t need an extremely complex saving system, so not sure if this will work for you, but this is what is working for me – it really just saves variables.

function saveGame(){
myLSO = SharedObject.getLocal(“Arcaian”);

if(myLSO.data.myObj == undefined){ // No object exists trace(“Saved Game”); } else{ trace(“Overwrote Saved Game”); } myObj = {}; myObj.objArray = new Array(); myObj.objArray0 = [variable name]; // increase the 0 by one for every variable myLSO.data.myObj = myObj;

}

function loadGame(){
myLSO = SharedObject.getLocal(“Arcaian”);
if(myLSO.data.myObj == undefined){ // No object exists
trace(“No Saved Game”);
}
else{
trace(“Loaded Game”);

[variable name] = myLSO.data.myObj.objArray0; //increase the 0 by one for every variable you add }

}

I’m not sure if it’s the best code, but it works for my project ;)