Posts Tagged ‘physics’

Prose and Motion

Saturday, February 13th, 2010

prose-and-motionA new genre of physics-word-game! Not half as silly as it sounds, give this thoughtful and laid back game a go. Rearrange the letters to form a word. Try to find the perfect word for each level’s particular prose.

Play Prose and Motion now

Update: A few people have been asking what the music is for this game. There are actually three tracks that get seamlessly blended mid-game. It starts mellow, then ramps it up a bit, then ends melancholy. The idea is to shuffle you through various moods reflected in the levels, but at a mostly unconscious level.

Anyway, the music was purchased from the excellent sounddogs.com. Unfortunately the licensing agreement with them means I can’t make them available for download. They’re rather expensive to download just for your own enjoyment too – they’re intended for inclusion in a project like a game or TV production. Anyway, the preview IDs (you can search for these on the site) for the music pieces at Sounddogs are:

1: 729807

2: 405637

3: 559477

Wallace & Gromit: Invention Suspension

Thursday, March 26th, 2009

wallace-and-gromit-invention-suspensionA spiritual sucessor to Hanna in a Choppa, Wallace and Gromit: Invention Suspension sees you helping Gromit to pilot a remote-control chopper to collect parts for their new invention.

Everything about this game is improved over Hanna in a Choppa. The helicopter is better controlled, more stable and stronger. There is even a choice of three differently performing choppers. The graphics are beautiful, the sounds are spot on and the level design continues the trend of making things new and different per level, not harder. There are more achievements to get, and there’s even a highscore table that you can submit your total time to. If you can get within a minute of my 6min 26seconds total, you’re doing really very well. If you liked Hanna in a Choppa, prepare to love this!

Play Wallace & Gromit: Invention Suspension

Hanna in a Choppa

Wednesday, November 5th, 2008

hanna-in-a-choppaCan you help Hanna pilot her chopper through 21 unique and puzzling levels? Use keyboard or mouse controls and fly your way to success.

Play Hanna in a Choppa

Postmortem:

For this game, I didn’t have any external clients. I didn’t have any final goal for it. I didn’t really have much of an initial goal for it. It evolved from almost nothing into something pretty special, almost by itself.

Hanna in a Choppa started life as Hanna on a Hoppa, which was going to be a physics game based on the latest version of my now fairly advanced AS2 physics engine. I’d just given it nice stable flat surfaces to bounce masses off, and they worked an absolute treat. I thought it would be hilariously funny if you played a sort of springy ragdoll called Hanna sat atop a space hopper, bouncing around off all sorts of surfaces and generally causing mayhem. I built the prototype in a short space of time, and discovered that it sucked. Bad. It turns out that space hoppers and physics games go together considerably less well than you might imagine. After fiddling with it for a while, I shelved the idea.

Later, whilst mulling over the name, I thought it’d be amusing to extend the punnage of the Hoppa into all sorts of other things. Hanna in a Choppa seemed like a good one, and I almost immediately had an idea of how to code up the helicopter in the physics engine. I threw a prototype together, and lo and behold it worked a treat.

Initially, the helicopter controls were inspired by an old Amiga game, Zeewolf. That had such an amazing feel to it, I wanted to do something similar, but in 2D. My controls worked and were mightily tactile, but suffered from the mouse wandering off-screen a bit. This is a virtually unsolvable issue in Flash, as you can’t constrain the mouse, but I could at least detect it and auto-pause the game, so it didn’t cause you to crash.

So on I went. I picked a simple in-your-face 2-tone graphical  style mainly because I’m not great at drawing, but partly because it would perform superbly. And partly because it would hide overlapping object errors in the physics! From the cartoonish over the top style came the cartoonish over the top captions and level designs. The project grew and grew until about half the levels were done, and it had enough interface screens to show around to some friends for a bit of playtesting.

Disaster.

Nobody could get the hang of the controls. The beautiful tactile controls that I adored so much, and that I could fly with such finesse. All I wanted was to give that experience of harmony to the world, but nobody got it. Nobody understood. Everyone who tried, ended up stuck upside down in any nook or cranny.

