Buy It

It's out.




Latest Trailer

Throw a wrench, change the galaxy.




Screenshots

Mostly nebulae.



Platforms

Windows, dunno about others



Team

Design, Code, Writing

Tom Francis

Art

John Roberts

Code

John Winder

Music

John Halpart

Chris Harvey

Site

Tom Francis

John Roberts

Mailing List

Get on our mailing list so we can tell you when we release a new game.

Twitter

We're @HeatSig on there.

Improving Heat Signature’s Randomly Generated Ships, Inside And Out

I started making Heat Signature mainly to figure out if the mechanics would be as fun as they seemed in my head, so I built all its systems in the cheapest, fastest, simplest possible way. That worked – it’s now got to the point where I’m laughing out loud at something ridiculous happening most times I play.

But the slapdash way I built it has the following problems:

  • All collision checks, including guards checking whether they can see the player, are being done on a per-pixel basis. That means the game slows down a lot if there are many guards.
  • Pathfinding is done ahead of time, meaning each ship calculates all possible routes within it every time its floorplan changes. For very large ships, that causes slowdown when a missile takes a chunk out of it.
  • When things on a ship move or are created, they don’t have a good way of making sure they end up fixed in the right position on the ship, leading to lots of very tricky to diagnose bugs where airlocks appear in the wrong place and won’t let you inside.

Heat Signature Airlock Problemns

The Rewrite

All of these systems need a total rewrite, and I know how to make each one massively faster and more reliable now that I’ve had some experience with how they’ll be used. I’ve been working with the bad code for so long that I’m actually really excited to rip this awful shit out and make it all clean, fast and efficient.

But I’m also aware that this means it will look like exactly the same game until I finish all three rewrites, which might be a while. So while I’m at it, I’m making some of the more superficial tweaks I’ve been planning, just to make the game feel fresh on the outside too. And the first of these are tweaks to the way ships randomly generate their interior floorplans.

The Old Floor Plan Generator

I talked about how I built that system at the time, and it’s really simple:

  1. All modules in a row have doors leading to each other
  2. If there’s a row behind this one, one module in this row has a door leading to it
  3. If a module has exactly two doors and they’re in a straight line, it’s a corridor. Otherwise, it’s a room.

That generates interiors that look like this:

Heat Signature Corridors

I was pretty pleased with this! From only three rules, it makes sure every module is used, every corridor leads to a room, and there’s a path from every module to every other, but it’s usually not trivial. Despite being simple, the pattern didn’t seem to be obvious – to me or others. I posted a shot on Twitter and asked people to figure out the rules – no-one got them right.

Its main shortcomings were:

  • There are a lot of rooms, as opposed to corridors. Rooms obfuscate connections: it’s harder to see at a glance which ones are connected and which are blocked, which can make the layout visually boring even when it’s mechanically interesting.
  • It’s usually not mechanically interesting either. The fact that there’s only one logical route between any two rooms will probably be too boring and restrictive once we have more of the on-board game elements in, like sealed doors and hacking.
The New Floor Plan Generator

So I made a few tweaks, and the new system generates stuff like this:

Heat Signature Floorplan Tweaked

How much you get out of this image might depend on how much you care about corridors, but I am fascinated by it. It’s so much more intricate, organic and complex than the rules I added seemed – I look at it and think “Wait, I didn’t tell you how to do that!” But evidently I did. Again, I think it has good Rule Stealth: the rules are right there on display, but I don’t think you’d guess what they were, right? If you want to try, do so before clicking this:

Click to show the new rules

The Interesting Bit

The bits that surprise me are bits like this:

Heat Signature Floorplan Isolated Room

How did it know to build a corridor branching off from a lengthwise passageway to lead to this out-of-the-way room?! My algorithm builds the ship one lateral row at a time, and each one has no idea what was in the last one. This makes it look like whoever built the ship planned ahead to make sure there was a corridor leading to this otherwise isolated room.

The Explanation

I get it, of course: three modules in a row all decided to make a door to the previous row, which meant all of them could block themselves off from each other laterally. And in the row it made afterwards, the middle module failed the chance to create a door leading back, so the room behind it was left with only one connection. And being a dead end, it became a room rather than a corridor.

The fact that it’s reachable is not luck, it’s a result of some logic I intentionally put into rule 3: we’re only allowed to block ourselves off from the rest of the row if we know the rest of the row also has a back-door. That way we can still get to them by going back one row.

But what if there’s a lateral block there too? Well, they’ll only create one if they, too, have doors on either side of the block leading backwards. What about the row behind that? Same rule, all the way to the very back row of the ship, which will never create a lateral block because it’ll never have two back-doors – it won’t have any.

