Any ideas on how to implement a dialog screen (SOLVED)

Hello everybody,

I have just started to experiment with HUDs and collections and gameproxies in order to implement a main menu and have the game go back and forth between them, there are plenty of examples here in the forum and I think I mostly got it.

But now I want to implement a dialog screen like this:

Let’s say it is a “HUD over the level”, but how can I “pause” the whole level in the background?

In his examples @britzl uses a gameproxy for the level and then calls:

msg.post("#gameproxy", "set_time_step", {factor = 0, mode = 1})

But there is no “main menu” in that example…

So if I have a main.collection with a mainController.script that switches between gameproxyMenu and gameproxyLevel, then inside gameproxyLevel I must have another game proxy and a HUD where I would set the pause, right?

But then, when I call from the mainController.script:

msg.post("#gameproxyLevel", "load")

Will it load the inner gameproxy?

Or am I getting the wrong idea?

Any suggestions?

Thanks in advance

No, nested collection proxies will not be automatically loaded. If the collection that you load using the gameproxyLevel contains additional collection proxies you also need to load these manually.

Oh, I see…

So, what would you suggest to implement the dialog screen?

I might not have to use a gameproxy, only a collection, but how can I pause a whole collection?

Can it be done with the same approach?

for example:

msg.post("#level.collection", "set_time_step", {factor = 0, mode = 1})

:thinking:

No, the set_time_step message can only be sent to a collection proxy component.

Oops… :confounded:

Any other ideas?

Hmm, I would probably structure my collections like this:

main.collection
 |
 +-- main_controller.script
 |
 +-- main_menu.collectionproxy
 |    |
 |    +-- main_menu.collection
 |
 +-- game_controller.collectionproxy
      |
      +-- game_controller.collection
           |
           +-- game_controller.script
           |
           +-- game.collectionproxy
           |    |
           |    +-- game.collection
           |
           +-- dialog.collectionproxy
                |
                +-- dialog.collection	

So you have a main collection with one main menu proxy and one game controller proxy. The main collection has a controller script that takes care of loading and unloading of the main menu and the game, depending on the state of the game.

The game, in-game dialog system and perhaps other game specific stuff is put into the game controller collection, loaded by the main controller. The game controller script will load all of the “sub systems” like the actual game, the dialog system etc and it will be able to pause the game (by setting time_step on the game proxy) while the dialog system is active.

3 Likes

WOOOW!

Yes!

I was kind of getting there… but you are the man! :muscle:

Thanks! :thumbsup:

[Edit] I had a hud object instead of the game_controller.script and it was the one calling manually the “load” on the game.collectionproxy and I was going to use it to handle the dialogs, but your approach is better because you use a dialog.collectionproxy to contain this code, thanks again!

Cool! I also think that with the approach I suggested you’ll be able to quite easily test only the game without any of the rest of the stuff by setting the game.collection as the bootstrap collection in game.project and use the game_controller.collection as bootstrap collection to test the game and the dialog system without having to also click through the main menu and things like that.

Nice!

You are right! And also you could add another proxy at main controller level and implement a small intro, isn’t it nice?

1 Like