Help on 3D planet concept

Started by
8 comments, last by NIm 17 years, 11 months ago
Here's and interesting and complex question. I am creating a game and one of the elements in the game is a fully modifyable 3D planet. I want to be able to create tunnels that run from one side of the planet to the other, as well as build on the surface of the planet. All planets have gravity, so I'd have to include that as well. I don't think I could use a triangle mesh, due to the nature of the distructable world, so I was thinking about useing voxels for the planet, but I don't know how you would mix gravity and collision dection to something spherical. Any suggestinos or ideas are helpful. Thanks. -= OrangeMan
Advertisement
Well... This isn't going to help you much, but since your problem relates to a project I've been working on I thought I'd respond. Your problem stands as another example of why I need to get my terrain system completed. I have an innovative middleware solution that I plan to develop that will allow for extremely high quality dynamic and destructable terrain, even for entire planets if desired, although that wasn't my original intention for it.

I've been conceptualizing and prototyping the system for over 4 years now and I don't want to give the inner workings of the system away so easily. I'm sure there's more than one way to accomplish what you're attempting to do though. Voxels seems like an unconventional but resource intensive approach. By the way, what level of detail are you looking for in this planet?

Do you intend to have a very simple and icon-like planet, or a fully-featured planet with continents, islands, mountain ranges, caves, and canyons? My system would be ideal for the high detail level planet but would be overkill for a simplistic and low detail planet. Sorry I can't offer more at the moment. Maybe if you provide more details about what you're looking for I might be able to offer some other alternatives for accomplishing your goals.
I use an 'additive geometry' method (actually developed for putting caves into heightfields), something like this:

Your planet's surface is made of patches (usually). When deforming to make a hole, you first deform the patch within certain constraints. As soon as there is overhang, or 'under cut' you need to cut the patch to the 'surface line' around the undercut (removing vertices from the appropriate patch subdivsion) and effectively create a new patch (or set of patches) by edge extrusion down, which can then be deformed to create the undercut.

This is assuming you're using a procedural generator for the planet's heightfields, and adding holes and 'interesting features' by hand. You'd want to roll your own editor for this sort of thing, or stitching methods will need to be developed.

For my project, we're initially sticking with set resolution heightfields for terrain (not patching as such) and a custom stitching method for interesting features. This allows us to design features as adaptive assets and force-stitch them to the terrain.

Winterdyne Solutions Ltd is recruiting - this thread for details!
One thing that popped into my mind is how in the game will the terrain be recreated so to speak. or altered.

My thoughts are, Shovel's. Profesional Digging machines like we have no adays. Explosions from demolion blasts or gun fire. Weather even, Lightning storms, rain.. etc

figuring that out might help you more clearly decide on how you want the terrain to be altered.

As for the gravity aspect of a sphirical world.. thats well beyond me.

I only imagine it would take severe programing and high high high mathmatical skills to acomplish that. but it could win you a fantastic spot in any game company to accomplish such a feat. Atleast I would think so.
This sounds a bit technical for Game Design, you might get more responses in one of the programming forums.

As for gravity, it kind of depends how realistic you want to be. If you can reasonably assume that that planet is uniformly dense and spherical, then gravity simply increases linearly as you get further away from the centre, until you reach the surface, where it drops off again according to the inverse square law.

Obviously, if the excavations are really extensive, and your planets are expected to wind up looking like swiss cheese, the uniformly dense assumption isn't going to work. Nor does this account for things like the possibility of caves collapsing if they get too big, for example. Then you're looking at subdividing the planet into separate masses and calculating their effects on each other, and it's going to start getting complicated and very processor intensive.
I think it would be easier if your planet was represented as a flat plane in the game world. As for the fully destructible aspect, you can use a rigid body physics engine such as ODE. Your planet engine can provide a set of building blocks (bricks, wood, concrete blocks, etc) that can be used to construct things on the surface of the planet. The physics engine will take care of how these building blocks interact with each other, and that will give a good destructible environment. The obvious disadvantage here would be that the individual blocks would not be deformable, since they are rigid bodies.

The other problem that I can think of is that handing an entire planet of rigid bodies to an engine is not a good idea. To solve this you can divide your planet into square sectors, and these sectors should be dynamically loaded when they are needed. For example, if the player is in sector (5, 5), the sector (5, 5) along with the 8 sectors that surround it should be loaded into the physics engine and should be rendered. Whenever the player crosses sector boundaries, the game should figure out what 9 sectors should be loaded now and which sectors should be freed.

If the player is at (0, 4), and crosses the left boundary, then sectors
0, 3
1, 3
1, 4
1, 5
0, 5
w, 5
w, 4
w, 3

should be loaded (w is the number of sectors in your planet along the x axis). This way the planet looks like it is a sphere, when really it is a plane.
Sandman, you wouldn't have to recalc each segment every frame. Just every minute or so, not enough could happen to effect it that much, just rotate through all the segments recalcing the current gravity and be done with it.

"Those who would give up essential liberty to purchase a little temporary safety deserve neither liberty nor safety." --Benjamin Franklin

Quote:Original post by Mike2343
Sandman, you wouldn't have to recalc each segment every frame. Just every minute or so, not enough could happen to effect it that much, just rotate through all the segments recalcing the current gravity and be done with it.


Well, much depends on how the system is to be used. If we're talking about some kind of high tech planetoid blasting game where rapidly tunnelling through planets happens frequently, and the players move about very quickly, then that wouldn't really work. You could probably figure out some way of only calculating the gravity when something significant happens to change it, and then storing the results in a set of nodes that can give you an approximation of the gravity at that point, but you'd probably still need to take some major shortcuts in order to calculate everything quickly enough. Many-body gravitational interactions are hard work, more so than many-body collisions (which you may have to calculate as well)

On the other hand, if we're looking at a more real-world scenario, where digging right through a planet happens more or less never, and the tunnels are insignificant compared to the rest of the planet, then it's trivial - the uniform density assumption will hold more or less true and you can just use the linear gravity model.
Quote:Original post by OrangeMan
Here's and interesting and complex question. I am creating a game and one of the elements in the game is a fully modifyable 3D planet. I want to be able to create tunnels that run from one side of the planet to the other, as well as build on the surface of the planet. All planets have gravity, so I'd have to include that as well. I don't think I could use a triangle mesh, due to the nature of the distructable world, so I was thinking about useing voxels for the planet, but I don't know how you would mix gravity and collision dection to something spherical.

Any suggestinos or ideas are helpful. Thanks.

-= OrangeMan



Locally the system could work as if it was flat (heightmap grid + gravity straight down). You possibly could warp the mesh grid to fit a spherical segment (only a small change in the vertices if the map is only a small portion of the globe).

Is the OP still interested in this thread?

This topic is closed to new replies.

Advertisement