I tweaked those controls. I added sensitivity settings, subtle self-righting, clever damping, non-linear response curves, all sorts. They all damaged the experience for me, and none helped for other people. I caved in and added key controls that drove the same force vectors that the mouse was attached to.

This was better. People could at least fly for a while now. For a while. Without any finesse, and bumping off walls a lot. On the plus side, now people were playing for long enough to appreciate the level design a little more. The fact that you could pick items up with a winch, push them around etc. The way each level presented a different challenge and task, not just a harder set of obsticles to fly through.

But it still wasn’t good enough. People got frustrated and still gave up quickly.

I caved a second time and added the key controls that you can play in-game today. You push right. The chopper flies right. You push up. It goes up. And so on. Finally it was accessable and everyone could play it. I didn’t like the idea of losing the mouse controls though, so kept them in and put the easier keys on an option.

An option that nobody played long enough to find.

So I added a new screen at the start of the game. New players were asked to make one choice – easy key controls, or hard mouse controls. A lot of people selected easy at this point and went on to have a lovely time. A significant number picked hard however, and within 30 seconds of gameplay hated the game. The curious thing here is that they never went into options at this point and changed back to easy. They just quit and went elsewhere.

So eventually, after a little bit of alone-time sobbing, I made the key controls the default. Most players would never go into the options menu and would never even try the trickier mouse option. It was the right choice. For certain. I haven’t read a single comment on the web from someone saying they enjoyed the mouse controls. A few people have commented on how tough it is on the mouse though, but they’ve already played the game enough on keys to not hate it.

Anyway, the game was now more or less complete. A few more levels remained to be built, and a couple of interface screens needed a bit of polish. Next came the love.

I’d been deliberately building love into Hanna in a Choppa as I went along. Little humorous comments and references in the levels seemed to go a long way with the playtesters, so I made sure they were all as amusing as possible. I ensured there was plenty of diversity in the levels, rather than increasing difficulty. That worked a treat too. People would keep playing to see what madness they had to perform next, rather than to improve at the game.

Adding the love was all about increasing the number of those little features that make people smile. So, for the hardcore gamers I added achievements. They announce themselves visibly when you get them, and you’re more or less bound to get a few by accident along the way as some of them are pretty easy (on purpose). Then, when you’ve completed all the levels and are hungry for more, you remember the achievements and hunt around for the screen that shows you what else is available to collect. I made some of them dead easy. Some flippant and silly, and some rock solid hard (like perfecting all levels – flying without touching the walls at all). This meant that people could play to whatever level they fancied. The elite gamers could get everything. Mid-range players could get a fair chunk but miss a few, and amateurs could drop out after beating all the levels. It’s a sort of self-adjusting difficulty curve in a way.

Then there was things like the developer message screen. I find feedback and stats unbelievably useful to get to know how a typical gamer thinks and reacts to things. If I ask for feedback, I know I’ll get a lot of rubbish, but there will be a few gems in there that’ll really teach me something. In Hanna, I made it an achievement to send me a message. Well, gosh, I got a lot of messages! And still get a lot of messages. That’s fine though, and there have indeed been some gems.

The “never press” button was well received too. I thought when I made it that about half the players would like it, thinking it cute, and the other half would think it entirely pointless and rant about it. Not so. Everyone who commented loved it, or apologised for making it cry. It seems people really do like sillyness for sillyness’s sake.

