Sign in to follow this  
Syerjchep

The possibility of making a game world a giant isosphere.

Recommended Posts

So I was wondering if it would be possible for a game to basically take place on a giant isosphere, the world would be made up of many tiles which could all have a different terrain and height map, which would represent offset from the base height.

Here is an image showing kind of what I mean:
[img]http://img96.imageshack.us/img96/1333/64152930.png[/img]

The first is an example world, sort of, except it would be made up of squares, not triangles, the second picture below is an example of how some tiles could appear higher than others by being off the base height of the rest of the squares. Of course, in game, the height changes would be nice and smooth.

Personally I don't see a problem with this, the client would only render a few tiles at a time, and the server would still do no more work that if the game world was just a flat space. I decided I'd calculate how large a sphere world would be if I only wanted to use one megabyte of memory maximum, which isn't very much at all. First of all, I believe I may be able to put all of the data for a tile into one byte, the first four bits would tell a signed number between -7 and 7, for the tiles height, and the next four bits would tell the type of terrain of the tile, allowing for 16 types of terrain. So each tile is a byte for now, and we have 1048576 (1024^2) bytes in a megabyte, so that's 1048576 tiles total surface area. Now the formula for getting the surface area of a sphere from it's radius is 4pr^2. So we divide 1048576 by 4, and then by pi, and we get about 83443. The square root of which is about 288. Times by two to get diameter, and our world would be 577 tiles around. Doing math even further, if a person can at most see thirty tiles in front of them, 577/360 means that each tile only would have a 0.62 degree change, which means that you'd only see a 18.7 degree change within your field of view, which for a world which only takes up 1mb of ram, isn't bad.

However, I was wondering about how would I go about rendering such a scene in OpenGL, could anyone help explain to me how I could actually render parts of a large isosphere, and help me work out collision for the tiles, it's obviously possible, I just don't know how. Also, I noticed that the radius of the circle won't be exact, which I'm not sure how to get around with out there being a large empty slit down the middle of the game world.

Share this post


Link to post
Share on other sites
Quote:
Original post by Syerjchep
First of all, I believe I may be able to put all of the data for a tile into one byte, the first four bits would tell a signed number between -7 and 7, for the tiles height, and the next four bits would tell the type of terrain of the tile, allowing for 16 types of terrain. So each tile is a byte for now, and we have 1048576 (1024^2) bytes in a megabyte, so that's 1048576 tiles total surface area.

In order to actually render anything, one must generate vertices, texture information, etc...

So 3x4 for coordinates, 2x4 for uv coordinates, and probably a couple of more floats for other parameters to actually make it look nice. Assuming 32 bytes per vertex, that means 32768 vertices total in a megabyte.

Quote:
However, I was wondering about how would I go about rendering such a scene in OpenGL, could anyone help explain to me how I could actually render parts of a large isosphere
Considering 32768 vertices and related number of triangles is fairly small, the simplest way to render them would be just blast them as VBO in one call.

Unless we're talking about mobile devices, where the sphere would be split into 8/16/32 pieces, and only some of these would be streamed.

But given any kind of desktop hardware, the numbers above are really so small and rendering this type is basically trivial by all means that it's simply not worth spending time complicating things.


If terrain is generated procedurally, then just generating triangles on the fly is another option, again almost no machine today will break a sweat doing that.

Share this post


Link to post
Share on other sites
Sure you can do it, but there's no particular reason why you would unless you can actually zoom the view out far enough to observe the curvature of the planet. If you can't do that, having a spherical world doesn't really get you anything that a square map with edge-warping wouldn't get you with far less hassle -- for one, in a spherical world, you can't really talk about "tiles" per se, because you simply can't map regular squares to sphere... as a matter of fact, I don't think there's any one single shape that can map to a sphere regularly.

If having a spherical world doesn't actually add something tangible to your project, then its just a needless complication.

Share this post


Link to post
Share on other sites
Quote:
Original post by PrestoChung
maybe octahedral tesselation would fit your needs:
http://student.ulb.ac.be/~claugero/sphere/index.html


Tetrahedron seems faster according to the benchmark...

Quote:
Original post by Ravyne
If having a spherical world doesn't actually add something tangible to your project, then its just a needless complication.


FWIW, a spherical world would be eaiser to cull/partition. Everything below the tangent delimited by the camera won't be visible...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this