[Feature request] Reset Obj with 'Persist' behavior

Discussion and feedback on Construct 2

Post » Mon Nov 24, 2014 12:08 pm

Hello,

The permanent objects (obj with Persist behavior) are great when you want to save the state of different elements when you reload a layout.
But, unless I missed something, there's no way to reset their state.

Here is the basic issue you will get if you make a game with permanent objects :
-You launch your awesome game
-You click on Start a New game
-You play a little and move some permanent obj
-You pause the game and click on "go back to main menu" (very common thing in videogames...)
-You click on Start a New Game
-Hooo.... the permanent objets stayed in their last state.

So I think it's important to have the possibility to :
*Reset ALL permanent OBJ
*Reset a specific permanent OBJ (can be useful too, for example, a puzzle game with multiple layouts)

What do you think ?
Last edited by KaMiZoTo on Mon Nov 24, 2014 3:28 pm, edited 2 times in total.
B
72
S
21
G
12
Posts: 314
Reputation: 12,111

Post » Mon Nov 24, 2014 12:21 pm

Do you mean global objects that you're using to hold game information in object variables? On start you can save their states as json, into global variables or an array / dictionary / web storage. Then, to reset, just load the original states back in...

Edit to add: So you could use an array to save the player data at the start of each layout, giving you more control over how you reset things.
Last edited by Colludium on Mon Nov 24, 2014 12:29 pm, edited 1 time in total.
A big fan of JavaScript.
B
74
S
20
G
69
Posts: 2,205
Reputation: 43,832

Post » Mon Nov 24, 2014 12:26 pm

To make the menu / options easier to manage, I draw those now in a global layer so they can be exposed at any time in the game. That way you only need to set the game timescale to zero before showing the options layer. Easier than saving the player and enemies game data and then reloading it all on return to the layout.
A big fan of JavaScript.
B
74
S
20
G
69
Posts: 2,205
Reputation: 43,832

Post » Mon Nov 24, 2014 2:45 pm

Colludium wrote:Do you mean global objects that you're using to hold game information in object variables? On start you can save their states as json, into global variables or an array / dictionary / web storage. Then, to reset, just load the original states back in...

Edit to add: So you could use an array to save the player data at the start of each layout, giving you more control over how you reset things.


I think he is talking of the persist behavior, where the state of the objects with it are saved constantly, which is a great tool but lacks indeed this essential reset feature IIRC.
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Mon Nov 24, 2014 3:04 pm

Aphrodite wrote:I think he is talking of the persist behavior, where the state of the objects with it are saved constantly, which is a great tool but lacks indeed this essential reset feature IIRC.



Ahhh - that makes more sense. And is why I personally don't use the persist behavior...
A big fan of JavaScript.
B
74
S
20
G
69
Posts: 2,205
Reputation: 43,832

Post » Mon Nov 24, 2014 3:28 pm

Yeah sorry, it wasn't clear. (I've edited my post)

I'm talking about the Persist Behavior.
It's super useful when you have a lot of movable/destroyable objects in your game. You just tag them with the Persist behavior and they automatically remember their state. But the fact we can't reset that state is a lack.

And I have to admit manually saving their state as a Json is a pain in the ass for me (I gave up). That behavior avoids doing that.
It just needs a reset function to be perfect. :)
B
72
S
21
G
12
Posts: 314
Reputation: 12,111

Post » Mon Nov 24, 2014 3:30 pm

The easiest way to implement this is an action to reset all persisted instances globally. I'll see if I can get that in the next beta (note we are due a stable update next and I prefer not to make any changes at all for that).
Scirra Founder
B
395
S
232
G
88
Posts: 24,368
Reputation: 193,746

Post » Mon Nov 24, 2014 3:37 pm

@Ashley Awesome! :)
B
72
S
21
G
12
Posts: 314
Reputation: 12,111

Post » Sat Dec 27, 2014 9:49 pm

Bump,

I honestly thought a feature like this would already be included??? Why has it been taking so long.

I am looking forward to it coming out and if it already came an can someone aleert me??
I haven't been able to find it

System action: 'recreate initial objects'. Recreate the initially placed objects in the layout for a specific object type or family within a rectangular area. (Note this does not destroy anything, it only creates new instances.)

Mot sure if this is it?
B
9
S
3
Posts: 28
Reputation: 887

Post » Sat Dec 27, 2014 10:20 pm

Ralphpalx wrote:Bump,

I honestly thought a feature like this would already be included??? Why has it been taking so long.

I am looking forward to it coming out and if it already came an can someone aleert me??
I haven't been able to find it

System action: 'recreate initial objects'. Recreate the initially placed objects in the layout for a specific object type or family within a rectangular area. (Note this does not destroy anything, it only creates new instances.)

Mot sure if this is it?


the feature this topic is about has arrived in r191, it did not arrived yet in a stable version though.
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Next

Return to Construct 2 General

Who is online

Users browsing this forum: jobel and 3 guests