You will find it is easy to program a 3D maze with OpenGL and C++ under Windows!I have found that I have written a large number of interesting and perhaps sometimes useful applications. I have been programming for a number of years, starting with Turbo c and trying out C++, Java, Perl, JavaScript, Python, Perl and a few things with MS Visual Studio. Over the years I have created a number of programs, see http:www.softwareok.de , which may be of interest to others.
These programs I discovered and may look simple for experts, but I hope they can be useful for beginners. Here I want to present you a short source code of a small labyrinth game created in 2005 using C++, OpenGL glut32 and a bit of passion from the developer. In the game you are a lonely red ball in the big terrible labyrinth. Your only wish is to find an exit from the randomly generated labyrinth. It's strange, but the exit is a yellow ball ;). The source code and binaries of this application are available on GitHub.
https://github.com/sergey-tihon/Ravent-App-Store/tree/master/SuperSDG2 I compiled it here with MS Visual Studio 6.0, so anyone can create it with any other (higher versions). This random labyrinth is really a nice thing! ... DL_Opengl/RandomLabyrinth.zip
PS: Putting together such a simulation requires a complex, multidisciplinary development process. Issues of design, physics, etc. need to be addressed, as well as the computer science problems of 3D programming and a random maze game. Therefore, much of the design work evident here and much of the code presented here will be well suited to those who are particularly interested in certain aspects of the implementation, and then you can get more benefit from it. Here is a second example I discovered! http://beaugg.blogspot.com/2014/07/random-3d-mazes-in-opengl.html
The program described here uses OpenGL to render a three-dimensional maze through which the user must maneuver (walk or run) using the mouse and/or arrow keys. A first-person perspective is used, with collision detection implemented on the maze walls. Each maze is randomized, and furthermore each maze has only a single best (i.e. detour-free) solution path. The size and difficulty of the maze are controlled by compile-time constants. By default, a relatively simple maze is provided, but during testing very large and cumbersome mazes were simulated with good results.
The demonstration code is less than 650 lines long, even with liberal use of comments. The code provided is therefore architecturally minimalist. Like much of OpenGL itself, the demo is mostly a plain C program. This makes for a clear presentation that can still be adapted to more complex designs.
The simulation developed here is somewhat similar in appearance to Wolfenstein 3D, one of the earliest widely used 3D simulations. However, the use of OpenGL enables some effects not seen in Wolfenstein 3D.
For example, at the start of each game session, the user drops into the game world from above, as if by parachute, near the entrance to the maze. This provides the user with the opportunity to view the maze solution just before the game begins, and adds another skill dimension to the game. An example of this aerial style view is shown below:
FAQ 19: Updated on: 4 September 2024 11:53 |