The rich feedback let me summarise the main criticisms against the game. I’ll respond here…

  • It’s a bit slow on my old PC: Yep, fair comment. The physics engine is fairly heavy, and does a lot of mathematics. AS2 isn’t great at this (AS3 is considerably better of course, but I don’t work with it yet). A fairly modern machine should make a sensible framerate, but if it chugs on yours, sorry.
  • There’s no quality settings: I know. That’s because a low quality mode wouldn’t help performance. In most Flash games, rendering all the pretty effects slows down your computer. Hanna has very few pretty effects, but does do lots of codey maths. The Flash quality settings just change things antialiasing, which for Hanna it can do in its sleep.
  • The wench is a bit fidgety: Here’s a dictionary. Work out what you just said to me, then I’ll talk to you.
  • Oh. The winch is a bit fidgety: Ah I see what you mean now. Yes, it is. Sorry. I should have done something about it really, but the physics engine isn’t really up to doing short bits of rope. It’s a totally fair comment.
  • Level 8 is hard to perfect: It is on the crappy key controls, yes. If you learn the mouse like a responsible gamer should, you just flip upside down and throttle towards the fan in complete control. I suppose you’re right though, given all the stuff I wrote about above.
  • Level 19 is hard to perfect: Yep, my fault again. On the mouse it’s a bit easier, but I know you don’t want to hear that. I should have made the survival space a bit bigger really, but that would have added three more physics surfaces to a level that’s already doing rather too much for ideal performance. Compromises were made.
  • Level 20 is impossible: Really? Are you sure? Because I can do it pretty easily. You did remember your chopper has a wench winch installed, right? I mean, you have only been using it for 19 straight levels, so I see how it might slip your mind…
  • All that orange hurts my eyes: Fair comment, hope I haven’t done you any permanant damage.
  • There’s no end of game reward: Actually, there is, but only when you get all the achievements. To be fair you’re right though, I should have added something a little special for when you beat every level. My mistake. Again.
  • Forcing me to write to you is lame: Hey, I wrote you a game for free that entertained you for about an hour! Can’t you write even a couple of kind words back? Bloody ingrates.
  • Can you tell me how to make games? I’m just starting out but I’m 95% done making this amazing RPG but I can’t figure out gotoAndStop: Might I suggest the F1 key in Flash?
  • this game suxxors u suck worst gaim evur 1/1000000000!!!!!!1: Learn to spell, learn to punctuate, learn some respect, create something worthwhile yourself, then we can talk. Thanks.

Lessons:

  • Give creative things room to breathe
  • Don’t get attached to any aspect of your game. If playtesters say a feature sucks, rip it out and put something better in. Just imagine multiplying ‘it sucks’ by all the people who will play your game. That’s a lot of suckage!
  • Anything that turns a player off in the first 30 seconds will ruin your game’s play figures
  • People don’t read instructions
  • That one tiny piece of level design that isn’t quite right yet – FIX IT! Fix it or else. Fix it, or people will moan at you forever more about it
  • Inject love into every corner of your creations. It pays back a thousandfold
  • If you make it an achievement to send you a message, be prepared for hundreds of thousands of messages!
  • Take the time to make the sound-stage work well
  • A surprising number of people don’t know the syntactic difference between a winch, a wench and a wrench! My inbox is pretty comical at times

Skulduggery Quest

Friday, August 22nd, 2008

 

skulduggery-2Register to play the quest, then use cursor keys to walk around and the mouse in mini-games.

Postmortem:

The game consists of four main chunks, tied together into a quest:

Hub: Walk around in a vaguely Zelda-like fashion, exploring and picking stuff up. This is intended as a sort of story-led role-playing-game section that takes you through the other mini games.

Spot the difference: Just the basic spot the difference game transferred to a computer. You get a different puzzle made up each time so it doesn’t become completely trivial to solve if you replay.

skulduggery-1Magic Levitation: A physicsy lift ’em up. Not sure I’ve played anything quite like it before – you have a magical levitation ability that you have to train up until you can chuck the item you need out of the window.

skulduggery-3Cave Exploration: A bit like the old Amiga game Commandos. You have to find the final important game item whilst evading the sight of the guards.

Individually, each mini game is amusing for a bit. The big problem with the game as a whole however is the lack of cohesion. I think this stemmed from a lack of adequate planning in the early stages, leading to a fair bit of making-it-up-as-we-go as the deadline encroached. What we ended up with was a nice enough game engine for an RPG, but with no strong story or other characters to interact with. For a story driven game, having no story sounds like a bit of a deal breaker to me. And if there were a story, having no characters also sounds like a problem!

There’s some neat code running under some of this, despite the lackadaisical gameplay experience.

Hub: Whilst walking around, you can pass both in front and behind most objects. I came up with a method to do this that doesn’t require constantly swapping the depths of everything. There are two copies of the clip that contains all the scenery objects positioned directly at the same spot on screen, with your character sandwiched between them. Each item’s position on screen is compared to the characters. If it is above the character then the back version is set to visible and the front invisible. If below, the other way round. Flash’s _visible property works internally by simply skipping the object when rendering to screen, so its very efficient this way.

