Sign in to follow this  

How do you create terraforming in games?

This topic is 2065 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

What is the code design you need to create terra forming?

Like for example digging a hole in the ground?

I know a easy way to do it is making everything made of blocks..
But it's ugly and I don't like that.. and I guess that making microscopic blocks would be way too expensive on performance.

Like imagine a ground terrain... It's made of a plane mesh. If it's completely flat it's just 4 vertices.. but if it's not flat it has a lot more.
So if someone start to dig in the ground.. it should create vertices in the plan where he is digging.. and extrude them?

Share this post


Link to post
Share on other sites
You could use a heightmap for the terrain, (it is quite easy to raise/lower the ground then) (allthough if you want to dig tunnels its not really working)

Edit: You could also use medium sized cubes/voxels for the internal representation but render a smoothed version of the terrain instead (using for example metaballs) (This would work for tunnels but requires quite a bit more horsepower to render, with decent culling it should be a viable option though)

Share this post


Link to post
Share on other sites
[quote name='SimonForsman' timestamp='1335040605' post='4933598']
You could use a heightmap for the terrain, (it is quite easy to raise/lower the ground then) (allthough if you want to dig tunnels its not really working)
[/quote]

I'll look into heightmaps but yeah... I think digging tunnels is important.

Is it possible to create new vertices in a mesh? I mean when the player is playing the game. And then alter the vertices.

Share this post


Link to post
Share on other sites
[quote name='glhf' timestamp='1335040964' post='4933602']
[quote name='SimonForsman' timestamp='1335040605' post='4933598']
You could use a heightmap for the terrain, (it is quite easy to raise/lower the ground then) (allthough if you want to dig tunnels its not really working)
[/quote]

I'll look into heightmaps but yeah... I think digging tunnels is important.

Is it possible to create new vertices in a mesh? I mean when the player is playing the game. And then alter the vertices.
[/quote]

Yes it is possible.

Share this post


Link to post
Share on other sites
A couple of good starting points for you might be:[list]
[*]The chapter "[url="http://books.google.com.au/books?id=WNfD2u8nIlIC&lpg=PR1&dq=game%20engine%20gems&pg=PA39#v=onepage&q&f=false"]Volumetric Representation of Virtual Environments[/url]" in the book Game Engine Gems: Volume 1.
[*]The paper "[url="http://www.cse.yorku.ca/~wolfgang/papers/fractaldeform.pdf"]An Algorithm for Automated Fractal Terrain Deformation[/url]" (pdf) ([i]very[/i] theory-based).
[/list]
If you want to search for more resources on the topic, a couple of good keywords include "terrain deformation" and "destructible environment". The technique you describe of using "blocks" is known as "voxel terrain" or "voxel rendering" -- and although the prominent example of Minecraft chooses to make use of a simple blocky environment it's possible to use this approach to create smoother terrain as well.


If possible given your other requirements, the easiest way to make use of destructible terrain in a game would be to utilise an engine that already supports it, such as [url="http://udk.com/features-destructible.html"]UDK[/url]. If it suits your needs you could also consider [url="http://www.volumesoffun.com/polyvox-about/"]PolyVox[/url], which is a zlib-licensed C++ library for voxel-based terrain (if you look at some of the "[url="http://www.volumesoffun.com/polyvox-projects/"]projects using polyvox[/url]" you'll see not all of them have "blocky" terrain).

Share this post


Link to post
Share on other sites

This topic is 2065 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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