Skip to main content
gamedev.net
🔒 Locked

Infinite world. tiling maps

Started by Ilici Mar 28, 2003 at 2:47 PM 22 replies 11.2k views
Original Post
Ilici
Ilici
ok now this is (i think) a hard one i have a roam engine working with bin-triangle tree. what i wanna do is to tile maps so my world looks infinite. maybe a really big map would do the trick but the world still wouldnt be infinite. if u got any ideea pls tell me. /*ilici*/
falkone
falkone
Try using a four dimensional linked list. each tile would be a node in the list, and you could easy move a row from one side and stick it on the other, thereby simulating an infinite (though repeating) terrain
Disclaimer: "I am in no way qualified to present advice n any topic concerning anything and can not be held responsible for any damages that my advice may incurr (due to neither my negligence nor yours)" o
Illumini
Illumini
Well how do you mean infitine.

There is no REAL infinite. The concept of infinity can only be found inside the mind.

you could have a constantly random generate landscape.

Or a repeating landscape.

But if you wish to make the map yourself in a mapeditor or such you can never make an infiinite world

now if you want a non zoned world.. ie no load times.. continous world.

That can be accomplished by simply making small maps and loading 9 of them at a time

the one the player is on and the 8 surrounding ones. when the player passes onto the next map simply load the ones around it. thus the player never knows where one map ends and the others begin
Ilici
Ilici
thnx ppl. il try using 9 maps at a time

/*ilici*/
Ready4Dis
Ready4Dis
quote:
Original post by Illumini
Well how do you mean infitine.

There is no REAL infinite. The concept of infinity can only be found inside the mind.

you could have a constantly random generate landscape.

Or a repeating landscape.

But if you wish to make the map yourself in a mapeditor or such you can never make an infiinite world

now if you want a non zoned world.. ie no load times.. continous world.

That can be accomplished by simply making small maps and loading 9 of them at a time

the one the player is on and the 8 surrounding ones. when the player passes onto the next map simply load the ones around it. thus the player never knows where one map ends and the others begin


Sure there is a "real" infinite. Infinity means it goes on forever, which is possible, thereby, existing (while (1) {}; This will loop infinetly, or until the power or computer burns out, whichever comes first ). You could dynamically generate the terrain on the fly (perlin noise functions, etc), you can just tile forever, as long as you don''t over-flow the numbers (which can wrap around to start the process all over again, thereby still satisfying infinity).
crazylegs
crazylegs
quote:

Sure there is a "real" infinite. Infinity means it goes on forever, which is possible, thereby, existing (while (1) {}; This will loop infinetly, or until the power or computer burns out, whichever comes first ). You could dynamically generate the terrain on the fly (perlin noise functions, etc), you can just tile forever, as long as you don't over-flow the numbers (which can wrap around to start the process all over again, thereby still satisfying infinity).



i do completely agree,
PS : also
  for(;;)  
will laid to infinity



[edited by - CraZyLeGs on March 29, 2003 11:18:43 AM]
Do it your self!
falkone
falkone
Well, "technically" it wouldn't be infinite... becuase the computer would eventually have to stop.... but if we examined every single term down to that level, we'd go insane because nothing would mean anything.. it's silly..... so yes i agree that there can be infinite terrain

[edited by - falkone on March 29, 2003 11:27:05 AM]
Disclaimer: "I am in no way qualified to present advice n any topic concerning anything and can not be held responsible for any damages that my advice may incurr (due to neither my negligence nor yours)" o
TerranFury
TerranFury
Here''s a thought. You know how you render a skybox in terragen? 6 views, each with a 90 degree FOV, one for each face of a cube? What if you rendered your terrain that way, to textures (with alpha channel for a transparent sky), and then drew a series of concentric cubes with these textures, tiling the texture more on cubes with faces farther from the origin? I haven''t developed the idea completely in my head, but I thought I''d post this, since it may prove to be a way to render many, many identical terrain tiles by only rendering one terrain tile!
Illumini
Illumini
I guess I didn''t explain it well.

Technicalities aside infinite in modern games simply isn''t possible.

