I am trying to figure out a way to have the ends of the map meet each other. So that, from the cameras perspective, the map is infinitely looping. As if this map is wrapped around a pole and the two ends meet. So that when the player is on one end of the map, they can see bits of the opposite side of the map:
But we can’t wrap half the camera like this…
I found this Reddit post that suggested to add pieces on the end of the map that look like the opposite side of the map. And when the player reaches the “end of the map”, instantly teleport them to the other side so it gives the illusion of wrapping:
This is a smart solution… But it won’t work for me… because my game is multiplayer… So we wouldn’t be able to see another player on the other side of the map:
I might be misunderstanding but this is similar to what you may have needed to accomplish say with something like flappy bird. In flappy bird a map segment is just a duplicate attached to the end of the map. So in godot format that would be a duplicate of the tilemap node you currently have (assuming 2d) that has a duplicate that appends itself to the other side in repeat.
I think you have to double down on the teleport solution… Everything is on screen twice, both at it’s actual position and a second time offset by exactly the world width. Then, when one player’s camera gets too close to the edge on either the right or left, you teleport the camera. You’ll also have to teleport the non-visible version of each player when it gets sufficiently far from the viewable area, so it can seem to run back in from the alternate side. Player alternate version teleports can be done somewhere further away from center than the players cameras are allowed to see, so nothing ever appears to pop out of existence. … It’s a touch tricky to describe, let me know if it’s not clear and I can sketch up a picture.
Anyway, unless I’ve missed something, this solution should hold together no mater how many cameras (players) you put in the scene.
This is an interesting problem and my first thought on how to solve it is to handle the map like a tiled texture.
Since it is a 2d multiplayer platformer 3 identical maps named map_1, map_2, map_3 should do the trick.
At every point in time when the player is inside the boundaries of a map, they will be able to see the next map in front of them (in the case of a 2d platformer, their right side) and the previous map at the back. For example, if the player is on map_1, map_2 will be positioned by the right and map_3 by the left, if on map_2, map_3 will be by the right and map_1 by the left.
Essentially, you are just constantly tiling/repeating the map in front and behind the player by constantly move the unoccupied map around the player without them knowing.
This possible solution will only work for a side scroller. A top down game will be much more complex. It can also be expensive to duplicate a large map 3 times.
This is just an idea. There might be simpler ways to achieve this.