The Daily Click ::. Forums ::. Klik Coding Help ::. Advanced Save Game Feature
 

Post Reply  Post Oekaki 
 

Posted By Message

Blue66



Registered
  24/05/2008
Points
  1186

GOTW JUNE 2010 WINNER!Hero of TimeVIP Member
25th September, 2009 at 15:51:26 -

Hi guys!

Do you know how to make 'advanced save games' where ALL data of ALL frames is stored into? Do you know how to do that? I've tried to find an article or something about INI++ saving or using arrays, but I didn't find anything useful so far.

So is there a way to store all objects of the game to a file? Or maybe just specific objects?

I was considering this, because if there is a way to do that, I would place fixed items/ammo/health etc in the levels and no matter if you leave the frame, load or save your game, the items would still be gone after you've picked them up and come back.

Edited by Blue66

 
www.paulinthenet.de
www.gungirl2.com

Silveraura

God's God

Registered
  08/08/2002
Points
  6747

Game of the Week WinnerKlikCast StarAlien In Training!VIP Member360 OwnerWii OwnerSonic SpeedThe Cake is a LieComputerChristmas Tree!
I am an April Fool
25th September, 2009 at 16:31:11 -

You can store all that information with relative ease using something like an array. It might make things easier if you plan it out ahead of time using an excel spread sheet or something. You might have something like Ammo on x,1 and all the various types of guns you're holding ammo for on 1,1; 2,1; 3,1; 4,1; and so on.

The Save Game Object exists and if you wanted to use it, is functional, but if you wanted something that will be far less limiting in the future, learning how to use arrays or INIs to save information would be the best way to go for now.

Also, one big thing people I've talked to about save games, seem to frequently miss. Yeah, you can save the information. You also have to load it. So the whole process of saving the information into the file has to be done in reverse to pick the information back up out of the file and placing it in the appropriate spots. Your game wont know how to do anything until you tell it how to do something.

 
http://www.facebook.com/truediamondgame

Blue66



Registered
  24/05/2008
Points
  1186

GOTW JUNE 2010 WINNER!Hero of TimeVIP Member
25th September, 2009 at 16:59:59 -

Thanks so far!

Right now I'm just saving all global values to a file when you save the game. It works fine, but if I would like to add 10 collectable items to each level (let's say I have 50 levels) and I would like to check if each item has been taken or not, I would have to create 500 events and 500 global values to check each item. And another 500 events to see if the item has been taken and destroy it at start of the frame if so...

That would kinda suck

I've considered using the "Save Frame Position" event, because it seems to work fine, but I would have to save each frame for each save slot individualy - and that would kinda suck too

So I'm looking for another way... maybe with an ini? Haven't found any article about this kind of "advanced" problem yet.

Edited by Blue66

 
www.paulinthenet.de
www.gungirl2.com

AndyUK

Mascot Maniac

Registered
  01/08/2002
Points
  14564

Game of the Week WinnerSecond GOTW AwardHas Donated, Thank You!VIP Member
25th September, 2009 at 19:06:52 -

Instead of using global values you could just use two inis. One temporary one to constantly update all your game's values positions and whatever to and another to actually save and load from.

There is no quick way to just save everything to an ini as far as i know.

Although pixeltheif's grid quest takes ini usage to extremes so he might have a few tips on how to best use them.



 
.

Del Duio

Born in a Bowling Alley

Registered
  29/07/2005
Points
  1078

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!Evil klikerHasslevania 2!The OutlawSanta Boot
25th September, 2009 at 19:14:55 -

