Culling parts of large 2D backgrounds

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Naonlily

I am making a 2D online multiplayer game that uses large backgrounds with the same mindset as early pre-rendered 3D backgrounds. With 4096x3072 being my game’s standard. However, I would like to expand some areas horizontally. With a potential size of up to extra 1024 pixels on the left and right each. Thus, I can not avoid using multiple images.

Displaying large sprites may be wasteful, I am looking for the most efficient (but simple) solution to optimize large backgrounds. Is it even necessary?

These are my ideas:

  1. Dynamically create a tileset with tiles being 256x256 squares of the full background, and populate a tilemap node. (automatically, with GDScript code).

  2. Use sprite nodes, but use dynamically created AtlasTextures instead. (This may be the worse option, I am not sure however)

The priority here is to make it efficient and to not render things off-screen.

I also have objects that are rendered above the backgrounds. those can be of any size. Because of this reason, I would like to know if I can rely on Godot to cull them automatically or if I need to do this myself.

This can be taken from both Godot 3 and Godot 4 feature set. I plan on switching to Godot 4 when it’s reasonable.

Any help is welcome.