Heat Signature Floorplan Isolated Room

Imaginary Intentions

But it’s so interesting how much intentionality I can read in to the result of these rules. It looks so much like they isolated this room for a reason, and built that corner corridor to lead to it. And that adds meaning and character to whatever we put there.

Once the room types are in, that might end up being a cargo hold with a locked door and valuable loot in it. Clearly, it’s isolated by these thick sturdy walls for security reasons.

But random is random, so it could just as easily end up being living quarters. Now the isolation looks like privacy: maybe they don’t want to be kept up by ship noises. Or it could be a bathroom, and they don’t want sound to travel for other reasons.

That’s why this new system fascinates me. It seems to create intentionality out of algorithms, and the more stuff I put into the game for it to combine with, the more unexpected combinations will come out.

Heat Signature Floorplans 2

More ,

Jordan:

Very interesting! Well done!

James:

Looking great Tom! If you’d like to offload the more meaty AI and procedural generation programming to focus on other aspects I’d love to help.

Marc Forrester:

It can actually be a good thing if pathfinding takes place over multiple frames – I’d expect the crew to hesitate for a second or two as their ship breaks in half around them.

Tom Francis:

Yeah, I might actually have the crew not change their path until the one they’re on unexpectedly leads them to a dead end.

James:

One way of implementing that would be to have each crew member maintain their own beliefs about the structure of the ship that they use for A*. When they encounter a missing room they update their beliefs and search for a new path, and when encountering other crew members they exchange beliefs as if they were communicating with each other.

The same exchangeable beliefs system can be used for things like awareness of where the player was last sighted, location of items the AI can use, and position of other crew members they can run to for safety when panicked. This opens up plenty of possibilities for the player to exploit the AI’s partial awareness of the environment when preparing ambushes or trying to avoid detection.

I’ve implemented something similar in one of my projects, and with relatively little effort the agents would exhibit surprising emergent behaviours that give the illusion of intentionality, just like in your level generation algorithm.

Some extra reading: http://en.wikipedia.org/wiki/Belief%E2%80%93desire%E2%80%93intention_software_model

DrD:

Curious, are you already using the yoyo compiler in Game Maker?

Woodwald:

The new generator is really nicer. Everything feels a lot more intentional, as you put it. The only thing that still bug me a little bit are the short corridor loops you can see on the last picture. It somehow doesn’t feel right. Anyway, nice update.
(Also first post, love gunpoint, love the blog)

Connor:

It think it would be great that if an enemy sees you, he will either attack you, or he’ll go and tell someone else that he saw you. That’s the problem with alot of games I play, it doesn’t make sense that all of the enemies know of your presence.

Tom Francis:

DrD: I’ve tried it, but since it’s only compatible with Windows, I can’t rely on its performance gains or Mac & Linux users will be screwed.

Luckily Heat Signature’s performance is easy to scale: when there are more than X ship modules being simulated, it picks the most distant ship that the player has never interacted with and stops simulating it.

So X can be set to whatever value causes the game to chug. With the old, inefficient systems, it’s about 300 modules. With the new one it should be a lot more. And either way, I can add it as a menu option so people can crank the simulation as high as they like. If YoYo Compiler is compatible enough to use as the default Windows version, I could set the default higher there.

(You’ll also be able to put a tracker on a ship to keep it tracked however far away it goes)

DrD:

Something I stumbled upon as well, not sure if it can be done using the shaders module in GM but there is a blog entry that uses WebGL for pathfinding, thus leveraging the GPU for processing. I would think the same could be done with OpenGL ES. http://nullprogram.com/blog/2014/06/22/

Snowskeeper:

I saw that isolated room and immediately thought “biological organism containment area.” Is there any chance that a ship you attack might be transporting something alive and dangerous, like a Space Rhinoceros or virus of some sort? This is one of those silly Hey If You Have Time things, but retrieving a bio-weapon for one of the factions could allow them to attempt to deploy it into an enemy space station and effectively destroy it.

Diego:

I’m in a similar situation, working on a game with terrible and highly complex code. Although your tweet made me laugh out loud it wasn’t very motivational lol

Anonymous:

I just wanted to let you know I love supporting game developers like yourself. You built a great game, offered a demo, kept the price reasonable. Good on you =)

Teaching Heat Signature’s Ship Generator To Think In Sectors - a post on the Heat Signature site:

[…] haven’t talked about the way I randomly generate spaceships in Heat Signature since this post – before it even had actual art. That’s partly because I’ve barely touched it […]