(2D 4.4) Question about viewports...

Good day. Ive been getting back into Godot by starting a SHMUP project.
But I’ve been trying to do two things:

  1. Put the gameplay in its own isolated viewport and have the UI or custom backgrounds be able to border and/or letterbox it ala Touhou

  2. Make the game run in a smaller resolution that is scaled up to make for a retro/pixel feel.

I happen to know how to do the latter using just project settings, and am kinda learning the jist of SubViewports to do the former. But I’ve noticed some really weird scaling issues for certain things when combining both. I was wondering what a good looking setup would be for a SubViewport that could satisfy both my wants while also not being too wierd to work with. Thanks in advance, can provide more details if needed.

It depends on your setup. Do you want viewport or canvas-item scaling? Should the ‘game’ and the main ‘ui’ have the same resolution?
What ‘weird scaling issues’ are you experiencing?

Whats a shmup?

I mainly go with viewport scaling. But if canvas scaling provides a possible upside ill try it out. I might need to read up on more stuff on Viewports

I mainly want the Game to be square or be in a vertical resolution, with the UI taking up anything around the game.

As for the issues I mainly saw certain nodes like the canvas layer I put in my “game” scene for a back ground being wierdly displaced, and other times it seems that certain nodes follow their global position instead of something relative to the viewport, depending on how theyre spawned. Its sorta wierd to explain.

I’m doing something shmup-adjacent, and am using a similar scheme; mine looks something like this:

  gamelevel
  + Minimap SubViewportContainer
  |  + Minimap SubViewport
  |     + Camera2D
  |     + Player Sprite
  |     + Minimap Texture
  + World SubViewportContainer
  |  + World SubViewport
  |     + Camera2D
  |     + Sprites...
  + UI Panel (Sprite2D)
     + Score Display
     + Shield Level
     + [other UI stuff]

Some of the positioning is a bit screwy in the editor, but it looks fine in the game, and everything I’m doing is procedurally generated anyways.

Mine’s also a bit more complicated than I’ve shown above, because I’m using a tilemap ground plane with 3D assets, but the basic idea is there.