See this neaty screenshot of my paramount achievement:
A concept of tilemap that didn't work.
So this is what the same map & seed look like now (zoomed out a bit further):
Finally, a continuous map!
I don't know if it's a great idea but I use one 2d array to hold 4 tilemaps – the primary tilemap the player is in and 3 other tilemaps where he can go – and one bigger array with these 4 tilemaps to render the scene.
An Example: I have a tilemap consisting of 7x7 tiles: 1-1, 1-2, 2-3 etc.
The tile where my (atm non-existing) avatar will be held in array[0,0], the rest around it:
[0,0] = 4-4 || [1,0] = 5-4
[0,1] = 4,5 || [1,1] = 5-5
When I go from 4-4 to 5-4, after some tiles the tilemaps will get shifted within the arrays, so that [0,0] will hold the new array I'm in:
[0,0] = 5-4 || [1,0] = 6-4
[0,1] = 5-5 || [1,1] = 6-5
If I now decide to go upwards, the tilemaps will be shifted again, this time a bit earlier, depending on how near I am to the border. I 'm still in 5-4, but the arrays now are:
[0,0] = 5-3 || [1,0] = 6-3
[0,1] = 5-4 || [1,1] = 6-4
It took me quite some time to get this working, espacially the transfer was quite buggy, but I think now I got it working.
I also played around a bit with tilemap size and world size (i.e. how many tilemaps will be there) and found out the tilemaps shouldn't be larger than 80-85 tiles or else the performance will break down dramatically when scrolling diagonally. I think this has something to do with the way I check if I'm switching to a different tilemap.
On the other hand, having a lot of tilemaps doesn't seem to be a problem. Even with 50x50 tilemaps I had default 60 fps, though constructing the map takes a lot of time. But this will probably be because I create the whole map, not just a part of it and the rest on the go. Maybe I'll check that out tomorrow.
And because I'm so happy, here another screenshot of a map with a different seed:
From far away, this actually doesn't look that bad.
But now a little killy killy antes de sleepy sleepy.
Good night,
Sleeptaker...
Keine Kommentare:
Kommentar veröffentlichen