Programming & Scripting

View unanswered posts | View active topics


Post a new topicPost a reply
Previous topic | Next topic 

  Beginner BeginnerMember since: 21.04.2012, 22:37Posts: 44 Likes: 0
 

 Post Topic: a system for saving and loading
PostPosted 25.04.2012, 10:23 
how to implement a system of saving and load from the main menu or through any other button?


sorry for my english-google >_<

User avatar   Trainee TraineeMember since: 21.10.2011, 11:48Posts: 135Location: Stuttgart, Germany Likes: 0
 

 Post Topic: Re: a system for saving and loading
PostPosted 25.04.2012, 22:49 
You can auto-save with triggers and the sve flownode in fg.
  Beginner BeginnerMember since: 21.04.2012, 22:37Posts: 44 Likes: 0
 

 Post Topic: Re: a system for saving and loading
PostPosted 05.05.2012, 17:03 
and can be more?plllllllssss


sorry for my english-google >_<
  Trainee TraineeMember since: 03.08.2009, 11:47Posts: 153 Likes: 0
 

 Post Topic: Re: a system for saving and loading
PostPosted 06.05.2012, 14:53 
so you cant save crysis 1 style?
User avatar   Crytek Staff Member Crytek Staff MemberMember since: 11.07.2008, 20:25Posts: 11734Location: Nottingham, UK Likes: 71
 

 Post Topic: Re: a system for saving and loading
PostPosted 06.05.2012, 15:03 
Here's the code to save the game:

Code:
auto gameFramework = gEnv->pGameFramework;
auto levelPath = gameFramework->GetILevelSystem()->GetCurrentLevel()->GetLevelInfo()->GetPath();
gameFramework->SaveGame(levelPath);


There's a bunch of optional params for specific save situations.


Out now! CryENGINE Game Programming with C++, C#, and Lua
Server programmer for Warface, Warface 360, and more
  Beginner BeginnerMember since: 28.12.2011, 12:32Posts: 78 Likes: 0
 

 Post Topic: Re: a system for saving and loading
PostPosted 06.05.2012, 15:19 
Quote by Cry-Ruan:
Here's the code to save the game:

Code:
auto gameFramework = gEnv->pGameFramework;
auto levelPath = gameFramework->GetILevelSystem()->GetCurrentLevel()->GetLevelInfo()->GetPath();
gameFramework->SaveGame(levelPath);


There's a bunch of optional params for specific save situations.


Where does this save? Is it saved in binary of plain text?


My OpenSource projects @ GitHub

https://github.com/thefarcry118/Banana-Phone
  Trainee TraineeMember since: 03.08.2009, 11:47Posts: 153 Likes: 0
 

 Post Topic: Re: a system for saving and loading
PostPosted 06.05.2012, 15:43 
So if you add that code and link it to a button or hotkey, it saves the game state as it is at that moment?
Or more specifically, what info does it save?
Position, active weapon, enemy pos, etc?
User avatar   Crytek Staff Member Crytek Staff MemberMember since: 11.07.2008, 20:25Posts: 11734Location: Nottingham, UK Likes: 71
 

 Post Topic: Re: a system for saving and loading
PostPosted 06.05.2012, 15:57 
See the serialisation methods (CPlayer::FullSerialize, SPlayerStats::Serialize etc) in Player.cpp to track what's saved for the player. Objects implement their own serialisation. Not sure off the top of my head where that saves to.


Out now! CryENGINE Game Programming with C++, C#, and Lua
Server programmer for Warface, Warface 360, and more
  Trainee TraineeMember since: 03.08.2009, 11:47Posts: 153 Likes: 0
 

 Post Topic: Re: a system for saving and loading
PostPosted 06.05.2012, 19:58 
Ah I see, 10x Ruan :)
User avatar   Hardcore Modder Hardcore ModderMember since: 11.10.2011, 18:41Posts: 903Location: Germany Likes: 10
 

 Post Topic: Re: a system for saving and loading
PostPosted 31.07.2012, 15:26 
Hi,

Sorry for bumping that up but whats the usual way to save session-independent data ? Like overall player statistics (# kills, play time etc) ? Is there a out-of-the-box way to do it or do i need to write my own serializations methods ? (should not be stored in user-friendly formats)

Thanks,
Oliver


Last edited by beast on 01.08.2012, 09:42, edited 1 time in total.
User avatar   Uber Modder Uber ModderMember since: 21.10.2011, 23:50Posts: 1731 Likes: 7
 

 Post Topic: Re: a system for saving and loading
PostPosted 01.08.2012, 00:19 
Kill counts may be stored in Game Tokens which are session independent, I guess.
User avatar   Hardcore Modder Hardcore ModderMember since: 11.10.2011, 18:41Posts: 903Location: Germany Likes: 10
 

 Post Topic: Re: a system for saving and loading
PostPosted 01.08.2012, 09:57 
Hi Neo,

ah right. I wonder why that not came to my mind in the first place :)
Can i add tokens during runtime for all levels/game instances or do i have to add them to the library within the sandbox prior to game launches ?

Thanks alot,
Oliver


Last edited by beast on 01.08.2012, 10:46, edited 1 time in total.
User avatar   News Posters News PostersMember since: 04.12.2007, 03:23Posts: 10356Location: Hamar, NorwayStatus: Online Likes: 507
 

 Post Topic: Re: a system for saving and loading
PostPosted 01.08.2012, 10:24 
Game Tokens can be accessed from any level within the game itself. Just add a new game token in the editor.


 
 
 

< Vascotia Studios >

Image   Image   Image   Image   Image

NO support via PM!
User avatar   Hardcore Modder Hardcore ModderMember since: 11.10.2011, 18:41Posts: 903Location: Germany Likes: 10
 

 Post Topic: Re: a system for saving and loading
PostPosted 01.08.2012, 10:45 
Hi,

yes but i dont want to handle them in the editor. Instead i need to add dynamic statistics during runtime. Is that possible using the IGameTokenSystem::SetOrCreateToken ? Or does all token have to be added using the editor ?


Thanks,
Oliver
User avatar   Hardcore Modder Hardcore ModderMember since: 11.10.2011, 18:41Posts: 903Location: Germany Likes: 10
 

 Post Topic: Re: a system for saving and loading
PostPosted 01.08.2012, 11:26 
Hi again,

i just thought about using one single token of type string to store one XML structure. Thats how i could implement dynamic data storage i guess...That single token i'd define within the editor. Should work i guess.

But are tokens windows user dependent ? Or does all users share the same tokens ?

So long,
Oliver