I wouldn’t recommend you build a similar system however! There’s a downside (isn’t there always). Whilst it works really fast and reliably with one moving object, if you add any more you can’t guarantee that its possible to sort things still!

Levitation: I’ve been developing a lightweight springs and masses engine for a while now. It was last in use on the Rant game, and before that to do a string effect on Paul Steel’s site. Each iteration the springs get more stable, the masses collide more realistically and the efficiency of the engine improves.

The physics engine grew a couple of features for this game. Attractor and repulsor masses for a start (to do the actual levitation bit). The game worked beautifully with an attractor mass – it was like trying to pick things up with a weak magnetic ball. It wasn’t all that easy to play however so I made it a repulsor following the mouse position instead, and got a lovely floaty feel.

The collision engine got an overhaul too. It now has a concept of collision sets. This is a way of tagging a mass such that it knows not to check for certain types of collision that can’t happen, or even that we don’t want to compute to help the game effects. There’s another major performance enhancement gained from sorting all the masses along the x-axis. The sort routine is built into Flash’s runtime engine and hence almost free in terms of execution time. Most of the Flash built in stuff runs really well, but as soon as you try and do something complex and algorithmic in ActionScript (version 2 and below that is) the inherent sloth of the language’s dynamic style means everything grinds to a halt. Anyhow, after the x-axis sorting, masses are only compared until one is found on an x-position that cannot collide no matter what. This runs in both directions from the mass in question and the search is culled beyond the discovered limits. This gives an impressive performance boost overall, at the expense of a small amount of fidgetyness of masses as they settle (if they sort into a different order after a small movement, they get itterated in a different order for collision responses, which can give a different outcome response).

I’ve made pretty heavy use of Flash 8’s new-ish bitmap processing for graphical effects. Push the light around with your magic, and watch the shadows. Its a subtle effect but the shadows move around depending where the light is coming from. Shadows get longer, fainter and adjust their position all in realtime. This is all done using the new drop-shadow filter on each of the graphical objects in the scene, and a bit of trivial trigonometry. A simple effect, but powerful, and I haven’t seen anyone else doing it yet.

The graphical effect of the magic itself is scripted too, rather than an animation. Particles of magic are placed onto a bitmap each frame, then the bitmap is faded and colour transformed via yet more filter effects. Over multiple frames, moving things leave trails across the screen. Pretty.

Caves: The base engine for the caves section is identical to the hub. I can hear what you’re thinking (if you’re still awake). You’re asking how it can have NPCs wondering around when the system can only cope with depth sorting against one moving object. You weren’t asking that? Well you’re getting the answer anyway.

The NPCs follow a set path. They are at a set depth with respect to the walls etc, and are duplicated in the same way (in fact, they’re just objects in the world like any other). If you pick their path and depth in the scene carefully, you can engineer it so that they don’t look wrong. It just means you can’t have an NPC wander about freely as they can’t walk both behind and in front of an object without causing odd glitches. On the final screen the baddies do laps of an island-wall, which seems to break the engine’s rules again. The trick is that the baddies don’t actually go behind the wall at the top – they just stay above it a little. Look carefully and you might see their shadows glint above the wall rather than behind it.

Visual line of sight ‘vision cones’ were a challenge too. It isn’t all that hard check if a particular point on screen is in sight of another particular point. You just cast a ray between them and see if you hit anything that blocks sight along the way. Or if you have the walls in vector form you can check for collisions mathematically with a line intersection check.

To show a cone of vision however, you have to run the above check for every pixel that might be in sight. That’s generally a hulluvalotta pixels, and infeasible for realtime Flash games.

I’m fairly proud of the technique I invented to get sufficient performance here. I first cast a shadow off the back of each of the wall segments to the edge of the screen. This is done by simply projecting the end points of each segment out plenty of distance and joining the dots. This polygon is then drawn to a memory bitmap with the drawing API and clipped to the visible area. Flash is superb at doing this sort of manipulation as long as the shapes are simple, so there’s only a minimal performance cost here.

Once the shadow of every wall is drawn (as if the enemy in question is a light source), we have a set of pixels that the baddie cannot see. A little bitmap magic to invert this, and we have a mask we can apply to its vision cone drawn complete. Job done – our baddie can’t see through walls anymore.

