Enemy movement like in the 80's

Posts: 65
Joined: 2009.03
Post: #1
Being 30 something most of my gaming childhood was in the 80s and I have some great memories of those early games on the Spectrum, Commodore 64 etc. I eventually moved up to the Amiga and used to love Xenon 2:Megablast which was a 2D top down shooter.

My current prototype idea is to make a shooter like Xenon 2. I've built what I feel are the building blocks I need such as the ability to handle Images, SpriteSheets, Animation and TileMaps, but I'm stumped on how to replicate the movement of the enemies from a game like that.

The enemies normally enter the screen following each other but then move around the screen in cool patterns like loop d loops or curvy lines. I've done a lot of googling on this subject and found loads on Cubic B Splines etc but to be honest, the math is beyond me these days Blink

Does anyone have any ideas on how this movement can be achieved or how they did it back in the day. I would not have thought that complex Spline maths would have been used when writing all this stuff in 68000 assembler, but I could be wrong, I'm wondering if there were any tricks they used such as defining a path somehow on the tilemap!!!


Quote this message in a reply
Posts: 4
Joined: 2009.04
Post: #2
When i've done this in the past on old 8-bit machines i used to just store a load of stuff like

uchar repeat 8
char xadd +1
char yxadd +1

So this would make sprite go at 45deg for 8 frames. Quick and cheap, now i would use floats because in the old days we would bit shift the cords so we could move sub pixel vales etc.

Write a quick dirty editor to do the hard work then grab a friend and get em to put loads of lines down.

By using the same line and starting them on diff frames they will follow each other.

Quote this message in a reply
Posts: 65
Joined: 2009.03
Post: #3
Thanks Chris, that makes sense and I can see how with a little editor it would be easy to make up a whole bunch of paths for use in the game.

I was thinking along those lines with the idea of waypoints. I was thinking that you could identify points on screen which each enemy moves towards. When they reach the first waypoint they then move towards the second waypoint etc. Waypoints may have different types as well which could trigger different actions when the enemy/entity reaches them. Enemies/entities would then have the ability to identify the next waypoint for the current pattern and move themselves towards that waypoint.

I was thinking that doing this and introducing a smooth turn from the current waypoint towards the next (not sure how, but thats details Wink ), rather than an instant sharp turn could produce the kind of effect I am after and with relatively few waypoints. The more points the more fancy the movement pattern etc.

I'm not sure if this would work without trying it, but I do like Chris's approach.

If anyone has any more insight on how to achieve those cool patterns from 2D shooters gone my I'm keen to learn.


Quote this message in a reply
Posts: 338
Joined: 2004.07
Post: #4
I used piecewise bezier curves for Laserface Jones, and they worked really well. If I were to extend it, I would use a combination of that plus a state machine and that would probably handle every possible enemy I could conceive. Enemies that follow the path also have a parametric offset (so enemies can follow each other) and a positional offset (so they can fly in formation.)

I'd speculate that the games in the 80s just special-cased every enemy type. Some came with pre-canned velocities, some always moved straight at the player, some traced a sine curve, etc... you can also apply an acceleration to your velocities, no knowledge of splines or curves required, but that will also yield curved shapes.

In the long run, it's worth biting the bullet and learning the more complicated math. Bezier curves are especially easy to visualize.

Justin Ficarrotta
"It is better to be The Man than to work for The Man." - Alexander Seropian
Quote this message in a reply
Posts: 65
Joined: 2009.03
Post: #5
Thanks for the feedback JustinFic. I've just checked out Laserface Jones and was blown away. I would be well chuffed if I came even close to producing something like that and the enemy movement is exactly the kind of thing I'm thinking of.

Have you got any pointers to some good Bezier curve info you've maybe used in the past and did you create an editor for the movement or just code it all using the Bezier Curves.

Again, fantastic job and thanks for you advice.

Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  3d movement jjslay 2 4,760 Jan 17, 2011 04:08 PM
Last Post: jjslay
  Help with touch movement shadow021 1 2,400 Apr 7, 2009 12:19 AM
Last Post: wonza
  Cocos2d enemy classes NialG 4 7,517 Dec 31, 2008 05:07 AM
Last Post: NialG