Slimes and Sandwiches

Slimes and Sandwiches

This game is from ldjam.com, which is currently unavailable.
You can try viewing the original page on Web Archive (may not load correctly).
overall: 3.35
fun: 3.08
innovation: 3.12
theme: 3.42
graphics: 3.39
audio: 3.07
humor: 2.84
mood: 3.26

Click to play in browser!


Game Background


Avoid those slimes and eat those sandwiches! Explore this procedurally-generated abandoned mine that's overrun by blobular beasts! Find the key that unlocks the ladder to the next level! Get as deep as you can!

How to play


* Use WSAD to move around
* Use Mouse to look left/right
* Use Left Shift to dash, but beware, it will take some of your hp!

Tools:


* Unity
* Paint.NET
* Audacity

About the development


I easily spent the most time on the procedural generation system. This is a GIF of it in action:

The algorithm goes like this:
* Generate 10 randomly sized rectangles, and add 2D physics components to them (colliders and rigidbodies)
* Let the physics engine sort them out until they are all sleeping
* Slightly adjust their sizes/positions to the nearest integer value (for easier tile-based generation later)
* Start with a random room, and flood-fill connecting rooms to create the totally connected graph of rooms
* * If necessary, remove rooms that aren't connected to the main graph. This happens with 1 room in the bottom-right of the GIF.
* Compute a minimum-spanning-tree in order to figure out the fewest number of connections needed to connect all the rooms
* * Remove connections that aren't on the MST. These would be good in a bigger dungeon to add alternative ways to explore, but if you add them to too small a dungeon, there isn't much need to back-track, which makes it feel less "explorey" to me. They also reduce the number of leaf-nodes, which are necessary for the next steps.
* Identify leaf nodes in the MST. These are any room with only 1 connection.
* Randomly select 1 leaf node to be the starting room. This has nothing to do with random room that started the flood-fill.
* Find the furthest leaf-node from the starting room (by straight-line distance; not a perfect measure) to be the finishing room.
* If there is at least 1 more leaf-node that's not the start or finish, put a key in it, and lock the finish room.

Overall, I'm pretty happy with it. Early on, I wasn't using the flood-fill approach to determine valid connections before computing the MST. Instead, I was connecting all rooms to all other rooms that they could reach, and pruning any rooms that had zero neighbors. This almost works, but can result in having 2 or more distinct groups of rooms, that have no connections between them (like "islands"). The MST computation would hang while trying to find a way to connect the distinct islands. An interesting side-effect of using the flood-fill approach is that, sometimes, you can get a very tiny map. Say you have an island of 8 connected rooms, and another island of 2 connected rooms. When I randomly choose a starting point for the flood-fill, it's perfectly valid to choose the 2-room island. The 8 room island will be pruned before the MST is computed, and the resulting level will have 1 starting room, 1 goal, no key, and no other rooms. Thinking out loud, I could add another step to keep track of the islands, determine their sizes, and choose the largest one. That would be some more work, but is definitely doable.
Found a bug?
Tell us on Discord