Last weekend was a particularly busy one for me. I ran two kids programming clubs on the Saturday so I really couldn’t get any enthusiasm to start until Sunday.
Unusually, I hit on an idea for the theme quickly. I’ve been doing a lot of physics simulation work recently and I thought this would be a good chance to try modelling buoyancy in a game.
Most of my effort at the beginning went in to creating the physics model. If you look inside the project, you’ll see a lot of the variables required to get this working such as the mass of the helium, the balloon itself, and the displaced volume of air. Of course all this only served to produce the final upward force which gets bigger as the balloon inflates.
The results were unexpected (to me at least.) It seems that far from giving the balloon a gentle lift, inflating by only the tiniest amount caused it to shoot up like a rocket. To make it controllable at all, I had the reduce the inflation speed to about 1/10th of a millimetre radius per second.
This tiny change meant no real visible difference between a buoyant balloon and a sinking one. So to exaggerate the effect, I actually scale the visible representation of the difference in radius of the balloon by 10,000 times. Other than that it does represent relatively realistic physics.
- But I did make a number of simplifications:
- I assume a sphere rather than a balloon’s actual shape;
- the mass of helium doesn’t account for the raised pressure inside the balloon;
- there is no consideration of air resistance or air pressure related effects.
Time was getting on, so I moved on to modelling the bird animations. The individual frames of animation are all hand drawn using Scratch’s built in drawing tools. These tools are crude, but they do the job. As reference I found a sequence of photographs online showing the various frames of a crow in flight. I was pleased with the final animation.
I later added the highlight to the beak to help with collision. (The balloon only collides with the beak, you don’t have to avoid them entirely.)
I was particularly pleased with the generation of the sound effects. My first thought was to get hold of some balloons and record some samples. It turned out to be difficult finding anywhere selling packs of balloons on a Sunday afternoon. But although I did eventually find and buy a packet, when it came to making the sound effects, I decided to give JFXR a try to see if I could synthesize the sounds I wanted. It turned out I could. More or less. But then… disaster! I had been working on a MacBook in Safari and there is a long term problem exporting audio. I soaked up several hours trying desperately to find a work around. In the end, I downloaded Firefox, remade the sounds, and then exported them from there.
By then, time was running short. I quickly put together a small audio loop for stage introduction in Otomata and rushed to get everything together before the deadline.
In summary, I wish I’d spent more time on creating and tweaking assets and less time dealing with technical issues and balloon shopping, but such is life in game development. I am pleased with the results.