Forums Gallery Downloads LOGIN |REGISTER

a system for saving and loading

Please use this forum for questions on C++, Lua, XML, and any other languages used in CryENGINE development.


 

sm1le
Just getting started
Just getting started
 
Posts: 44
Member since: 21.04.2012, 22:37
Likes: 0

a system for saving and loading

Postby sm1le » 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
Programmer410
Junior Dev
Junior Dev
 
Posts: 135
Member since: 21.10.2011, 11:48
Location: Stuttgart, Germany
Likes: 0

Re: a system for saving and loading

Postby Programmer410 » 25.04.2012, 22:49

You can auto-save with triggers and the sve flownode in fg.
sm1le
Just getting started
Just getting started
 
Posts: 44
Member since: 21.04.2012, 22:37
Likes: 0

Re: a system for saving and loading

Postby sm1le » 05.05.2012, 17:03

and can be more?plllllllssss
sorry for my english-google >_<
sceluk
Junior Dev
Junior Dev
 
Posts: 153
Member since: 03.08.2009, 11:47
Likes: 1

Re: a system for saving and loading

Postby sceluk » 06.05.2012, 14:53

so you cant save crysis 1 style?
User avatar
Ruan
Has seen it all
Has seen it all
 
Posts: 11741
Images: 0
Member since: 11.07.2008, 20:25
Location: Nottingham, UK
Likes: 93

Re: a system for saving and loading

Postby Ruan » 06.05.2012, 15:03

Here's the code to save the game:

Code: Select all
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
Ex-Crytek, now with Deep Silver Dambuster Studios
thefarcry
Just getting started
Just getting started
 
Posts: 78
Member since: 28.12.2011, 12:32
Likes: 0

Re: a system for saving and loading

Postby thefarcry » 06.05.2012, 15:19

Cry-Ruan wrote:Here's the code to save the game:

Code: Select all
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
sceluk
Junior Dev
Junior Dev
 
Posts: 153
Member since: 03.08.2009, 11:47
Likes: 1

Re: a system for saving and loading

Postby sceluk » 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
Ruan
Has seen it all
Has seen it all
 
Posts: 11741
Images: 0
Member since: 11.07.2008, 20:25
Location: Nottingham, UK
Likes: 93

Re: a system for saving and loading

Postby Ruan » 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
Ex-Crytek, now with Deep Silver Dambuster Studios
sceluk
Junior Dev
Junior Dev
 
Posts: 153
Member since: 03.08.2009, 11:47
Likes: 1

Re: a system for saving and loading

Postby sceluk » 06.05.2012, 19:58

Ah I see, 10x Ruan :)
User avatar
beast
Senior Developer
Senior Developer
 
Posts: 903
Member since: 11.10.2011, 18:41
Location: Germany
Likes: 10

Re: a system for saving and loading

Postby beast » 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
NeoLegends
Producer
Producer
 
Posts: 1731
Member since: 21.10.2011, 23:50
Likes: 8

Re: a system for saving and loading

Postby NeoLegends » 01.08.2012, 00:19

Kill counts may be stored in Game Tokens which are session independent, I guess.
User avatar
beast
Senior Developer
Senior Developer
 
Posts: 903
Member since: 11.10.2011, 18:41
Location: Germany
Likes: 10

Re: a system for saving and loading

Postby beast » 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
Lavizh
News Posters
News Posters
 
Posts: 12077
Member since: 04.12.2007, 03:23
Location: Hamar, Norway
Likes: 750

Re: a system for saving and loading

Postby Lavizh » 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.
 
 
Image
User avatar
beast
Senior Developer
Senior Developer
 
Posts: 903
Member since: 11.10.2011, 18:41
Location: Germany
Likes: 10

Re: a system for saving and loading

Postby beast » 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
beast
Senior Developer
Senior Developer
 
Posts: 903
Member since: 11.10.2011, 18:41
Location: Germany
Likes: 10

Re: a system for saving and loading

Postby beast » 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


 
Connect and collaborate with CRYENGINE developers in the official Forums.
Visit the Gallery to share what you have created and be inspired by what others are creating with CRYENGINE.
Community