Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

10 years ago by SirPereira

What would be the best approach to having a game lobby available to users when they are in-game and press ESC?

I really don't want them to change to another game instance, as I don't want them to lose their current game. It's just a lobby aside with the game.

I guess levels suffer from the same problem than game instances, losing all the current progress if I switch to another one.

Game should be running in background even if lobby is open.

What are your suggestions? Use draw method to draw something upon game screen?

Thanks!

10 years ago by Joncom

What would be the best approach to having a game lobby available to users when they are in-game and press ESC?
You could make a "lobby" entity that you spawn on top of everything when you hit escape. And, depending how the user interacts with it, load a new level or something...

10 years ago by substandardgaussian

Incidentally, though this may not be the best answer, you absolutely don't need to lose your current game when using a different instance.

Though it isn't part of the "public" API and therefore may be considered sketchy, the ig.Game.setDelegate() function can be used to seamlessly switch game instances on the fly without resetting them. It makes it very easy to "suspend" the game on Pause and then bring it back.

I'm not sure about side effects, but I don't see anything in the source that has a problem with using that and skipping setGame.

EDIT: Nevermind, you said you want the game to keep running in the background, which wouldn't happen with this solution. Making a specialized entity/drawing directly to the screen and stealing input would probably do the trick just fine.

10 years ago by SirPereira

@Joncom possibly that will be the way I'll be dealing with it.

Thanks a lot!

@substandardgaussian thanks a lot for that trick. I did not know about that function, and it could be very useful in the feature!

Thanks!
Page 1 of 1
« first « previous next › last »