79202121

Date: 2024-11-19 04:53:25
Score: 1
Natty:
Report link

Eventually I realized that what I'm trying to do is more similar to a Split screen game which this video explains how to do, https://www.youtube.com/watch?v=tkBgYD0R8R4. By replacing SubViewports with Windows I was able to render into separate windows. On the game master window I set content_scale_mode to Canvas Items and content_scale_aspect to Keep and then in gdscript I wrote.

func resize() -> void:
    %GameMasterView.content_scale_size = Vector2i(get_window().size)
    get_viewport().size = get_window().size
    
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
    get_tree().get_root().size_changed.connect(resize) 
    resize()

At this point the view was being properly reproduced in the second window.

I struggled for a long time with showing extra details on the game master view. I tried to set the following up.

and then I set the SubViewport Canvas Cull Mask to 1 and the WindowCanvas Cull Mask to 1 and 2. All my game master only items had their visibility layer set to 2. But for some reason it seemed that the Window couldn't render anything that wasn't rendered in the SubViewport. Eventually I Reduced it to just.

and in a gdscript I callled get_window().canvas_cull_mask = 1 to set the cull mask on the default viewport and this worked.

Reasons:
  • Blacklisted phrase (1): youtube.com
  • Blacklisted phrase (1): this video
  • Long answer (-1):
  • Has code block (-0.5):
  • Self-answer (0.5):
Posted by: HahaHortness