One nice bonus with this technique is that we get almost free line of sight tests between the baddie and any point on screen. First do a hitTest against the complete vision cone shape. If the test succeeds, do a pixel colour lookup on the mask bitmap at the appropriate point. If that point is within a shadow, we’re out of sight. If not, we’re visible. HitTest and getPixel32 are both lightening fast.

This technique has a few unavoidable downsides. Firstly it uses two large bitmaps for every baddie. This means lots of memory allocation (bad for old machines) and lots of pixel setting (bad for any machine in Flash). Its setting all these pixels every frame that costs most of the time in this routine, even though those pixels aren’t used directly on screen. There is also some kind of bug in the Flash player that leads to rapid memory leakage. Switch screens and you lose a meg or two of memory as the new baddies are generated. You also lose a smaller amount each frame. I eventually traced the leakage to a line that reads;

clip.cacheAsBitmap = true;

Without the line, no memory goes missing. With the line, megs per screen. Doesn’t seem to matter if you turn the caching off later, you still lose the memory. This is something that the Flash player is meant to entirely manage internally, rather than it being the programmer’s responsibility. The same behavior exists on the Mac player too, curiously.

Final lesson learned: On the PC Flash player, Key.isDown(1) is a fine way to read if the left mouse is pressed. Its a fine way to find out nothing at all on the Mac. That’s the first really significant difference I’ve found cross-platform with Flash. A testament to just how well the player is built and tested!

Zotti-Motti

Tuesday, May 13th, 2008

zotti-motti-roomZotti-Motti is the mascot for the Austrian Stadhalle building. I created multiple elements for the website.

Postmortem:

Main room: The hub from where you can navigate to the rest of the site. Click the TV console screen for the platform game, the cards on the bed for the pairs game, the radio for the karaoke and other elements for more stuff like galleries and stories (not generally built by me). Don’t miss stroking Zotti-Motti’s fur with the mouse, and playing with all his dangling toys too. My AS2 physics engine works hard here to create these effects. There are a number of other easter eggs in this room for the observent and inquisitive to find.

zotti-motti-gamePlatform game: Use cursor keys to guide Zotti-Motti through this platform-puzzle game. There are only six levels, but each one is carefully crafted to have unique puzzles and items to solve. The idea was to make the player think around the cartoon physics of the game and use the objects they find to help progress.

I’m really pleased with the way the puzzles in this game turned out. Every level presents something you haven’t seen before, which forces you to keep thinking throughout the game, but doesn’t force a steep difficulty curve on you. A lot of games just get harder, faster and require more skill as you progress. This one forces you to rethink each level, but once you have worked out the solution you should be able to achieve it fairly easily.

I’m also pleased with the way the hint system worked out. If Zotti-Motti gets to an area where he needs an object, he either has it and uses it automatically, or he hasn’t got it and a thought-bubble appears with him pictorially imagining it. For example, he thinks about the ice-skates at the top of the ramp in the picture. If you go on the slope without them, he falls over, doesn’t make the jump and laughs at himself. If you do have the skates, he leaps across and taps the icicles playing a randomly picked tune. The tune opens the door at the top, but the door shuts too fast for you to get there. The idea is that you have to remember the tune then re-play it on the icicles near the door in order to open it (this is as hard as the puzzles get in this game). I tried to think up unusual and imaginative puzzles like that as often as possible, and largely succeeded I think. Each one gives the player a little rewarding pat on the back as it is solved, which helps keep their interest up and makes them feel clever and special for having worked it out. This goes back to my core principle that games should be fun, not difficult. It’s fun to solve puzzles, but it isn’t fun to be beaten up by them. It’s fun to slide down ramps and jump ravines, but it’s not fun if it requires an immense amount of skill to perform.

The platform engine technically took an unusual path in this game. Zotti is a series of square movieclips underneath, as are all the things that can be walked into or stood on. Each square is tested for collisions with Flash’s AABB collision test system; MovieClip.hitTest(clip), which is wonderfully fast compared to testing points against shapes. This also means we can have very free-form levels that aren’t constrained to a grid, and positions can be tuned to the nearest pixel without extra work. Bounding boxes are also pretty big compared to points, and tunnelling through objects becomes a much smaller issue with this technique. All this makes for a considerably more robust platforming experience, even when Zotti-Motti is moving fast with the high-jump ability, or the rollerskates. Robustness is essential in platformers! As soon as the player glitches through a platform, or gets killed by a static wall etc, they’re going to go right off your game.

