3D Rad - Free 3D game maker - Forum

This forum is now archived!

This forum is locked, and is a read-only version. A new community-ran forum can be found at classdev.net

News:

The 3DRad community can be found at classdev.net.

Pages: [1]

Author Topic: Amazing mazes with a Maze Generator  (Read 1270 times)

jestermon

« on: November 15, 2011, 07:06:56 PM »
There have been a couple of posts lately with mazes, as well as various questions on mazes, which of course sparked my interest, and led to my latest toy.

The project comes with a secondary program, namely GenerateMaze.exe. This program creates a text file of a randomly generated maze. The chances of you generating two identical mazes, is about 1 in 5 million. So you are always sure to have a unique new maze whenever you run this program. The program is written in C, using some algorithms I got from the web.

The project _RadMazer_ generates a 3d maze with imposter boxes, based on the text file. You may use this project as a foundation for your own maze based games if you wish; which is intended purpose of the post anyway.

When the project starts, it generates the 3d maze, and you must see if you can go through the maze in 1st person camera view. You can switch to a top down view with the middle mouse button, but you can't move in this view. Middle mouse button toggles back to 1st person view if clicked again.
Andro shows you where you are located in the maze, when you use the top down view.

V7.22 - But here is the script for those who don't have 7.22, but do have a version that supports imposter RB's
With a million versions floating around, I can only support 6.50/7.03 and 7.22

Code: [Select]
int BLOCK = OBJ_0;
int CAM1 = OBJ_44;
int CAM3 = OBJ_22;
int ANDRO = OBJ_66;
int max = 441;
bool CHEAT = false;

//----------------------------------------------------------------------
void NewMaze()
{
   int i,j,c,fh,p;
   Quaternion q = Quaternion(0,0,0,0);
   Vector3 location;
   string s;

   //hide imposters and master
   iObjectLocationSet(BLOCK,Vector3(-1000,-1000,-1000));
   for(i=0;i<max;i++){
      iObjectImposterSet(BLOCK,i,q,Vector3(-1000,-1000,-1000));
   }
   
   //place all possible blocks into position
   c=0;
   for(i=0;i<21;i++){
      for(j=0;j<21;j++){
         location.x = (i*3) -30;
         location.z = (j*3) -30;

         location.y = 0;
         iObjectImposterSet(BLOCK,c,q,location);
         c++;
      }
   }
   
   //load maze file and generate maze - remove accesable blocks
   fh = iFileReadOpen(".\\maze.txt");
   for(i = 0;i<21;i++){
      iFileStringRead(fh,s);
       for(j=0;j<21;j++){
         p = s[j];
         //iObjectTextSet(OBJ_22,p);
         if(p == 32){
            c = i*21+j;
            iObjectImposterSet(BLOCK,c,q,Vector3(-1000,-1000,-1000));
         }
      }
   }
   iFileClose(fh);
}

//----------------------------------------------------------------------
void Main()
{
   Vector3 location;
   Quaternion orientation;

   if(iInitializing()){
      iObjectImpostersCreate(BLOCK,max);
      NewMaze();
      iObjectHide(CAM3);
      iObjectShow(CAM1);
      iObjectHide(ANDRO);
   }

   if(iDeinitializing())
   {
      iObjectImpostersDestroy(BLOCK);
   }

   if(iMouseButtonClick(2)){
      if(!CHEAT){
         CHEAT = true;
         iObjectHide(CAM1);
         iObjectShow(CAM3);
         iObjectShow(ANDRO);
      }else{
         CHEAT = false;
         iObjectHide(CAM3);
         iObjectShow(CAM1);
         iObjectHide(ANDRO);
      }
   }
   iObjectLocation(CAM1,location);
   iObjectOrientation(CAM1,orientation);
   location.y -=3;
   iObjectLocationSet(ANDRO,location);
   iObjectOrientationSet(ANDRO,orientation);
}







« Reply #1 on: November 15, 2011, 08:50:49 PM »
O_o thats cool!

psikoT

« Reply #2 on: November 16, 2011, 01:11:10 AM »
OMG
« Reply #3 on: November 16, 2011, 05:32:44 AM »
COOL !!
I'm Running . 3DRad 7.22 and LUVIN IT !  8-)

Check out http://www.Zpokerplayhouse.com
« Reply #4 on: November 16, 2011, 11:25:12 AM »
Really really amazing!  :o

I gotta say, you make us all unnecessary! You could run this forum and this engine all on your own! You can make games in an hour that other user take a month!
Rocket Rumble, a 3D Rad puzzle game:
http://www.3drad.com/forum/index.php?topic=9896.0
« Reply #5 on: November 16, 2011, 11:30:18 AM »
Rooberto no words like probobly or likely ! SHE CAN! and she makes ;)
::=::Look at this ::=::
Rally game

The most important thing that happens, you usualy miss it , but after sometime you will remember
 
even if you didint noticed. Go forward and never look back
« Reply #6 on: November 18, 2011, 01:37:15 PM »
Amazing :)
« Reply #7 on: November 18, 2011, 03:22:51 PM »
i take my cool back...LOL...I need a readme on how to use this utility
I'm Running . 3DRad 7.22 and LUVIN IT !  8-)

Check out http://www.Zpokerplayhouse.com
« Reply #8 on: November 18, 2011, 06:22:43 PM »
Best Programmer in 3dRad !! That's Awesome !!  ;)

Wish I see more Works and Ideas from you
« Reply #9 on: November 18, 2011, 07:57:21 PM »
the worst BEST thing CREATION EVER made CREATED by someone JESTERMON
أهلا :)
Pages: [1]