Jump to content
  • Advertisement
Sign in to follow this  
Xpyder

3D Grid: "Wall-Structures"

This topic is 4441 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
Advertisement
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
I seriously suggest loading meshes for this task, not only is it easier but it would be quicker to program too.

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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!