The way Heat Signature randomly generates its ships at the moment is very basic – I’m new to random generation, and I don’t polish or improve things until all the other systems are in.
Its process for the ship’s shapes is probably obvious from the video:
- Pick a random ‘length’ in ship modules
- That many times:
- Pick a random ‘width’ for this row
- Generate that many modules
- Center them along the ship’s middle
So they’re all symmetrical, and contain no gaps, holes or curves – conventional. You still get some interesting oddities – like the rare very wide ship that’s only one module long – but the pattern is pretty obvious.
For the layout of the internal rooms and corridors, I tried the same approach: just the simplest thing I could think of that would always work. But I think it’s harder to see the pattern in the results. Even knowing the rules, I still find layouts that surprise me.
Curious about this, I asked from the game’s Twitter account if anyone could guess what the rules were from the video. I got lots of good suggestions, and one or two got an individual rule right, but none that I saw got the whole process. Here’s what it does:
- When building a row, always add a doorway to the next module in the row.
- Pick a random module position in this row that’s not empty in the next row, and make a doorway between the two.
- If a module connects exactly two modules in a straight line, it’s a corridor. Otherwise, it’s a room.
This ensures every room is connected to every other room, so it’s never impossible to get somewhere, but also makes it unlikely that the route will be direct. It makes a lot of wildly unrealistic corridor layouts, but I was surprised at how varied they felt.
I didn’t plan it this way, but it’s also quite similar to a Spelunky level laid down flat: a Spelunky level is a series of floors made up of chunks, and a randomly selected chunk will lead down to the next floor. It doesn’t guarantee every chunk is connected to every other, though, only the ‘leading down’ chunks.
I’ll change this a fair bit as I go – once guards are harder to get past, and there’s more incentive for stealth, I’ll open up multiple routes between rooms to give you more options.
I’ll also make the ship generation itself more varied, possibly by faction. At the very least I want ‘junk’ type ships that are cobbled together from old wrecks and not at all symmetrical. It’d also be interesting to have a type that are rotationally symmetric, or have a width-wise axis of symmetry instead. And I can vary module width and length independently, which’ll change the whole shape, look and feel both inside and out.
But it’s not worth tinkering with that stuff yet – after IndieCade, my next job will be to put ship systems in, so that rooms relate to ship capabilities and you can sabotage them. Once ship functions are tied to their layouts, there may be implications for ship generation I haven’t seen coming. More importantly, it’ll be a lot more fun to mess around with.