Planet-sized level format?

Started by
26 comments, last by c0mas 18 years, 10 months ago
Going back up to the grid that Mobile posted, if you change it to look like this...


------------------------|

| | | | |

| 7 | 8 | 7 | 8 |

| | | | |

------------------------|

| | | | |

| 1 | 2 | 3 | 1 |

| | | | |

------------------------|

| | | | |

| 4 | 5 | 6 | 4 |

| | | | |

------------------------|

| | | | |

| 10 | 9 | 10 | 9 |

| | | | |

------------------------|

...then it will create a shpere(a demented sphere becuase its made out of squres, but thats no less demented than the torus would be) instead of a torus. This way is just like a map. When you come off the top of a map, you come back facing downwards at a different point on the top of the map. The edges are left and right sides are still the same(again, just like a map). Note that if you move off a corner square to either the left or the right, you will come out on the other corner square in the same row.

Sorry that the grid didn't come out very well. It should still give you the idea.

[Edited by - Ezbez on June 15, 2005 2:55:04 PM]
Advertisement
I was actually thinking about this the other day, and here is the grid I came up with :

------------------------------||   / |   / |   / |   / |   / ||  9  |  7  |  8  |  9  |  7  || /   | /   | /   | /   | /   |------------------------------||   / |     |     |     |   / ||  3  |  1  |  2  |  3  |  1  || /   |     |     |     | /   |------------------------|-----||   / |     |     |     |   / ||  6  |  4  |  5  |  6  |  4  || /   |     |     |     | /   |------------------------|-----||   / |     |     |     |   / ||  9  |  7  |  8  |  9  |  7  || /   |     |     |     | /   |------------------------|-----||   / |   / |   / |   / |   / ||  3  |  1  |  2  |  3  |  1  ||/    |/    | /   | /   | /   |------------------------------|


The 9 locations in the center are the only locations that would actually 'exist'. All of the locations around the perimeter would only be fake 'pointers' to real locations in the middle -- you can't actually exist in these locations, but you can 'see' them. My idea was that as you start in square 5 and travel east, you will enter square 6. From there, you may be able to see square 4 on the horizon ( wrapping around ). So, you just draw square 4 where it looks like it should be (the fake square 4). If you keep heading east in square 6, you just warp the player or whatever back into the actual square 4, and then square 5 is on the horizon again to the east. Then it seems like a wrap-around world.

Similarily, if youre in square 4 heading west, you see the fake 6 on the horizon. As soon as you leave the edge of square 4, instead of entering the fake square 6, you are warped back to the 'real' square 6 on the other side of the map. The warping would be simple: if the left edge of the actual square4 has an X coordinate of 0, and the right edge of square 6 has an X coord of 600 (for example), as soon as your position gets > 600, subtract 600 from it. The player should pop back to square4, however the visuals shouldnt change at all since they've been looking at the fake square4 the entire time. (This only works if multiple squares aren't visible straight ahead from the left edge of a square.. otherwise you'd need a thicker fake border around the middle)

Anyone think this would work?

[Edited by - kosmon_x on June 15, 2005 11:38:03 AM]
That sounds like it would work, Modile. Of course, its still a torus, but that is no biggie. The only other thing that I can think that might go wrong, is that when you get moved to another square, it could be alot of sudden loading, which is not wanted.
Just an ideea, why use a full grid ? There may be some cases where a square in your grid is never visible and you can use that memory for other square and to enlarge your world. I think it's easy to modify the algorithm to allow nonsquare grid with empty places.
Quote:Original post by c0mas
Just an ideea, why use a full grid ? There may be some cases where a square in your grid is never visible and you can use that memory for other square and to enlarge your world. I think it's easy to modify the algorithm to allow nonsquare grid with empty places.


Sure, but unless the basic square-grid algorithm for generating a torus that fakes a sphere works in the first place, this won't work..
Quote:Original post by Ezbez
That sounds like it would work, Modile. Of course, its still a torus, but that is no biggie. The only other thing that I can think that might go wrong, is that when you get moved to another square, it could be alot of sudden loading, which is not wanted.


Hmm, for the loading problem you could do a kind of streaming loading (that, for example, Dungeon Siege uses). What you do is, before the level starts load the current square (loading screen :( ), then after the game has started, start loading the squares around the current square (in a separate thread or something). More advanced versions of this algorithm would give higher priority to the loading threads of squares that are in front of the player or that the player is moving towards.

This assumes, of course, that you have a lot of memory. If you don't, you can use caches and stuff like that that will give you the advantage of pre-loading (for example, if you have a compressed .zip file that has your level data in it, the pre-loading process would unzip the contents and place them in temp/level01 or something).

Cheers!
- fyhuang [ site ]
Regarding the square tiling system and torus/sphere results, you could consider using equilateral triangles to make a quadrahedron, octahedron, or best, an icosahedron. Or you could use squares to make a cube. Of course, you wouldn't merely be limited to 4, 8, 20, or 8 tiles, because each major triangle or square could be subdivided into smaller triangles or squares, based on how many tiles you want overall.

And as for the procedurally generated tiles and edge alignment, maybe you could use overlapped tiles and a blending algorithm for combining tiles.
+-------+   +-------+   +-------+|       |   |       |   |       ||  0,0  |   |  2,0  |   |  4,0  ||     +-+---+-+   +-+---+-+     |+-----+-+   +-+---+-+   +-+-----+      |  1,1  |   |  3,1  |     |+-----+-+   +-+---+-+   +-+-----+|     +-+---+-+   +-+---+-+     ||  0,2  |   |  2,2  |   |  4,2  ||     +-+---+-+   +-+---+-+     |+-----+-+   +-+---+-+   +-+-----+      |  1,3  |   |  3,3  |     |+-----+-+   +-+---+-+   +-+-----+|     +-+---+-+   +-+---+-+     ||  0,4  |   |  2,4  |   |  4,4  ||       |   |       |   |       |+-----+-+   +-+---+-+   +-+-----+

Take all those tiles above, and shove 'em together tightly to get rid of the gaps between the odds/odds and evens/evens. Too look like:
+-------+-------+-------+|0,0    |2,0    |4,0    ||   +---+---+---+---+   ||   |1,1|   |3,1|   |   |+---+---+---+---+---+---+|0,2|   |2,2|   |4,2|   ||   +---+---+---+---+   ||   |1,3|   |3,3|   |   |+---+---+---+---+---+---+|0,4|   |2,4|   |4,4|   ||   +---+---+---+---+   ||       |       |       |+---+---+---+---+---+---+

Then, make the weight of a tile's height at any particular point be based on the points distance to the center of the tile. At the center of any tile (where all the overlapping tiles have their corners), whatever the height of that tile is, that's the resulting height in the game. Halfway between the center of a tile and the corner of the tile, the height of the tile at that point is averaged with the height of the overlapping tile at that same point, using a 50/50 weighting. I think such a system (probably with some various modifications) could do a reasonable job of blending tiles together. Just some thoughts, if nothing else.
"We should have a great fewer disputes in the world if words were taken for what they are, the signs of our ideas only, and not for things themselves." - John Locke
Indeed for a torus algorithm you might need a full grid.
Just a sugestion for a torus algorithm, in order to avoid repetitivenes you might make more grids with the same border and use them randomly, this way the landscape won't look the same over and over again and you may place some special grids for special places (like a town or a base). Again it's just a sugestion, it might not be usefull if your tiles are big enough (because the wole planet will be your grid).

This topic is closed to new replies.

Advertisement