Skip to main content
GameDev.net gamedev.net
🔒 Locked

Movement patterns

Started by H_Lowemark Apr 24, 2004 at 3:12 AM 3 replies 1k views
Original Post
H_Lowemark
H_Lowemark
Hello. I''m creating a type of classic space shoot em up (think gradius, ikaruga etc..) and having some problems on figuring out how to create the enemy space ships movement. What I''m trying to do is to figure out a good way to represent how a group of enemy ships will move on the screen. For example: say that i want to have one type of enemy ships that will move in a certain way, first going down the screen a bit and then go arround in a circle then finaly go down the screen again and at the same time have a different type of enemy ships go from the side of the screen in some cool pattern... How do i do this in some easy way.. I was thinking about storing the movement in a text file and then read that and assign movement that way but have really no idea how to go about doing this... Any tips, hints or pointers are welcome
Agony
Agony
Bezier curves might be a good place to start. They''ll allow you to simply specify a set of points that the ships should approximately follow. Depending on how you implement them, you could make it so that they go exactly through your set of control points, and follow the angles that you specify at each control point. Regulating the speed (or even handling full stops) might be a bit more complicated, but still doable. But basic bezier curves are really quite simple, especially compared to other types of splines (NURBS, B-Splines, natrual cubic splines, etc.). Hopefully that''ll give you a good beginning point to look into.


Most of the greatest evils that man has inflicted upon man have come through people feeling quite certain about something which, in fact, was false.

-Bertrand Russell, Unpopular Essays, "Ideas That Have Harmed Mankind"
"We should have a great fewer disputes in the world if words were taken for what they are, the signs of our ideas nly, and not for things themselves." - John Locke o
Onemind
Onemind
Bezier curves are overkill for AI. Instead, just give each enemy ship a velocity, and change that velocity once every couple of seconds.

For example, lets say you''ve got a quick, small ship that you would like to dart around the screen. You would set his velocity higher than the other ships, and presdo, he would dart around the screen. You could take this idea one step further, and only allow the ship to move stright ahead, or at a 45 degree angle (which would make him cover more screen space).
X-0ut
X-0ut
I prefer Agony''s approach, you can make much more specific attack formations and avoiding geometry is handled too.
Another allternative is to capture imput and record the movement patterns yourself via joystick/mouse/keyboard/whatever!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.