Page 1 of 1

Short term: Store Floats Long Term: Full Text File Writing

Posted: Fri Oct 24, 2008 3:39 am
by slobu
I apologize if this is a topic already addressed. I didn't specifically see it in the feature requests though. I may have missed it. Sorry!

Anyway, ANY sort of data saving function would be appreciated. I figured the simplest to implement would be text file writing. I'll make do with saving bitmap pictures or a data blob. With pictures hopefully I could make a script to read pixel colors and transform that into variables. Would it be easier to code support for a data blob? It could be a strict size to ease portability between platforms and file systems. A last thought would be save state support. Something like Game_Save('foo.dat') and Game_Load('foo.dat') that would dump the ZGameEditor engines state or load it back into memory.

Again, sorry to bring this up if it's an old topic. I only mention it because it's the one thing stopping me from seriously using ZGameEditor. Password entry is just too tiresome for the end-user and hampers how much lasting impact the player has on his game environment.

UPDATE: The responses to this topic indicate that only Floats are currently flexible enough to have storage and retrieval be useful. In that case, I humbly request at least storage of float values for the short term.

Posted: Fri Oct 24, 2008 8:10 am
by kattle87
Actually, file reading is working but writing is still not implemented. For loading from file, see the project FileDemo included in ZGE.

Posted: Fri Oct 24, 2008 12:43 pm
by Kjell
Hi Slobu,

As Francesco mentioned, File reading is already available .. one of the major problems however is that the only variable format ZGE can currently handle is of the type Float. You cannot use Strings or Integers dynamically .. yet. Even if String were supported, you still need a substring function and other string related routines to be able to make use of the data.

K

Already know about file reading. Should have been clearer!

Posted: Fri Oct 24, 2008 1:45 pm
by slobu
Thanks for the quick responses!

I may have been too broad. I already know about file reading via the FPS demo. I'm still trying to wrap my head around how that works :)

My real focus is file writing. Being able to store information would elevate ZGE from a demoscene thing to a true game editor (in my opinion). Almost all games have some form of data retention from high score tables to how tired your battle mage is.

Posted: Fri Oct 24, 2008 2:19 pm
by VilleK
The problem with the current File-solution is that it is Component-based which is not very intuitive to use if you are used to writing code for accessing files. However if I add support for writing it is good enough for saving small stuff like highest score, optionsettings, and even whole arrays of data. So what will happen is probably that first ZGE will support file read/write through the component-solution. Then in a later version, when the scripting is advanced enough to allow it, a code based solution (like in your post before it was edited) with file-functions will appear.