Hoth Strike – AI modifications

The latest upload of Hoth Strike contains some AI changes. I had wanted to present a game where the player deals with varying alien behaviour. Up until last night much of the behaviour was predictable and samey so I decided to revisit it.

probe_0_1The probe is essentially the probe from the movie. I loved the dangly leg thing that was going on in that so it made sense to base it closer to the ground. I set the threshold to be about 3 probe heights from the base of the canvas. Better still I wanted it whizzing around like a probe on a mission. i.e. sniffing out rebel pilots. So I set a couple of new properties .floatdir, .upthresh, .downthresh.

Each of these new properties controls which way the probe is floating by way of a modification to the alienmove() function. The code sniffs for the sprite class and if it’s “probe” performs the modification. A floatdir of 0 sends the probe floating up and a floatdir of 4 sends the probe downwards. Better still I modified the speed of the probe and set it off at pace as it changed direction finally slowing down to almost a stand still before it flicks back the other way. The result is satisfying and from a player’s perspective a wee bit trickier to hit with the lasers. I’m happy with it since it ought to be close to the ground and now it is.

pod_0_1 I also modified the pods (the pink energy balls) and had them track the player a bit more by way of a simple modification based on tileDirection. They appear to linger a bit more now rather than just zip off as they did before.

mutant_0_1Finally I addressed the mutant. Defender’s mutants were horrible wobbly things that were a complete swine to hit. I wanted something similar so I modified the alienmove() function once again for spriteclass “mutant” and simply wobbled the sprite in a random direction by a random small amount.

I also added a special effect in the form of spawnSnow() which as you might gather spawns a snow flake. I perform this every time the probe or the player is in close proximity to the ground. The effect being that such close proximity would probably throw some snow up in the air. It’s particularly satisfying as you swing the speeder around !

Just now I have an issue with waves not ending properly. You could wipe out the bad guys and have rescued all the rebels but the wave would not terminate. It’s a checksum issue and something I’m looking at.

You can play the latest game here:

Post a comment or leave a trackback: Trackback URL.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: