Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My question is similar to these: Algorithm for generating a 2d maze To scene graph or not to scene graph? I.e. in this case should I use jme3 or some other engine (I heard unreal offers a free engine) for a 3D dungeon game and when I build up the dungeon, should I use an algorithm for a new dungeon every time or should I use a static scene? I've code to build a small wall that adds it to my scene which is mostly programmaticly achieved with less 3D modelling and more algorithmic solutions:

  /** This loop builds a wall out of individual bricks. */
  public void initWall() {
    float startpt = brickLength / 4;
    float height = 0;
    for (int j = 0; j < 15; j++) {
      for (int i = 0; i < 6; i++) {
        Vector3f vt =
         new Vector3f(i * brickLength * 2 + startpt, brickHeight + height, 10);
      startpt = -startpt;
      height += 2 * brickHeight;

  /** This method creates one individual physical brick. */
  public void makeBrick(Vector3f loc) {
    /** Create a brick geometry and attach to scene graph. */
    Geometry brick_geo = new Geometry("brick", box);
    /** Position the brick geometry  */
    /** Make brick physical with a mass > 0.0f. */
    brick_phy = new RigidBodyControl(2f);
    /** Add physical brick to physics space. */

enter image description here enter image description here

share|improve this question
Are you trying to create infinitely long dungeons? – Vaughan Hilts Aug 5 '12 at 4:41
@VaughanHilts That's an interesting question, I need to develop the game idea more to know the answer. I think the dungeon is going to be finits. – Programmer 400 Aug 6 '12 at 7:50

This is a rather broad question, and appears to cover two separate issues, generating the mazes and rendering them.

Generation: If your goal is to make a simple game with full control over how it plays out, a static map designed by you is the best way to go. However, if your goal is for lots and lots of replayability, or maybe a very, very long game, dynamically-generated maps are a good option.

There are numerous algorithms written up on generating mazes, and each one has its own quirks. I don't have much experience with them, however, so I can't suggest any.

Rendering: This all depends on how you want it to look. Scene graphs are not a cure-all, and are probably a bad idea for this, as scene graphs only take care of the translational relationships between objects.

If you take into account the fact that mazes have lots of walls, and if (of course) your walls actually go full height, the only walls you actually have to render are the ones immediately visible, and those are relatively easy to calculate with a modified version of the Ray Casting algorithm, or a breadth-first-search algorithm that runs off the 2D array that stores the maze.

If your maze imagery is simple enough, you can model a single wall and call the code that draws it, translating and rotating it for every location you need it drawn for.
(note that this is probably a good idea for your first maze game. Just make sure that your textures aren't too noisy so it's not blindingly obvious that this is what you're doing)

share|improve this answer
Thank you for the answer. Since it seems simpler to make a static map I think I'll go for that option this time. Generating a maze on the fly is an interesting problem but I think it's beyond the scope of what I'm trying to do - just a basic dungeon with some characters. – Programmer 400 Aug 6 '12 at 7:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.