Evil Science A whole load of stuff

23Feb/140

A C# algorithm to build interesting cave systems for your Roguelike – part 3

This post contains a more detailed look at the class?csCaveGenerator.cs, whose layout is discussed here, and?can be viewed on?GitHub here.?

Within the class?csCaveGenerator.cs, the source code is fully commented and easy to follow, and because I'm lazy I'm not going to copy those comments again :). However I will tell you how to use the class. Refer to the section below called Using the Class.

Using the class

This is simple enough:


csCaveGenerator?cavgen = new csCaveGenerator();

To build a cave system:


cavgen.Build();

Connecting rooms is also simple:


cavgen.ConnectCaves();

The Generated Map

The publicly exposed property Map is a 2d array which contains the generated map - a value of 1 indicates a closed cell.

Filed under: C#, Roguelike Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

No trackbacks yet.