Bugs. Every game has them. Hopefully every release doesn’t have too many, but they exist in every form of software – no matter how big or small. While work continues on the Fringe Planet UI and we finish up a new gameplay feature which isn’t quite ready for a blog post, we thought we would take a look at some of our favourite bugs we have encountered while developing Fringe Planet. As Fringe Planet is a simulation game that aims to model real life, the bugs can be quite hilarious. (Some of these screenshots are very old, so beware the quality!)
5. Peon sleeping habits
After initially adding beds to the game, we taught the peons that a good way of restoring their energy was to go and have a nap in a bed. During development we would test this with a single peon and a single bed. The peon would consume it’s energy doing it’s various tasks, and when it got tired (energy falling below a certain threshold) it would seek the closest bed and fall asleep. This worked exactly as expected – however, we forgot to add a check to see if the bed was empty before the peon decided that it wanted to sleep on a bed.
4. Peons and body image
There is a complex set of behaviours that covers peon movement around the world of Fringe Planet. We use a multi-grid A* algorithm to help peons navigate around the 3d environment. We also use an agent based simulation that detects if peons will collide with each other in the next few seconds, and alter any chosen paths to avoid collisions. The path finding is fast, quick and efficient. However, when we implemented the new peon models (previously they had all been just been green capsules floating around a bright grey voxel landscape) we ran into a very strange problem. Peons were bumping into each other, peons were unable to path through gaps they should clearly be able to get through and falling off very wide bridges. Nothing in our code would explain this behaviour (a peon should be able to easily fit through a 2x1x1 voxel gap). It was then we discovered that we had turned off collision debug shapes in the unity editor display and when we viewed the models, we discovered that they had a huge collision capsule around them. Though all the code was working exactly as expected, the peons had this huge invisible collision capsule that was causing the physical simulation to do some very strange things. After putting the peons on a diet (i.e. shrinking this capsule to actually match the size of the peon) everything started working as expected!
3. Doing the same thing over and over and expecting different results
Very early on in development, we taught the peons how to mine. It was a simple thing to do, mark a voxel, a peon would go up to it – mine it and get the resources that were contained inside that voxel. However, when testing, we found a peculiar bug. We spawned a single voxel thick bridge in the air, and we were using this to test path finding (knocking out single blocks to create a maze of pathways). However, peons seemed to be acting incredibly stupidly when it came to mining. We would designate a voxel to be mined, a peon would walk up to it, mine it, fall through the hole and then go back to the start of the bridge and attempt to mine it again, falling back through the hole over and over again. It was utterly bizarre to watch as every time the peon went to the hole, the mining animation would play, it would fall down and loop around again. As some of you may have played voxel based games where mining straight down is a big nono, you may see where this is heading. When the voxel was designated, a task is created and added to a task list. The peons will then select a task from this list and try to complete it (rejecting it if it is impossible). The peon was going to the location of this task, and mining directly downward, then falling through the hole it had just created. By the time the peon thought about the task again, it had fallen under where the task should be, therefore peon logic dictated that the task hadn’t been completed. So the peon would happily go back to where the task was and attempt to complete it again, falling through the hole straight away, and once again realising that it needed to go back to the task location and try again. Needless to say, we tightened this logic up somewhat.
2. Things are getting hot in here
Fringe Planet has quite a complex temperature simulation occurring behind the scenes. Creatures create heat, voxels store and transmit warmth, furniture gets hot and cold depending on where it placed. Snow melts when it’s hot, and gathers where it is cold. Fires give off heat, wind moves it. It’s a core facet of game play and a constant struggle to keep your peons warm. With an early version of the temperature simulation, the game would start with three peons gathered around a fire and a storage chest next to it in a little camp. This allowed the peons to keep warm and have a place to store resources they would gather. However while tweaking the temperature simulation, whenever we would start the game, we discovered that the snow had vanished completely (Fringe Planet looks vaguely tropical when all the snow is removed). We checked to see if the snow rendering engine was working, by trying to spawn snow – and nothing happened. We turned on the environmental system that simulates the snow, we saw the snow particles falling, but no snow was appearing. We checked that we hadn’t deleted snow related textures. We checked the unity scene editor, and the draw calls to check that snow hadn’t stopped rendering for some reason. Nothing could explain why the snow wasn’t showing. Then we checked the temperature sim and found our issue. Due to a bug, every single voxel in the game had an internal temperature of over 2.1 billion degrees. The snow rendering system was working fine – the problem was that the moment it landed on a voxel it would melt (well vaporize we’d imagine). And as this happened within 1 frame of 60 a second, we didn’t see it happen.
1. Peons slowing down
Peons consume food, and turn it into energy. A peon’s speed is determined by it’s agility and strength and how much weight it was carrying. We ran into a situation early in the development where peons would seem to slow down, and eventually stop moving altogether. The FPS didn’t drop and we could monitor what was happening in the peon’s brain, so we knew it wasn’t something giving them brain freeze. We had no idea what was causing the problem. It would only occur after a few (in game) days of play and seemed to strike all the peons at once. We checked for memory leaks, pondered if certain tasks were impossible. We made the peons incredibly happy (via a debugger) in case it was an unforeseen side effect of some recently added code to model depression. After several frustrating hours of debugging, we suddenly noticed that peons were weighing several thousand kilograms. And suddenly the problem dawned on us – the peons were consuming food, and turning it into waste products, but we hadn’t coded any behaviours or system to remove that waste material – meaning the peons were literally filling up internally and were unable to move due to the weight of all the waste products inside them.
0. The terror in the night
And finally, though not a bug, an honourable mention must go to the terrifying emergent behaviour of ManyEyes creature. This bug like creature infests Fringe Planet rapidly, gathering organic material and crushing it between it’s many legs before it sucks the goo up via it’s tendrils. It’s a disgusting creature – but not inherently dangerous to a peon – imagine a miniature poodle sized cockroach. Peons find them disgusting and try and avoid them. ManyEyes distrust everything (as they are on the bottom of the food chain) and try to avoid anything that moves. However, ManyEyes do enjoy the warmth, and will try and find warm places to rest. As such they naturally tend to be nocturnal – racing around and exploring when the peons are sleeping. A peon (like all creatures in the game) gives out a certain level of heat constantly, and actually can become quite warm when they are tucked up in bed. Also, while a peon is sleeping – they aren’t actually moving. This lead to the quite terrifying behaviour that ManyEyes started cuddling up to sleeping peons during the night. And due to the hive behaviour of this disgusting insect, it meant that it wouldn’t just be a single ManyEyes that would do it – an entire nest of ManyEyes may decide to cuddle up to a peon while it sleeps obviously. Which lead to some very terrified peons waking in the morning covered in giant insects.
There is a lot more to read about Fringe Planet… why not try: