Pausing

All topics about ZGameEditor goes here.

Moderator: Moderators

User avatar
rrTea
Posts: 306
Joined: Sat Feb 15, 2014 9:54 am

Pausing

Postby rrTea » Mon Dec 04, 2017 3:50 am

One thing I was thinking of implementing manually was the ability to pause the game...

...but this turned to be impractical (absolutely everything in App.OnUpdate, Model.OnUpdate and Model.Sate.OnUpdate would have to be individually wrapped in a special and maybe customized Condition) or impossible (particles and certain sounds are impossible to control directly, there are probably other aspects that I don't know of). Explosions and RenderParticle background effects are the ones most affected, because it looks weird if everything on the screen stops but the explosion renders on. Also I guess that if it's done manually I'd probably have to also save some values on start of the pause and load it back on exit (for example certain Model.Velocity properties etc) which further complicates the idea.

After testing some stuff with gDEBugger, I noticed it can just pause a ZGE project... this made me wonder how would an eventual "engine-supported" pause work (a specialized State? Model? scripting?) and is it even "compatible" with ZGE?

I understand ZGE is not meant for full blown / really complex projects so maybe this isn't within the scope.
Last edited by rrTea on Tue Dec 05, 2017 12:47 am, edited 1 time in total.

User avatar
VilleK
Site Admin
Posts: 1891
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: Pausing

Postby VilleK » Mon Dec 04, 2017 9:15 am

I think some of Jphs games have pause feature but I don't know how he implemented it.

I would probably make a AppState called "PlayingState" and another "PausedState" but I can guess there are some issues like those you explained, yes. If there was a full "engine stop" feature then at least it would have to still run something to let the user unpause again. Note that AppState has "ModelUpdatesEnabled" property so that it you uncheck that then time will freeze for all existing model instances, I think I designed that to enable pause.

User avatar
rrTea
Posts: 306
Joined: Sat Feb 15, 2014 9:54 am

Re: Pausing

Postby rrTea » Mon Dec 04, 2017 11:03 am

I made a very quick test and it works well if I toggle "ModelUpdatesEnabled" during runtime (models freeze as if paused). It even stops the RenderParticle if it's inside a model - excellent! I'll test it a bit more tomorrow in some trickier situations (unless I get knocked out by a virus) and report back!

User avatar
rrTea
Posts: 306
Joined: Sat Feb 15, 2014 9:54 am

Re: Pausing

Postby rrTea » Tue Dec 05, 2017 8:20 am

This is great, it turns out I didn't even have to use two states. Tested it in different situations and it all works perfectly!


Return to “General discussion”

Who is online

Users browsing this forum: No registered users and 0 guests