Yes I agree with what you have both mentioned. I stated in my previous post that either randomly generated terrain or looping terrain will appear infinite. However how many GAMES (read: not tech demos) have you seen make use of repeating terrain or randomly generated terrain to make the world infinite? I can think of a few, but they weren''t comercial games. they were more like elorate shareware demos.

For the remainder I''m ruling out the repeating terrain. As it is not even truely infinite (you could see all there is to see of the terrain). Instead lets focus on the infinite terrain via algorithms. While modern algorithms can generate great looking terrain, thats it. There are some algorithms I''ve seen used that generate limited gameplay such as quests/npc''s/etc (all of which must fall into a limited realm of possibnilties). But they can''t make you game for you (And who would want them too?). Thus while you engine could create infinite terrain on the fly, it would be empty terrain and serve no use in a game. Sure it could make a great tech demo, but in my opinion there are far to many terrain tech demos already LOL.

So the point of all the ranting is this. Infinite terrain has practical purposes, but in a game it generally doesn''t work.

As for my commment on infinity (which yes, was technical). I felt that illici wasn''t really trying to create an infinite world (because no such thing exists! If you don''t believe me go look for an infinite planet and I''ll by you a spaceship to go there ). But rather trying to avoid "maps."
TerranFury
TerranFury
AFAIK Tribes and Tribes2 did this. How? Something akin to Perlin noise, I assume.
Neosmyle
Neosmyle
Don''t forget that RPGs aren''t the only type of game out there. Like Terran mentioned, Tribes had random terrain, and it didn''t need to be "populated" because it is just a shooter, so you could just have endless battles between players on infinite terrain, but no need for quests and npcs.
alvaro
alvaro
quote:
Original post by Illumini
Thus while you engine could create infinite terrain on the fly, it would be empty terrain and serve no use in a game.



Why wouldn''t you be able to generate content on the fly? The fact that you can''t come up with a good scheme to do it doesn''t mean that it can''t be done.

Ilici
Ilici
what i mean by infinty is that u can walk from one side of the world to the other in like 1 day continuously and by moving in a straight direction. so therefor i would have an array with terrain data for generating the terrain at a specific location.
of course a repeating terrain is not a good ideea.
then i could generate game info (quests, battles and other stuff) based on the array.


/*ilici*/
oliii
oliii
another way would be to using perlin noise functions at runtime for your landscape heights. Now that's infinite.

If your heightmap texture is in itself tilable (opposite edges of the map meets, like for a planet landscape), it's trivial.

When you grab the pixel height, where the pixel position (x, y) on the map can varies to 'infinity', just do


      
uunsigned char GetHeight(int x, int y)
{
x &= (MAP_WIDTH-1);
y &= (MAP_HEIGHT-1);

return m_Heightmap[y * MAP_WIDTH + x];
}


MAP_WIDTH, MAP_HEIGHT being powers of 2. But I've got a feeling you already know all about what I've just said.

Also, because you keep repeating the same pattern over and over again at the same intervals, as if it was a planet you are circling around, you can also wrap your current position on the map, so you don't go overflow. If your heightmap is big enough, it's what you want anyway. There are no infinite terrains in the real world, the earth is round, remember?

If you can't store all the data in memory, you've got to somehow stream it by chunks, alng with other data. Since you move in only two directions, and not too fast, it should not be too difficult. Then you can have absolutely humongous terrains.

[edited by - oliii on April 1, 2003 10:25:52 PM]
Everything is better with Metal.
Ilici
Ilici
now the problem is how to represent the data in memory
if i take 9 tiles and put weld them thus getting a big map is a problem because the terrain engine works with 2^n + 1 sized maps
and my map would be of (2^k + 1) * 3 size != 2^n + 1

the other posibility is make 9 instances of the terrain engine (Terrain class) and each one of these would use a tile but 9 calls to the terrain engine functions (tesselate , render) i think would make my game into slow slideshow

so what do u think i should do?

/*ilici*/
Eelco
Eelco
probably the whole concept for trying to create an infinitive map crossed your mind when irritating yourself about crappy solutions to prevent players to walk of this stupid looking square map, am i right?