Baddies in this game are very simple timeline tweens back and fourth over the same area. Their motion is detected and they are set to their idle or walk cycle animations as appropriate.  This works really well as the baddies don’t ever have to react to the player or deviate from their path. It lets you design their actions right there in the Flash IDE where you can see them in place right away.

That’s another principle I developed more on this game. Level design in the Flash IDE. Before, I’ve often had arrays of data that levels are created from, with assets in the library and so on. This works, but is hard work as a development cycle as it is an inherrently non-visual process. It’s led to a few games having too few levels to do them justice too, which is a shame. Far better is to build interractive clips that you can position directly on stage to build up the levels, with all the magic associated with them at runtime automatically. That way, the Flash IDE itself becomes your level design tool, and you get all the power of the editing and animation tools to play with as you go, hopefully leading to better looking and better playing level design.

Lessons:

  • Try to introduce new concepts for the player to tackle each level, rather than just ramping up the difficulty level
  • Building level design tools directly into the Flash IDE is a great idea
  • AABB collisions are a great tool in the right circumstances
  • Everyone loves a cute pink fluffy monster

zotti-motti-pairsPairs game: Nothing too special here. Just the traditional matching pairs game that appears everywhere on the web. This version was based on the Sonic Rush Adventure game I built previously, so you can turn cards over as fast as you like and it keeps track nicely. You also get a little bit of sound when you match a couple of instruments too. It’s a nice little game, but won’t hold your attention for long.

zotti-motti-karaokeKaraoke: The client wanted the Zotti-Motti song to be played on the radio in the room. Easy enough of course. Then they wanted the lyrics to display in time with the music – a little harder. Then they wanted a bouncing ball to run along with the words and syllables, all in perfect time too. Now we’re into the realm of a technical challenge!

I started this the old fashioned hard way, with a sound editor. I added markers manually at each syllable by playing and pausing the sound, and transcribed them into the code to be used as times. It was a horribly slow, error-prone and dull process, and the results were rubbish anyway. I gave up a couple of lines into the song.

The solution was to build a tiny app that played the song and listened for mouse presses. Each time the mouse was pressed, Flash got the millisecond position from the sound object and traced it in the output window. Then, all I had to do was listen along with the song and click along in time with the words – something the human brain is a lot better at than treating each word separately in a sound editor. The times were copied into the code’s data and the results were horrible.

Turns out I don’t have any rhythm.

Luckily, one of the other coders in the office was a musician, and tapped out the timings considerably better, the results of which you can see in the song. If you can stand to listen to the cheesy horror!

Actually, I rather like the girl’s voice in the song. Shame about the male voice. And the song itself!

Lessons:

  • If it feels like you’re doing it the hard way, you are. Rethink your approach
  • Building a very quick rough tool is often faster than tackling the job with the wrong tools (incidentily, this goes for car maintenence and DIY too)

Isabel Bookbinder Outfit Designer

Monday, April 14th, 2008

isabel-bookbinder-outfit-designerUse your mouse to design Isabel Bookbinder a fashionable outfit. You can save it into a gallery for all to see too. Click “outfit designer” to get started.

Dressup toys aren’t the most exciting of things for developers to build. It’s basically a drag+drop mechanism, and a bunch of graphics. That’s normally it. In this case however, I decided to add a little sparkle to the way things moved on screen by integrating my AS2 physics engine into the clothing. When you scroll the wardrobe, the items all dangle and sway in a satisfying manner. Hangers without clothing will rock about considerably more, and items will dangle from the mouse rather than just sticking firmly. It all adds a level of tactility that isn’t present in most dressup games.

Hyperlaunch Xmas Game 2007

Thursday, December 27th, 2007

hyperlaunch-xmas-2007Take control of the reindeer with your left mouse button (hold to go up, release to go down) and try to collect the Hyperlaunch staff members whilst avoiding snow flakes. Get the ever longer chain of staff to the new offices!

