Saving object states and INI files:

This forum is currently in read-only mode.
From the Asset Store
State Machine
$10.99 USD
State Machine is a great tool for managing the state of anything in your game.
  • I need to save the states of an arbitrary number of objects in the same family between layouts (I do not wish to make all the objects global). From what I can tell, an INI object is best suited to this purpose, is this correct? If so what is correct way to store and retrieve the data from the INI file?

    Storing:

    For each object of type family

    ->ini write (data type) [group name] [item name] value

    For each of that objects private variables?

    This seems to only be writing one object of each family to the file.

    How would I restore the data to the proper objects when returning to a layout (I am using system create by name)?

    If there is a better way, please let me know.

    Some quick examples would be very helpful � I did read the wiki but it did not go into any depth.

    Thank you.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I think the save/load or quicksave/quickload actions would be better suited to saving your game!

  • Hello Ashley, very impressive engine you have here.

    My understanding is that full saves/loads and quick saves and quick loads replace the existing game state entirely (is this the case?). I need to have some global variables preserved (at a minimum).

    The general flow would be�

    1. objects from layout one are saved (move to layout 2)

    2. an arbitrary number of the these objects are spawned in layout 2

    3. they do something,

    4. the status of the objects in layout 2 are saved and

    5. return turn to layout one and repopulate the level from the saved data

    Is you recommendation still the same in light of this additional information? Sorry, it was very late when I posted or would have included more info in the initial post.

    Thank you!

  • If your writing to the same group and the same item it will always only save one group and one Item. You need to use and expression in place of the group name and leave the Item the same. I suggest using object.uid for the group name. and name the items something intelligible. if you want to save PVs you would do better using a hastable to hold the variables you want to save.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)