#Why would I attach the UI to the world rather than the player in multiplayer?

6 messages · Page 1 of 1 (latest)

hollow sierra
#

I was watching a multiplayer fps tutorial and I specifically get to this point where he moves the crosshair from the player to the world node instead, and he then makes a healthbar on the world node as well. Is there a reason he does this that I can't see is clear?
https://youtu.be/n8D3vEx7NAE?si=tUyrpItbtLDcFiXK&t=2189
This is the point where he starts moving and making stuff.

How to make a simple online multiplayer FPS game in Godot 4 and play with friends over the internet. Big thank you to @ditzyninja for his Godot 4 networking content!
Git Repo: https://github.com/devloglogan/MultiplayerFPSTutorial

0:00 Intro

=== Blender Modeling ===
0:34 Environment Model
3:48 Pistol Model

=== Godot 4 Project Setup ===
6:56 Im...

▶ Play video
distant flax
#

I haven't watched the whole thing, but it could be that he's treating the old "Player" as an avatar, like a puppet, which needs to be killable and freeable, but the player's GUI/HUD is meant to persist even after the player avatar is dead and queued_free. Then when the player avatar respawns, it doesn't need to create a new HUD.

hollow sierra
# distant flax I haven't watched the whole thing, but it could be that he's treating the old "P...

just so we're clear, im in no way asking anyone to watch the whole video lol

I don't think this is right though, the player never actually get's queue_free()'d, and even if it did, the two elements he does actually move aren't relevant while the player is dead, the healthbar and the cursor. I'm honestly not even sure he could theoretically free the player, because they were spawned by a multiplayer_spawner node.

#

honestly, im just worried that by moving the ui around, ill mess up something with multiplayer since i don't fully understand it, maybe something about the multiplayer is requiring him to move the ui?

distant flax
#

Perhaps its a way to prevent multiple GUIs from showing up, when you spawn more than one player scene into your world.

elder falcon
#

The main reason to have the ui on the world is that each player only needs one that they interact with, so the ones for other player don't need to be replaced locally. It's just a waste of memory and processing.