At Hyperlaunch it was the tradition to do an online xmas card for our clients each year. In 2007 this was the game I built for the occasion. It makes heavy use of my AS2 physics engine with the gravity set to left, rather than down, to make the chain of collected people string out behind the sleigh realistically (if cartoonishly).

Play Hyperlaunch Xmas 2007

Fred Claus Racing

Wednesday, November 7th, 2007

fred-claus-racingUse the cursor keys to race Santa in this sleigh driving game.  Hit space to use any pickup bonusses you might find, and look out for cheeky shortcuts!

This game makes heavy use of my AS2 physics engine again to simulate the sleigh movements behind the reindeer. You can bash and crash and swing about in quite a fun way!

The tracks left in the snow are worth a mention too. The track is one giant bitmap stored in memory and scrolled around to show the player’s position. The game stores the sleigh’s skids’ start and end points for the current frame and the previous frame, then creates a polygon for each skid around the four stored points. This is then drawn to the main bitmap with blend mode ‘add’. Then it is drawn again, half as bright, with blend mode ‘subtract’ and offset down/right a little. The result is what you see – a permanant skidmark with a bright highlight on the top/left side, and a dark shadow on the bottom/right edge. Because it’s combined into the track as a bitmap effect, it is permanant, and costs nothing in terms of CPU time for a longer skidmark. The only cost is a small amount of work per frame to actually update the bitmap. Because the sleighs slide about in all sorts of directions and rotations, the track width varies and slides about beautifully in response. It’s an effect I haven’t seen done quite as nicely in any other web games.

Dark is Rising

Friday, September 28th, 2007

dark-is-risingA simple physics game as part of a microsite. Collect up the tiles and scatter them into the ring. There’s not a lot of game here, but the physics engine from Rant enhances the tactile feel of collecting and releasing the tiles.

 

Rant

Monday, May 14th, 2007

rantCause the biggest pile-up you can in this quick-hit driving game. Use the cursor keys to race up the road and smash into the junction at the end. The more you hit, the better your score!

Postmortem:

Whilst messing about with an idea I had in my spare time, I ended up creating a basic AS2 physics engine for simulating masses and springs. It turned out to be just what was needed for the Rant game. Each car is two round masses joined together by a spring, with a car graphic pasted over the top. The resulting losenge shape isn’t really much like a car I know, but it is perfectly sufficient for the game as it stands.

Initially, I tried making the cars out of a box made from four masses and six springs holding them in position. This ran considerably slower as the collision detection had that much more work to do, and there were that many more springs to simulate. The results weren’t as good either, with boxes occasionally turning inside out and often wobbling like jelly. The two-mass system worked considerably better and was considerably cheaper on the CPU. All round win!

A typical game of Rant only lasts a few seconds. You race up the road, tap a few cars, get a score then it’s all over. It turned out in playtesting that the trick to making this addictive was to make it really easy to play again. So, spacebar to reset at any point (even before the game is over) was critical. Likewise, there’s no lengthy transition effect before you’re back in control. In fact, there’s not even a brief half-second transition – I found that it annoyed people to wait even for that when you can replay so rapidly.

Another way to reduce user friction was to store their high-score in their Flash Shared Object. I found that people got into a routine of restarting rapidly, and sometimes did so when they had a highscore by accident. Rather than lose the chance to submit it, I allow them to submit it at any point in the future after a game too. The highscore table automatically allows just one entry per person, so there’s no chance of one person filling the table when they’ve achieved a top score.

Ultimately, Rant is a game of luck. If you’re lucky, you can hit all three of the randomly placed speed boosts, catch a few cars just right on the junction itself and hit lots of parked cars for that magical score. The game keys into that ‘one more go’ trap that we’re all succeptible to, and a little bit into the semi-gambling gene that makes us play dice games like Yahtzee, even when there’s nothing other than a highscore at stake.

Lessons

  • Very short games can increase replayability and addiction, since people don’t have to invest much time in each go
  • … as long as there’s very little friction before playing again
  • When simulating physical objects, go for the simplest underlying representation that will suffice
  • You don’t always need a lot of gameplay to generate addiction