3D representation of 2D randomly generated environment - Maze

Hi guys,



I am creating a game as a part of my project. For a map, instead of a pre-modelled map, I am thinking of having a random maze generation algorithm e.g. Prims, Kruskal's,  DFS, etc. I am just having tutorials with jMonkeyEngine so am not sure if its possible to do this or not? For experienced campaigners and people who know more than me(mostly all at the minute) - Is it possible to do so with jMonkeyEngine?



Thanks,



Dev

I don't really understand the question, are you asking if 2D rendering is possible with jME, or are you trying to convert a 2D map into a 3D model?

I think he refers to using 2D data to create a 3D model… Very much like reading a PNG image to be used as a Heightmap for a Terrain… Oops, I think I already gave an example :stuck_out_tongue:

Well creating a 3D model from data has nothing to do with jME… It all depends on how the 2D data is represented.

Hey guys,



Thanks for the suggestions. I think you are getting close. Let me clarify things further. By using a maze generation algorithm and manipulating it a bit I will have a 2D representation of the environment. I assume the environment would be represented in 2D with the Java Swing package. Now I need to convert this representation into 3D.



But since this is random generator every single time you run it, the maze/environment will differ every time. And every time I want it to be converted to some 3D representation.



I hope it is clearer.



Thanks,



Dev

Hello!



You can of course dynamically create an scene from your “2D” maze information.



But as in an other 3D engine, is entirely up to you how you want to represent your maze in the 3D world.



Provided you already have your 2D maze generated and stored in some sort of structure, you need to generate 3D geometry. You could go basic and generate a cube (box) for every “wall” square of your maze. Have a look at the classes in the package com.jme.scene.shape (http://www.jmonkeyengine.com/doc/com/jme/scene/shape/package-summary.html), which provide programmatic facilities to fill your scene with basic geometric shapes. Your best friend is probably the Box class.



For a start, you can copy any of the jMonkeyEngine samples, and follow the user guide to get an overview of the framework (http://www.jmonkeyengine.com/wiki/doku.php?id=user_s_guide). This will set up a working environment and scene for you, which you can fill with your walls.



You will decide if you want to set your camera inside the maze or over it. How you will represent the player, and how the movement system will work. Later on, you can add eye candy elements, like vegetation or furniture, from models. You can modify some walls to present mirrors, windows, different textures and different shapes and heights…



But if you are new to jME, going for the “box” approach for a start seems like a good exercise.



Hope it helps. Good luck!




Hi,



Thanks jjmontes! I think its absolutely along the right lines.  Its good that this is feasible - from what you say when I run the program it will generate maze/environment, store this in a structure and then generate appropriate geometry for ever wall/cell of the maze. I am working through the examples so should catch on soon. Initially, I am planning to go with the cube as there is lot to program in terms of AI as well as documentation(which I am doing in parallel to this). So have a basic cube wall and simple environment, create player models and then start working on AI. But at a further date I definitely want a good imaginative and eye candy environment to enhance the playing experience. The only potential problem I see with the cube approach is lagging due the large amount that might be required - is that the case?



For documentation, I am already thinking about path-finding algorithms, low/high level strategies for opposition AI, opposition AI's behaviour, etc and am finding it a good practice to do it early in terms of design rather than diving in head first.



Again thank you very much. This is a lot of help! Much appreciated.



Regards,



Dev