I’m not sure you fully understand. You build your world any way you want. You don’t need to translate parts or build the world into an object. The only things you need to do are
- Your coordinates wrap whenever they cross the edge or the world. i.e. when you change the position of any moving object you need to wrap it’s position e.g. newX = (X + moveAmount) modulus maxX
- You do multiple renders i.e. call your code which renders the world given a camera position. Change the camera position (as described above), call the render code again and so on (as described above). You don’t change the position of any objects, you don’t do anything special in your code. All you are doing is drawing the world from multiple camera positions and when those parts are put shown on the screen they fit together.
Other than that there are no restrictions. e.g. I could take the Quake engine, add these two things and I could then create maps which were wrap around.
Yes I have been talking about first person, but it makes no difference if it was isometric. The technique doesn’t care how the world is built or rendered.
The only code I have is to work out all the different renders i.e. it works out which edges of the box my field of view crosses. That will only complicate things more since all it does is
View crosses LEFT, TOP and FRONT of box
Therefore
Move camera DOWN and render
Move camera RIGHT and render
Move camera BACK and render
Move camera DOWN+RIGHT and render
Move camera BACK+RIGHT and render
Move camera DOWN+BACK and render
Move camera DOWN+BACK+RIGHT and render
etc.
It is also more complicated than you need because you don’t have full (space simulator style) wrap around.
Ok, lets try this…
Imagine your world is a 2D flat sheet seen from above. It is 12x6 in size and the size you can see (i.e. your field of view) is 5x3 (again, the values are irrelevant. This is purely for illustration) and the player is always in the middle of the screen.
Given that here’s how the world looks if the player is standing at (f,2)
abcdefghijkl
0
1 xxxxx
2 xxPxx
3 xxxxx
4
5
Whe ‘P’ = the player, and ‘x’ = the part of the world that will be visible on the screen i.e. the bits you need to draw.
Now if the player is standing at (f,0)
abcdefghijkl
0 xxPxx
1 xxxxx
2
3
4
5 xxxxx
i.e. you need to do two renders one from the players position (f,0) which would show whatever is in the box with corners (d,0),(h,1) i.e.
abcdefghijkl
0 xxxxx
1 xxxxx
The screen will therefore look like
bbbbb
xxxxx
xxxxx
Where ‘b’ is blank space
For the second render you move the camera down by the height of the world (6) so (f, 0+6) => (f,6) i.e.
abcdefghijkl
0
1
2
3
4
5 xxxxx
6 xxPxx
7 xxxxx
Now since nothing in the world has a coordinate larger than 5 nothing is drawn for area (d,6),(h,7). So that render shows
xxxxx
bbbbb
bbbbb
When you overlay that render with the first render you get a complete screen showing the wrap around world.
If the player moves up then you wrap their coordinate i.e. they move from (f,0) to (f,5).
Now if the player is standing at (a,0) then you need to do four renders i.e.
abcdefghijkl
0Pxx xx
1xxx xx
2
3
4
5xxx xx
So you render the world from positions (a,0), (m,0), (a,6) and (m,6).
I don’t think I can explain it any more clearly than that. All you are doing is drawing the world from different positions (you do understand that the world stays still and the camera moves, it’s a common problem that people think they need to translate all their object positions rather than move the camera).
–STU!