Auto-Miner now playable!


PROCJAM 2020 comes to a close, and this week I was able to make something actually more ambitious than I was expecting. My submission is called Auto-Miner, a game where you deploy and upgrade mining robots who explore caves to find gems. The caves are procedurally generated as they are explored. 

I plan to go more in depth about the generation method in a video, but basically the way it works is this:

To build each room, I pick a center point, and from there, I pick a distance randomly within a range and go out that far to pick the first corner. I then rotate a random number of degrees and choose another distance from the center to create the next point, I repeat until I've gone full circle. Then I can go up a random height, create another set of points, and then fill it in with triangles to create a prism-shaped room.

Each wall can have any number of holes. Each hole has a horizontal and vertical minimum and maximum. Using all these mins and maxes on the holes, I can divide the wall into a series of squares and decide if each square gets rendered if it falls between a hole's mins and maxes.

Each tunnel goes out a certain distance (with a random offset that angles it to the side and/or vertically) and then picks a random room size and sees if there is room for the room. If there is already a room in the new room's room, then it will cast a ray from that room toward the tunnel entrance to see if it can connect to a new hole on the other side. If there no existing room, it will simple build the tunnel and new room. If there is an existing  room, but it cannot be connected to, or if there is space for a new room, but it cannot be reach (i.e. there is another tunnel in the way), then it will simply put a dead end right before it collides.

The number of gems in each room depends on the size of the room. The value of each gem is chosen by perlin noise lookup. This means it is on a gradient. So if you start going a certain direction, and the value of gems starts to rise, it is a good idea to continue digging that direction, because the gradient may continue sloping upward. The rarest gems appear in pockets, and are surrounded by slightly less rare gems.

Because the room corners are chosen by rotating a point around the center, all areas of the room are visible from the center. This lets me take a shortcut in pathfinding. The center of the room becomes a hub waypoint for the robots, and is adjacent to all the tunnel entrances and the gems. When the robots move, they always pass through the center of the room so they can safely avoid walls. Not the most efficient path, but at least it is reliable. The robots choose places to dig by rotating by a random angle and then driving forward. When they hit the wall, they try digging. If they cannot, or if they dead end, they return to the center. After so many attempts, they give up and choose a random existing tunnel to travel down and to try a different room. It is essentially a random walk, but details in their behavior can be modified  through an in-game upgrade system.

I'm not sure if my explanation makes sense yet without the visuals, but if you play the game, you'll probably see what I mean. Anyway, I hope you enjoy it. There's still more I'd like to add to it, but it was more than I thought I'd be able to get to in just a week.

Files

Auto-Miner.zip 32 MB
Dec 13, 2020

Get Auto-Miner

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.