Help with a 3D Maze type game.

Blitz3D Forums/Blitz3D Beginners Area/Help with a 3D Maze type game.

Kedumba(Posted 2014) [#1]
Hi,
I'm looking for help on the best way of creating a 3d maze similar to the old Windows screen saver.

I can create the maze. That's the simple part. After I have created the maze I have a 2d array Maze(x,y) which contains the maze that I want to build. Each "cell" of the array Maze(x,y) contains info about Walls, Start/End locations, Traps etc.

I'm looking for suggestions on how best to get this maze into the 3D world.

Currently, I am looping through the Maze(x,y) array and for each cell, I am checking for the 4 walls (North, South, East, West). For each wall, I am creating a Cube, Texturing it, scaling it to the correct size and then finally moving it to the correct position in the world.

This works but seems an extremely inefficient way of doing things. In addition, as the size of my maze increases with each "level" it doesn't take too long before I've got over 400 cubes on the screen which seems silly to me especially as I had planned to keep increasing the complexity of the maze with each level.

So what I'm asking for is suggestions as to how I can take the info stored in Maze(x,y) and convert it into a 3D maze (preferably with collisions so you can't walk through walls) that the player and navigate through.

Thanks in advance for any useful suggestions


H&K(Posted 2014) [#2]
Make the whole maze one object.

Create the surface, add the vertices of each world cube point, texture etc

If the maze isn't changeable, optimize at creation for "hidden" cube faces


RemiD(Posted 2014) [#3]
Yes i would also merge all the independent surfaces into a minimum number of surfaces.

If many floor parts, wall parts, ceiling parts, have the same normal, i would create one surface to contain the vertices and the triangles which have the same normal, so that a surface can be hidden if it cannot be seen by the camera depending on the camera orientation.

You could also use fog or a prerendered background to only have to render the near meshes, if you do that, it is better to merge the surfaces which are near each other into one surface.


Kedumba(Posted 2014) [#4]
Thanks for the replies. I'll have a play around with surfaces and see how it goes.


Matty(Posted 2014) [#5]
Also you cam draw smarter....dont create cubes for sections that can never be seen ie they are surrounded on all sides.

Also you can try creating only those cubes thatbare visible frim the players position rather than the whole maze.


Krischan(Posted 2014) [#6]
Before I started with my current RPG project, I've created a small Blitz3D program to create a 3D level out of a CSV file. Looks like you could find it useful for your project. I've shortened the code to the basic functionality and added some comments. Due the use of camerafog and planes, the tris count is always low (<2000) without any need for hiding triangles for the walls. Use cursor keys to walk around, without collision detection.

Download Maze.zip (0.8 MB, full source+media+exe)

Screenshot:


Code: