Slashdot Mirror


Building a Procedural Dungeon Generator In C#

Nerval's Lobster writes Procedural dungeon generation is a fun exercise for programmers. Despite the crude interface, such games continue to spark interest. A quarter century ago, David Bolton wrote a dungeon generator in procedural Pascal; now he's taken that old code and converted it to C#. It's amazing just how fast it runs on a five-year-old i7 950 PC with 16GB of RAM. If you want to follow along, you can find his code for the project on SourceForge. The first part of the program generates the rooms in a multilevel dungeon. Each level is based on a 150 x 150 grid and can have up to 40 rooms. Rather than just render boring old rectangular rooms, there are also circular rooms. "There are a couple of places where corridor placement could have been optimized better," Bolton wrote about his experiment. "However, the dungeon generation is still very fast, and could provide a good programming example for anyone exploring what C# can do." For C# beginners, this could represent a solid exercise.

4 of 83 comments (clear)

  1. Are you freaking serious? by DigitAl56K · · Score: 5, Insightful

    Have we slipped so far down the performance-orientated slide that we are impressed by *how well a dungeon generator runs on an i7 with 16GB of RAM*.

    I am genuinely curious. That is an outrageously high spec for a dungeon generator.

    1. Re: Are you freaking serious? by sconeu · · Score: 3, Insightful

      He's talking about the systemd module that *compiles C#.

      --
      General Relativity: Space-time tells matter where to go; Matter tells space-time what shape to be.
  2. Amazing performance ! by alexhs · · Score: 3, Insightful

    It's amazing just how fast it runs on a five-year-old i7 950 PC with 16GB of RAM.

    Yep, almost as fast as the original's code on a i386 with 4MB of RAM. Impressive.

    --
    I have discovered a truly marvelous proof of killer sig, which this margin is too narrow to contain.
  3. So someone else invented NetHack, goodie. by Anonymous Coward · · Score: 4, Insightful

    NetHack has had procedural dungeon generation with available source for .... gosh a long time.