Hello folks, I have a question about using autoloaded signals to communicate between the player and the UI. When dealing with multiple players, and therefore multiple UIs what is the best way to communicate with signals? How can UI keep track of different players information if autoloaded signals are being sent? How does the individual UI know when to update and when not to?
Sounds like autoloading isn’t the best option since you would have to route the global signals which defeats most of the point of being global. Can the UI be a child of each player? Is this multiplayer? split screen? single shared screen?
I have not implemented multiplayer, but I would like to design the project so that It could be done. Right now I have one player and the UI is a child of that player, however I’ve been told this is poor practice because if the player dies and is queue freed it will take the UI away too. Maybe that’s ok in this instance? Maybe the player is never queue freed? I’m not sure what the right question to ask is.
I wouldn’t delete the player, if you do maybe you can separate player information and game information into two UIs, player information UI can be deleted with the player, game information can stick around.
Ok so you think its alright to have UI as a child of the player(s), and let the players have reference to the UI to change values and such? I’m just not totally sure what the best practice is and I heard that the UI and the player should be separate
I do absolutely think it’s OK to have UI as a child of players. I’d attribute that sentiment to people making platformers and needing a way to store player information between levels, and the UI contains all the information they need such as health and coins.
Take a arcade game, even single player, where there is one level and the player is expected to have and use a few lives. Everything about the player resets except the lives and score, so it’s practical to also remake the player’s UI when they fall. UI as a child does limit some stylistic options, and there will be other information not relevant to the player that needs displaying, but that doesn’t make it an all-encompassing rule.