#Howdy! I need help with multiplayer focus!

19 messages · Page 1 of 1 (latest)

sharp sleet
#

Is there any way to have multiple nodes focused in one scene? The purpose of this is to make local multiplayer UI work, thanks for checking this out!

lone violet
#

if you use multiple viewports yes, each viewport can have separate focus, though you will need to write code to send input of each player directly to their specific viewport to make things like dpad and A button work

#

SubViewportContainer can display a viewport and will forward mouse input automatically if you want, you'll still need to handle controller input for each viewport yourself though since with the default input, only one container is in focus

#

example: run a script in a node in the main viewport (not inside any subviewport) with an _input() function that checks what controller the input is from, and based on that, sends the event to a specific player's viewport calling push_input on it

sharp sleet
lone violet
#

they can have some impact yes, each one will be rendering the game from a different perspective

#

but that's a natural consequence of split screen gameplay

#

any kind of split screen needs to use sub-viewports to draw each player's screen from a different perspective

sharp sleet
#

i imagine the best practice with using multiple viewports is to try and limit what the additional ones are showing

in my use case specifically its just UI that needs to be controlled by multiple sources on the same screen

lone violet
#

hmm on the same screen (without split screen), I'm not sure if you can do it using the built-in focus system of the engine UI

#

if you really need that, I think you may need to write your own focus system

#

all the functions that deal with built in focus only seem to allow setting one thing in focus, or grabbing one focused element, not multiple

sharp sleet
#

interesting ok, i was fearing that it just wouldn't be possible with the built in focus system. it's been super simple and great to use for just single player so i was hoping that maybe itd be as nice for multiplayer

#

but if it isnt so well! i suppose ill just have to figure something else out, thanks for the information.
i think doing my own hacky semi focus system wont be too difficult, wont be nearly as nice to use as the built in one though lol

lone violet
#

at least with a custom system you can also make custom visuals to make things clearer

#

like when multiple players select the same button, your system can draw an icon or letter or number or something above the button for each player, each icon next to one other

#

instead of a single border that would overlap the other player selection visually

sharp sleet
#

right yeah thats something i was hoping the base system would feature, but its seeming like the built in UI stuff is pretty lackluster

lots of edgecase stuff like that would make it really hard to use for multiplayer