INIs are great if you want to easily edit and test your game out, but the bad part is anybody can cheat your game by editing it (unless you encrypt it, which I've had errors with before).

Sounds like an array is what you need, and with 10 items / frame, it's probably going to be tedious.

Something as easy as a string array's condition
at the start of the frame if array$(x pos 1) = "YES" then destroy object "Treasure1"
would probably be the best way to do it. Just lump all these treasure collected events into one group at the top of your code at the start of the frame and you'll be fine.

 
--

"Del Duio has received 0 trophies. Click here to see them all."

"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"

DXF Games, coming next: Hasslevania 2- This Space for Rent!

Solgryn

Solgryn dot org

Registered
  20/12/2008
Points
  12572

GOTW Winner!VIP MemberWii OwnerIt's-a me, Mario!The Cake is a LieGOTM 2ND PLACE! - APRIL 2009GOTM 2ND PLACE - JUNE 2009PS3 OwnerKlikCast #15 Compo Winner!LOL Sign
You've Been Circy'd!GOTM WINNER - JANUARY 2010I am an April FoolGOTW MARCH 2010 WINNER!Santa Hat
25th September, 2009 at 23:33:58 -

Actually, I'm using ini++ and i'm very happy with it since it has a encryption option in it! Then it will automatically encrypt/decrypt with a specified key each time you load/save. And it's working fine for me.

But dunno about storing all data of all frames, you need some kind of loop and stuff.

If you for example do like this:

You spread a value 0 in the items, so each item has a different value (1,2,3)

and when you collide with it:
-destroy
-INI save item "Str$(Alteravle value A)" in group "Item" to value "Str$(Alteravle value A)"

And then have a condition that says:
- if Alterable value A of "Item" == INI(group"Item",Item"Str$(Alteravle value A)",0) (Or something, cant remember how it looks like)
- destroy the item

I hope this helps as that is the technique i'm using in Blob III.
Please ask questions if there is something you arent clear on, as I am awful to explain stuffs .

 
www.Solgryn.org

Image

Watermelon876



Registered
  16/04/2009
Points
  27

I am an April FoolVIP Member
26th September, 2009 at 00:17:40 -

A slightly noobish fix: Save Frame Position and Load Application Position!

 
Awesomeness is Watermelon.
*/l、
゙(゚、 。 7
l、゙ ~ヽ
じしf_, )ノ
This is Koji. Copy and paste Koji to your sig so he can acheive world domination.

Solgryn

Solgryn dot org

Registered
  20/12/2008
Points
  12572

GOTW Winner!VIP MemberWii OwnerIt's-a me, Mario!The Cake is a LieGOTM 2ND PLACE! - APRIL 2009GOTM 2ND PLACE - JUNE 2009PS3 OwnerKlikCast #15 Compo Winner!LOL Sign
You've Been Circy'd!GOTM WINNER - JANUARY 2010I am an April FoolGOTW MARCH 2010 WINNER!Santa Hat
26th September, 2009 at 00:27:50 -

I havnt tried that but I use the .ini to also keep track of stuff when one is playing the game. Which objects has been taken and stuff.. And also I can display the values in a load game frame for example..

 
www.Solgryn.org

Image

Blue66



Registered
  24/05/2008
Points
  1186

GOTW JUNE 2010 WINNER!Hero of TimeVIP Member
26th September, 2009 at 15:17:43 -

Hmm this sounds very interesting. So I think it could look like this:

all items have spread values in each frame

then if I pick up an item, it writes inside the ini file:
item X of frame Y pickedup = 1

and if a frame is loaded, it checks the ini for every item of that frame and destroys it if pickedup equals 1.

Am I understanding this correctly? Would it work that way?

Edited by Blue66

 
www.paulinthenet.de
www.gungirl2.com

Solgryn

Solgryn dot org

Registered
  20/12/2008
Points
  12572

GOTW Winner!VIP MemberWii OwnerIt's-a me, Mario!The Cake is a LieGOTM 2ND PLACE! - APRIL 2009GOTM 2ND PLACE - JUNE 2009PS3 OwnerKlikCast #15 Compo Winner!LOL Sign
You've Been Circy'd!GOTM WINNER - JANUARY 2010I am an April FoolGOTW MARCH 2010 WINNER!Santa Hat
26th September, 2009 at 16:38:05 -

Yea, try that. It should work =D

 
www.Solgryn.org

Image

[DELETED]

Likes to put dots on paper

Registered
  08/12/2008
Points
  118

MushroomVIP MemberARGH Sign
27th September, 2009 at 08:02:29 -

That's something I found annoying about INIs is that they took longer to save/load to and you would be constantly adding to it, whereas with Arrays you can just use the actions "Save" and "Load" to load the whole file straight away. INIs are still very useful though and some people prefer to use them over arrays for everything.

 
n/a

Solgryn

Solgryn dot org

Registered
  20/12/2008
Points
  12572

GOTW Winner!VIP MemberWii OwnerIt's-a me, Mario!The Cake is a LieGOTM 2ND PLACE! - APRIL 2009GOTM 2ND PLACE - JUNE 2009PS3 OwnerKlikCast #15 Compo Winner!LOL Sign
You've Been Circy'd!GOTM WINNER - JANUARY 2010I am an April FoolGOTW MARCH 2010 WINNER!Santa Hat
27th September, 2009 at 15:15:29 -

inis doesnt take that much time to load, but save; yes. But this way you wont be saving all the time, just when you collide with an object and I've had no FPS etc. problems with that

 
www.Solgryn.org

Image

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49610

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
27th September, 2009 at 20:28:47 -


Originally Posted by jthongbai
That's something I found annoying about INIs is that they took longer to save/load to and you would be constantly adding to it, whereas with Arrays you can just use the actions "Save" and "Load" to load the whole file straight away. INIs are still very useful though and some people prefer to use them over arrays for everything.



ini++ holds everything in memory until you save, or load.

So it's the same speed as an array, and the file size is smaller for the most part.

 
n/a

[DELETED]

Likes to put dots on paper

Registered
  08/12/2008
Points
  118

MushroomVIP MemberARGH Sign
28th September, 2009 at 02:40:42 -


Originally Posted by UrbanMonk

Originally Posted by jthongbai
That's something I found annoying about INIs is that they took longer to save/load to and you would be constantly adding to it, whereas with Arrays you can just use the actions "Save" and "Load" to load the whole file straight away. INIs are still very useful though and some people prefer to use them over arrays for everything.



ini++ holds everything in memory until you save, or load.

So it's the same speed as an array, and the file size is smaller for the most part.



This I was not aware of, thanks!

 
n/a

Blue66



Registered
  24/05/2008
Points
  1186

GOTW JUNE 2010 WINNER!Hero of TimeVIP Member
28th September, 2009 at 18:55:30 -

First off, big thanks for all your help. It works! ... for the most part

I spread a value in the Shotgun Ammo Item at start of the frame and when I pick them up, it writes in group "level X" the value "ShotgunAmmotakenY = 1" (temporarily I've put a "save file" into the event to test it).

When the frame loads, it checks with a fast loop, if that item is in the ini file and if so, destroys that one with the correct value properly.

BUT... I cannot find the mentioned "memory" you're talking about. When I don't save the data to a file before the frame is left or reset, it saves nothing (all ammo appears).

How do I use that memory you're talking about? Couldn't find that function

Edited by Blue66

 
www.paulinthenet.de
www.gungirl2.com
   

Post Reply



 



Advertisement

Worth A Click