Sign in to follow this  

3D Grid: "Wall-Structures"

This topic is 4224 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

Hey there A while ago, I created a terrain engine for Direct3D which loaded terrain data from a heightmap and created pretty decent-looking terrain. Now, I want to change this engine to make a very simple, 3D "maze" style game (in a similar style to the "VR" missions from earlier Metal Gear Solid games, if anyone has played that). Everything is going good, I have created a small grid of tiles, index buffered etc. When I want to change the height of a certain tile (ie:
vertices[currentVert.Y % 9, currentVert.X % 9].Z++;
vertices[currentVert.Y+1 % 9, currentVert.X % 9].Z++;
vertices[currentVert.Y+1 % 9, currentVert.X+1 % 9].Z++;
vertices[currentVert.Y % 9, currentVert.X+1 % 9].Z++;
vb.vertexBuffer.SetData ( vertices, 0, LockFlags.None );

it raises the other tiles around it on a "slant" to join up with it. For terrain, this is great, but as you can imagine for walls it is not. Can anyone offer any advice on this subject please? Just a way to make sure tiles raise "hardly" ( _| ) instead of "softly" ( /- )) Regards James

Share this post


Link to post
Share on other sites
I don't think you can without distorting the rest as you've seen (could drag other vertices in to make it vertical but that would mess up the rest of the map...)

For the tiles which are raised you will need extra vertices to make edges. Sort of like the extrude function in a 3d modeller. Obviously you will need some fancy code to get it all in a vertex array though :-(

I tried a maze tile map, in the map file for each tile I had flags specifing whether it had walls/ceiling etc. Each wall was a separate mesh.

hmm

Share this post


Link to post
Share on other sites
Thanks for the info:

Its probably easier to just use meshes i've decided, or even custom cube-shapes for walls.

I was just hoping there was some way to do it like this.

Anyhow, thanks a lot

Share this post


Link to post
Share on other sites
It could be done although I don't know if it would screw the performance up alot but I'll suggest it anyway just incase

Two ways:

1. Don't use index buffers for your walls.
2. When you need to resize a wall, you could convert that wall into a standard triangle list and scale the verts seperately. You will then have to modify the index buffer to finish off the triangle strip for walls connected to the scaled wall.

Share this post


Link to post
Share on other sites
Thanks for the info.

It wouldn't be practical to modify / disable the index buffer, so I will go along with the mesh route, except I will use my own custom cube primitive as it is simpler to texture / test collisions.


Thanks to everyone who has posted here

James

Share this post


Link to post
Share on other sites

This topic is 4224 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