+1 vote

So I want to create a planet-like map using a top-down perspective viewing a 2d tilemap which repeat's itself after walking a specific amount of tiles into each direction. My question is, is that even somehow possible using the standard tilemap?

I face following problems:

• How to repeat a (for example 10,000x10,000) tilemap in 8 directions (west, nw, n, ne, e, se, s, sw)
• How do I avoid the position of a player to overflow/underflow when after moving to one position only (even if I get the repeating tilemap working somehow)

The game should work in multiplayer, therefore I can't move the tilemap instead of the player to make it work. The best idea I came up with is to split the map into chunks, and save the player position relative to the chunk he currently is in. But I am not sure if I want to go that way, since I'm not 100% confident with the godot engine yet and I think it will be hard to implement. Also I want random events to happen on the map in real time and would have to check for chunk bounderies/neighbours all the time (e.g. all positions for each game object need to be stored relative to their chunk offset to make this approach work).

Edit: Another approach I though of is to modulo all positions by (for example) 32 * 10_000, but then I still need to draw the tilemap into all directictions when the player is about to reach the limit.

in Engine
edited

I actually built this last week. I don't know if this could work for multiplayer but it does work pretty solid for me so far. furthest I've gone is 300x300 and it worked fine.

(this is all assuming your map is a square)

take the world and break it into 9 different tilemaps. (we'll call them worldtiles) Each one being 1/3 of your map in the x and y direction

Make a node called "leapfrogger" and make a tic tac toe board out of 4 collisionshapes inside of it. We're going to arrange those 4 collisionshapes so that the 2 horizontal collision shapes are 1/6 the map from the top, and the other 1/6 the map from the bottom. The two vertical will be 1/6 from the left and 1/6 from the right.

When you hit the east collider, you move the three western world tiles 2/3 map width to the east, you will also move your leapfrogger 1/3 map to the east. same with the west, north, and south.

It's actually super easy to match up the tilemaps between eachother if you fill the worldtile 1 extra tile in every direction, update the bitmap, then delete the outer ring without updating.

by (84 points)

Hey man can you send pictures or something im having a hard time visualizing this.

Like this if you were moving east

https://imgur.com/a/gzx3BAF

If you moved a second time you would move tiles 2 5 and 8, if you moved east a third time you would move 3 6 and 9 and be right back where you started.