Sponsored By

The fourth SHMUP demo is available, various ways of moving enemy ships in a SHMUP are discussed, sketches, and a community video.

Michael Grand, Blogger

March 10, 2011

5 Min Read




News

The fourth demo of our test project (a vertical scrolling SHMUP) has been released.  For details, click here.


From the Programmer
Written by Invisible

I spent the majority of last week working on the alien ship's movement.  They needed to enter the screen and then circle around in front of the player's ship, both in an effort to avoid the player's shots and to hit the player's ship with their own projectiles (a moving target is difficult to hit).  There are several ways you can go about this, and it took me a while to both discover those systems and try them out.  These are some of the systems which I found: track, track and spring, move commands, waypoints, and a waypoint track.

Track
With this system, the alien ship would be on a fixed track.  This fixed track would most likely be determined offline by the designer.  The ship has a specific shape which it is following, setting its position to exactly match that shape.  For example, if you wanted the ship to fly down the screen from the top to the bottom, you would use a line beginning at the ship's starting point and ending at the bottom of the screen.  The most useful shapes would probably be lines, line segments, circles, ellipses, and curves.  These shapes could be strung together to make more complicated shapes, and thus more interesting movement patterns.  The disadvantage of this system is that the ship will be very rigid.  For example, you can't knock the ships back when they get hit by a projectile.  This could be solved by using an animation to give the illusion of the ship being knocked back.

Track and Spring
A modification to the track system.  This method attaches the ship to the track with a spring.  The spring fixes the inflexibility issues which the track system had, allowing ships to be knocked back, and jostled around in general.  The spring causes the ship to... Well, spring back to where it is supposed to be.  Unfortunately, this can cause the ship's movement to become too bouncy, flinging the ship back and forth as the track it is on curves this way and that.  This is the system I ultimately decided to use, but I made the springs heavily dampened to prevent excessive bouncing.

Move Commands
With this movement system, you have an AI which controls each alien ship in the same way that the player controls his ship.  The AI examines the state of the game and decides which way the ship should be moved.  Once the AI knows what it wants to do, it sends the appropriate commands to the ship it is controlling, just like the player sends commands to his ship by pressing keys on the keyboard.  This will ideally result in the best possible movement.  The main disadvantage with this system is that the AI can be very difficult to program.  I tried this system, but coding the AI would have been too big of a job for this project.

Waypoints
Each ship has its own list of waypoints.  These waypoints form the shape that the ship should move in, and can be easily updated to reflect changes in the game.  For example, the alien ship can follow the player's ship simply by having its waypoints move along with the player.  The alien ship has its velocity set so that it moves towards its next waypoint.  When that waypoint has been reached, it moves on to the next, and the next, etc.  A waypoint list can either loop around when the end is reached, or load another waypoint list.  Being able to load different waypoint lists makes movement more flexible, and editing the waypoints list in real-time is easier.  This system is flexible enough to allow the ship to be jostled around as much as you want, and it will still make its way towards its target.  The disadvantage to this system is that it forms rather rough and jagged paths.  You can smooth them out by adding more waypoints, but it will be difficult to get it as smooth as it would have been if a track had been used.

Waypoint Track
This is a combination of the track system and the waypoints system.  Basically, you have a waypoints list which contains a single waypoint, and the list is set to loop.  This waypoint is moved along the track as long as the ship is at the waypoint.  I did not get the chance to try this exact system myself, but it seems like a "best of both worlds" solution.  Unlike the track system, this allows the ships to be knocked around.  This also takes advantage of the smoothness which the track system provides.  This could be thought of as a very dampened track and spring system, but you do not need to worry about the high accelerations which are caused by being too far from the track.

I am sure this is not a list of every single option available, but I hope it helps anyone who is currently interested in this.  Another thing to keep in mind when choosing a movement system is how you want the game to feel, and how the ships should act.  If the ship is a scary attack drone, using a very fast speed and the waypoints system would give the effect of sharpness and decisiveness.


Artist's Easel
Drawn by GreyKnight

iScribble Sketches #36

(Click to enlarge)


(Click to enlarge)



Community Spotlight
Written by jaythemage

Another week, another video; Jay has created yet another video showing off the latest SHMUP demo:


If you have anything you would like to say in the next community spotlight article, please post it here.

Read more about:

Blogs
Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like