The Making of a Slaughterhouse: A Dead Meat 3D Devlog


Dead Meat 3D version 1.0 dropped this week (so check it out here!), and having reached this pivotal milestone, I thought I’d reflect on a few noteworthy technical aspects.

This devlog provides a closer look at the procedural map generation system featured in Dead Meat 3D.


I. Map Generator

The Grid

Every map starts with a blank, 3D rectangular grid. The map generator algorithm begins by placing “blocks” along the grid. These “blocks” represent the different chambers within the slaughterhouse.

Generate blocks

The algorithm processes each floor sequentially until enough floors are generated.


The Rooms

The blocks are replaced with actual instances of pre-made room prefabs.

Replace with rooms

Next, the algorithm must “clear a path” from one floor to the next. This is accomplished by removing certain geometry from the wall models (which have been specifically designed for procedural generation.)

Doorways

We now have a functional, procedurally-generated space for the player. Next up: we’ll look at several techniques to improve the look of the map.


II. Refining the Visuals

Baked vs. Dynamic

The lighting of each room prefab is baked beforehand. Each instance of a room reuses the lighting data of the prefab (which reduces the video memory footprint significantly.)

Prefab baked lighting

Unfortunately, since the lighting is entirely baked, the room lights have no effect on dynamic objects (e.g. the player).

Dynamic object in a static environment

In a non-procedurally-generated setting, artists typically fix this by placing light probes at various locations around the scene. Dynamic objects would simply sample nearby light probes to simulate lighting changes.

Light probes

One glaring constraint with light probes is that all probes must be placed and baked ahead-of-time. So how can the light probe method be made compatible with a procedural map generation system?


Lighting of Dynamic Objects

Our solution involves baking the probes once per prefab (since the prefab is in a static position). Then, each dynamic object does the following:

  1. Determine which room type it’s currently in
  2. Transform its position relative to the prefab room
  3. Sample the light probes in the prefab

Realtime probe sampling

Here’s how that process looks in action. Notice that as the player moves, the sample point moves exactly with the player, thus ensuring the light probes are being sampled at the correct location every frame.


Reflections

The final step involves enhancing the surfaces of the room by adding reflections. We bake accurate box reflections per room.

Baked reflections

As an added bonus, the box reflections provided fake specular highlights from light sources!

In addition to baked reflections, screen space reflections provide realtime (but less accurate) reflections for dynamic objects.

Screen space reflections


Conclusion

And there you have it folks; with a few simple tricks, we get a procedurally generated slaughterhouse with a nice blend of precomputed and realtime graphical effects!

See these slaughterhouses for yourself by playing Dead Meat 3D for free on itch.io. Don’t forget to follow Tripping House for more trippy content!

Files

Windows 240 MB
Version 472 8 days ago
macOS 261 MB
Version 472 8 days ago
Linux (Experimental) 310 MB
Version 472 8 days ago

Get Dead Meat 3D

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.