Alien Blitz 3d: enemy movements, video

Enemy movements

Currently in Alien Blitz enemy movements algorithm is quite easy:

  • A destination is looked far, depending on the monster state it might use a random position, look for the player, flee, or anything else
  • A path to the destination is built, can be a ray cast path (straight line) or A* path finding; the path is composed of all the positions the enemy must move to (every block), it just use 4 directions (no diagonal)
  • Every cycle/update if the movement path is not empty and the enemy is allowed to move (depends on speed) then a point is removed from the path and the enemy is “teleported” there if the point is still a valid destination.

It makes the enemy move in straight line, quite slowly, with robotic movements. I used a few tricks to allow quicker movements, but it’s just quick & dirty tricks.

A recent post on reddit was talking about that kind of things: http://www.reddit.com/r/gamedev/comments/2g6yv6/how_can_i_efficiently_remove_unnecessary_path/

So I’ve decided to try something like that. The first 2 points of the algorithm remain the same, but it changes afterward:

  • The enemy now has a “goal” destination, it will move in this direction according to its speed
  • If a path exists and the previous goal destination has been reached then a point is taken from the path. But this time it will not take the first available point, it will continue browsing the points available in path until it finds a point that is reachable and far enough. Some randomness is also used to just not always pick the farther point every time.

It makes movement more “natural” and now enemy can move in any direction (thanks to 3d it’s easy to just turn the model in the good direction) and all monsters have a slight increase in speed.

This new algorithm uses more cpu (as it needs to do a few raycast on every points to make sure actor can go there without touching a wall) but I don’t need to detail path for every small cubes anymore, so all in all it should be ok.

 

Video

Just a small webm video I made with the new enemy movements and the smoke effects.

I captured the above video using fraps and converting the video afterwards with VLC (it seems encoding messed up video total time), this is way too boring to do (as I need to use Windows for fraps)

I need to find a way to quickly make a webm screencast under Ubuntu, I tried Kazam, but it’s very slow, even if the game is at 60fps and I try to record 30fps, it will lag a lot, sometimes capturing at 5fps, sometimes at 30fps, quite boring.
The other boring thing is that I can’t get a webm video to be easily integrated with WordPress, I always have to manually add the video tag. I tried multiple plugins, nothing seemed to have good results.

Comments are closed.