#Multiplayer UI

5 messages · Page 1 of 1 (latest)

vestal jungle
#

Hi everyone! How am I, in theory, supposed to handle UI scene hierarchy in multiplayer?

Let's say I have an initiative bar which I want globally visible to all players at all times. I'd probably want to attach a canvas layer node to the world node and display it there.

However, I also want individual players to have their own buttons with abilities only visible to them. I'd probably want to make each individual player have their own canvas layer child.

The problem is, I think I can't have two canvas or more canvas layers because the functionality stops working. How would I solve this problem?

fickle salmon
#

Hii, you can have just one CanvasLayer scene for the UI and different child components (scenes) of this scene that can be locally or globally dependent.

For one of my games, I had only one UI scene as a child of the main game scene, this UI scene was a CanvasLayer and had other child scenes for each different part of the UI. I will you give some simplified examples of these children.

The information for the local player was shown in a child scene on the bottom left part of the UI, and depended on signals coming from "Game.match.player", that was a reference to the local player.

I also had a similar UI child scene for the enemy (non-local) player, that was shown in the top-right part of the UI, and depended on signals coming from "Game.match.enemy". If you want to hide some of the information of the non-local players, you might want to modify this scene as you want, together with the enemy or enemies references that the local device updates remotelly, as these should not contain information that could be accessed in other ways (hacked ?).

A third child scene of the UI scene was a TextureProgressBar that just showed the time that was left for the current turn, and depended on "Game.match.time_left". This scene was visible for both players but almost totally local.

Other interesting scene was the store (bottom right), in this scene the local player could click and buy some pieces, but you can't be able to see the enemy's store.

I think is not hard to expand this logic for games with more than 2 players. and as you might notice, the only challenge is the non-visual logic, that is, deciding and making sure what references are update locally or remotelly. The visual part is just connected by signals to these references.

I hope this can help you, at least it worked pretty fine for the scale of our game. You can find the source code of the game here (hito-3 branch): https://github.com/Juanxpeke/GD-FPSJuegos/tree/hito-3.

vestal jungle
fickle salmon
vestal jungle
# fickle salmon Your welcome! If you need something else just let me know c:

Hello again! Still not working on multiplayer just yet, but I've been snooping around your project trying to soak in info and learn stuff. Honestly it's a bit out of my league right now in terms of knowledge and asking you specific questions about it would be too overwhelming for me, so instead I wanted to ask you if you know of any tutorials that may have helped you with this you could share? (That is if you used tutorials at all). I want to take it slow, I'm good on the basic concepts of programming, however still new when it comes to classes, managers and multiplayer itself, so anything would help.

Looks like an interesting game btw, nice job! I'll give it a play when I find the time.