infinitive mapsize would be a way around it, but i think i know a better one to solve the problems mentioned above.
you remember the game populus? right: globes, i think it would be really cool in a game a lil'' more advanced than good old populus.
you can cover a globe/sphere quite easily with triangles of approx equal size, and then let each triangle represent a terrain. cos of the curve of the planet you wouldnt have to bother with extreme high LOS either, cos you wont be able to look over the horizon anyway.
youd have to find some other datastruct than a heightmap though, cos that wont really fit into a triangular shape.
Ilici
Ilici
thats a good ideea spherical heightdata

i saw some implementations on the net but they are for a space view of a planet. i need data accurate enough that u can move a player on it and that would take huge amounts of memory.
so lets make a small planet (like populous ) for storing the data i think that i could store it by 2 angles (one for x and one for y)


got any more ideeas?

Eelco
Eelco
well actually its pretty much the same as a space view planet, instead that where a planet viewed from space has a triangle, you have a complete terrain (mesh or something, im not much into 3d programming) witch is slightly curved to fit the shape of the imaginary sphere it lies on.

then you could have a sphere witch is subdevided in maybe 30 ''triangles'', or actually areas, and have an equal amount of terrains witch you load in realtime whenever needed. you only load the terrain you stand on and those around it ofcource.
or maybe if you had a small planet, in m^2 comparable to a normal terrain you could also load all terrains at startup i suppose. remember that you need a minimum of 4 terrains to form a sphere, but as much as possible cos that will make more smooth transitions i think, and besides reduces loading between terrains.

youd need to find the right algo to subdevide this sphere though. the standard method works with slices i believe, witch obviously wont do here cos youd get really small terrains near the poles.

ofcource this is just one of the problems such a map brings with it, but it would definitly stand out among the whole bunch of std - terraindemos around.
alvaro
alvaro
quote:
Original post by Ilici
what i mean by infinty is that u can walk from one side of the world to the other in like 1 day continuously and by moving in a straight direction.



That''s easy. All you need is a very slow moving character. "Snail simulator 2003"?

TerranFury
TerranFury
I''m a huge fan of the spherical terrain idea. Here''s how you could do it.

You''d want to offset the verteces of a geosphere (rather than of the standard "slices" sphere tesselation).

First, wondering how to make a geosphere? First, let me give you a mental image. You''ve probably heard that in 3d studio max and other modelers there is a "smooth mesh" function. You''ve probably seen pictures of what it looks like. Well imagine starting with a regular tetrahedron (triangular pyramid, all faces equilateral triangles), and then smoothing it. The more you smooth it, the more spherical it gets.

This is the most common technique for generating geospheres. Start with a regular tetrahedron, and subdivide the faces over and over again until you reach the desired detail level.

How do you subdivide each face? Well, each face is a regular triangle. Subdivide it like so:

/\
/ \
/____\
/\ /\
/ \ / \
/____\/____\

After subdividing ALL faces, set each vertex''s position equal to the average of all its neighbors'' positions (remember neighbors on other faces. By neighbors, I mean verteces connected to it. Then you can repeat the subdividion routine on all the resulting faces.

Now, this generation technique is itself somewhat fractal in nature, so just add small random offsets to the new vertex coordinates as you generate your geosphere. Use larger offsets for the initial subdivisions, and smaller ones for the final subdivisions. Now you have the perfect planet-generating algorithm!

Plus, you have a ready-made spacial subdivision scheme: a tree. Your root node has four children (one for oueach of the original faces). You divided each face into four more faces, so each of those has four children - and so on. You can use this tree for storing items on the globe, or for fustrum culling!

It''s also a LOD scheme of sorts! If it''s far away, rather than rendering four triangles, you can render one - their parent. At transitions between detail levels, you can render two rather than one triangle to eliminate seams, like so:

____________
/\. /\
/ \ . / \
/ \ ./____\
/ \ /\ /\
/ \ / \ / \
/__________\/____\/____\
/\ ./\ . /\
/ \ . / \ . / \
/____\. / \ . / \
/\ /\ / \ . / \
/ \ / \ / \ ./ \
/____\/____\/__________\/__________\


Wow! It''s a combination terrain generation / spacial-subdivision / LOD scheme capable of dealing with globes! I like it!!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.