Data save for the game with the locations, quests, NPC, etc.

  • Hello!

    I start to do a new game where each locations has own layout in the project. The player can leave location when he enters into an exit point object (for example: portal, door, etc.). Then I change the layout by the action command "go to layout by name" and so on. The player can went back in this location again from another location.

    In this situation I need to store data and I have no idea yet about true way of data save (locations, quests progress, NPC status, etc).

    I guess I need to store some data by LocalStorage and another data by "Load/Save" method for save or load whole state. Anyway, I have no idea what will be a good true way for that. Perhaps, I must to save each location into separate save slot by "Save" method and keep another data as current location id variable in LocalStorage.

    Maybe another way. Anyway, if I'll be save data by "Save" method after the player leave a location and "Load" again on a new location -- the data will be load from the last save.

    In short I need your help - how to do all of this correctly!

    Thanks and sorry, guys - an English isn't my native language.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • and my another idea:

    for example I have three layouts for locations with names: locA, locB, locC. Now, I'm on the local locB and I have two exit point from the left to the locC and from the right to the locC.

    1. when I reach to the exit point to the locA I'll save data by "Save" (remember its save data about player stay at locB).

    2. I'll change cur_locaction_id as a global var to locA.

    3. go to layout locA.

    4. load data by "Load" method, but I remember that in this data player at locB.

    5. move player to the exit point to locA, because he just came from there.

    6. save data by "Save" method, because now he arrived at locA.

    7. and I'll do the "Save" method in situations as get and drop items, quest progress, etc.

    Hmm... looks not good.... But in other case -- save and load data only thru LocalStorage (as another way to do that) -- looks like a hard work.

  • Hmmm, Unless you're reloading layout at the start of layout, layout state should be persistent.

    Have you thought about making a "World_Variables" object that stores data for all layouts, or maybe a multidimensional array to store data for all layouts? With either case, when player leaves the layout, all changes they made can get written to the World object, or the array, and on the start of the new layout, load the variables from either object.

    So, on loading the layout, just read from object that's holding layout variables "On Start of Layout"

    And on hitting the exit object, write to the object, before loading new layout.

    Otherwise, I would take a look at the Save/Load example project included with construct 2, and read the manual on Save/Load:

    https://www.scirra.com/manual/125/system-actions

    Or check out this great How-To on the subject:

    https://www.scirra.com/tutorials/526/ho ... -savegames

  • Hi, Nexis717 ! Thanks for your replay.

    Yes, I agree with you and I guess the way to use a feature like LocalStorage and save all variables as you need is one true ways. Anyway, I'll able to control each variables as I want. Inspite of stack of code on layout start it will be a correct way as programming, actually.

  • Hello!

    I start to do a new game where each locations has own layout in the project. The player can leave location when he enters into an exit point object (for example: portal, door, etc.). Then I change the layout by the action command "go to layout by name" and so on. The player can went back in this location again from another location.

    In this situation I need to store data and I have no idea yet about true way of data save (locations, quests progress, NPC status, etc).

    I guess I need to store some data by LocalStorage and another data by "Load/Save" method for save or load whole state. Anyway, I have no idea what will be a good true way for that. Perhaps, I must to save each location into separate save slot by "Save" method and keep another data as current location id variable in LocalStorage.

    Maybe another way. Anyway, if I'll be save data by "Save" method after the player leave a location and "Load" again on a new location -- the data will be load from the last save.

    In short I need your help - how to do all of this correctly!

    Thanks and sorry, guys - an English isn't my native language.

    Man saving stuff is pretty crazy lol to put it simple... one way to do it is by yes LocalStorage and also using Dictionary. A few of them actually... if you have items that you can get multiple of, then you want to make a Dictionary for each item. For the rooms/different areas... you want to somehow set up each area/room by UID... Wish i could go more in detail or share a capx but don't have the time since i'm really busy with my project and no capx i can share. I would just look up stuff on LocalStorage, Dictionary and maybe something like save and or pick by UID... hope this helps and good luck!!!

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