Playmaker Forum

PlayMaker Feedback => Feature Requests => Topic started by: cobra01 on March 25, 2012, 05:40:06 AM

Title: Save Variable to file[SOLVED]
Post by: cobra01 on March 25, 2012, 05:40:06 AM
Hey,

Ive been using playmaker for about 2 weeks now, good stuff :)

But i was wondering if there could be an action made where you can select what variable or global to save to a file, much like jeans array load txt from file but the reverse where you combine a bunch of variables and save them to txt or xml.

Doing it this was it would be easy to save the current state of a game or what i want to use it for is saving character statistics, but i tried a couple of ways and playprefs is not an option for me. Having it build in would be quite handy.
Title: Re: Save Variable to file
Post by: Alex Chouls on April 16, 2012, 06:38:14 PM
I agree, having this built in would be pretty handy. I'll add it to the todo list...

However, I'm curious why playerprefs are not an option for you?
Title: Re: Save Variable to file
Post by: jeanfabre on May 06, 2012, 06:27:51 AM
hi,

 http://hutonggames.com/playmakerforum/index.php?topic=1516.0 (http://hutonggames.com/playmakerforum/index.php?topic=1516.0)

The way this question was formulated is I think very similar.
 

Why not letting the user tick a checkbox on a fsmVariable "Persistent" or something, which would in the background use the PlayerPrefs and simply shortcut having to check, get and set player prefs manually. I think it would be a very very easy way out player prefs management, this effectivly remove the need to manually create and manage keys and make the process transparent for the user.

 Bye,

 Jean
Title: Re: Save Variable to file
Post by: Alex Chouls on May 06, 2012, 02:22:24 PM
Interesting idea!

A couple of problems that would need solving:

How to give the PlayerPref a unique name that uniquely identifies the GameObject/FSM it belongs to? I guess you could have a requirement that objects have unique names, but that's a little limiting...

When to save the values? PlayerPrefs are relatively slow, so we only want to do this when necessary.
Maybe have a SavePersistentVariables action... but that's another manual step...

Any ideas?
Title: Re: Save Variable to file
Post by: jeanfabre on May 07, 2012, 08:43:19 AM
Hi,

 I think keys should be a simple hidden uuid and serialized with the fsm component. So when the user check a variable a uuid is generated once. this way, no clash can happen with any other variable nor user define keys.

As for saving, I think it should be saved when the fsm exit as default ( it could go all the way an propose a set of options for saving ( when changed, when state using this variable exit, when fsm exit), and having an action exposing a force save on a particular variable ( only listing variables with persistent storage) is a good idea I think, then the user can refine persistent storage behavior ( like a fsm saving all, or a particular) persistent variable every 5 mn, or reacting to an event, etc ect), it would still be a lot easier then accessing the playerprefs directly.

I also see the possibility to access and manage persistent variable in different ways:

-- by referencing them directly
-- by fsm
-- by gameObject
-- all

So a new ui type would see the light just like the fsmOwner and these sort of things.

Bye,

Jean
Title: Re: Save Variable to file
Post by: amaranth on August 07, 2012, 12:29:14 AM
Hi guys, is there any word on whether this will be added in an upcoming release? I'm at the point where I need to read and write save game data (without using playerprefs).
Title: Re: Save Variable to file
Post by: jeanfabre on August 07, 2012, 06:19:08 AM
Hi,

 it's something that I plan on adding to the next version of arrayMaker, but nothing planned short terms.

 Have you looked at this:
http://hutonggames.com/playmakerforum/index.php?topic=1712.0 (http://hutonggames.com/playmakerforum/index.php?topic=1712.0)

bye,

 Jean
Title: Re: Save Variable to file
Post by: amaranth on August 07, 2012, 12:52:59 PM
Thank you for that link, Jean! I didn't see that topic.
Title: Re: Save Variable to file
Post by: Andrew.Lukasik on September 21, 2012, 06:20:19 AM
I vote to change Action's category "PlayerPrefs" to "Saving Data" (or something). Because non-programmers reads "PlayerPrefs" as "P&%@$^... uhm ignore" :) I see here important communication opportunity.
Title: Re: Save Variable to file
Post by: Bqlqzs on September 11, 2013, 12:06:01 PM
It is very good idea !

I also want an action, that I can write .txt file or anything..

It will be a good way for save games, and for the load game you can use the
WWWObject action.
Title: Re: Save Variable to file
Post by: FritsLyn on October 21, 2014, 04:54:52 AM
Bump!
(Save variables natively via PlayMaker)
Thanks!
Title: Re: Save Variable to file
Post by: FritsLyn on October 21, 2014, 05:07:30 AM
OMG - It's here already, beautiful, have been here for ages, I never knew:

PlayerPrefs

!