Perlin Dungeon Maker


Perlin noise generated dungeons / caves! (w.i.p)

http://unitycoder.com/upload/demos/PerlinDungeons1/ (v1.0 : some bugs in webplayer build: floor & roof normals / tangents broken?, minimap is broken..)

Current version info:
– Creates 2D texture and array with perlin noise (not needed, since you could check x,y perlin values directly anyways..)
– First pass, create floors (with basic RLE – to save few vertices.. 1 floor can be long as seen in the image):
-> If we hit empty grid point, save x & y values
-> Until we hit a filled grid point (wall), then draw floor mesh from saved x & y values until here
-> Scale UV based on floor piece length (so that tiling is still correct)
– Second pass: Similar thing for walls (currently single pieces..would save vertices to draw long walls as 2 faces only)
– Maximum: 256×256 grid (mesh cannot have more than 65k vertices..could split it to new mesh)
– Adjustable wall height
– Added: basic minimap (guitexture with texture2D & setpixel..)
– Walls, floor, roof are separate meshes, easier to adjust their texturing (current textures are from opengameart.org)
– Added: Tangents for floor & roof meshes (so can use normal maps), founded the info from minecraft thread.
– Added: Footstep sounds (script & sounds from: bootcamp demo, modified the script to play sounds with autofire timer..)
– Added: Ambient cave sound (from: http://www.freesfx.co.uk )
– Added: waterdrop particles from roof
– Added: Cave mesh saving from playmode
– Added: HeadBobber (had to move fps camera under dummy gameobject and assign bobber to that gameobject..)
– Tried: GridMove, works fine but rather use free moving for now..


– Actually floor and ceiling could be just single plane..
– For texturing..use secondary perlin noise for “terrain” variation? (moss, rocky, sand..)
– Its single mesh, needs texture atlas for multiple materials?
– Generate mob spawned locations too? Other objects too?
– Generate floors and stairs and holes to other floors? (needs 3D perlin noise, currently using Mathf.PerlinNoise();)
– Level saving as an asset? (or could use OBJ save from angry bots?)
– Digging/breaking the walls?
– Volumetric fog or other effects? (since we are inside limited 2D grid, could do visibility casting & fake shadow stuff too?)
– Tesselation shaders (must use for something?! rounding the objects? or with wall displacement mapping?)

Image#1: 8×8 “dungeon”


Image#2: 256×256 cave/labyrinth  (adjusted perlin noise scale to make larger walkways) *click to view full size


Image#3: FPS Controller view (still needs variation for texturing..)


Image#4: Now wall, floor, roof are separate meshes. Added basic minimap also.

perlin_slender_caves_not(click to view)

Image#5: Testing fog with particles.. (doesnt look so good then turning..)

Image#6: Particles with Clipsafe shader (also moved the emitter down, so the smoke is more at floor level and particle type is vertical billboard)

4 Comments + Add Comment

Leave a comment


Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.