Galaxian
I know the game is old, but I am wondering what kind of algorithm was used to make the enemy ships fly the different attack patterns. How was the flight path info stored, etc?
Marcus
I don''t know how it was done, but I can suggest I valid way which I might go about it.
I''d have a linked list (or similar data structure) of points describing the path of which the enemy will follow. Then, I''d have my ships transverse through a list of positions by moving directly towards each point one after the other. Depending on what the type of ship is, you might like to assign different paths (standard to that type of game).
I''d also have it that the paths are static (ie the level designer lays them down), and when creating enemy ships merely deploy them at the starting point of their path (which should be off-screen) and then, if they have not been shot down, destroy them when they have finished their path and reached their end point (off-screen).
I shall now remind you that this is how I might do it (although I have just thought of this on the fly), but it may not necessarily the best way to go about it. This is not exactly AI. AI is about making dynamic decisions, of which the technique described does not.
To make your enemies smarter, you might like to have them strafe sideways and/or backwards when they come under fire, and then return to their next point when the have the opportunity. I personally can''t see that many AI possibilities in a game like such, though.
I''d have a linked list (or similar data structure) of points describing the path of which the enemy will follow. Then, I''d have my ships transverse through a list of positions by moving directly towards each point one after the other. Depending on what the type of ship is, you might like to assign different paths (standard to that type of game).
I''d also have it that the paths are static (ie the level designer lays them down), and when creating enemy ships merely deploy them at the starting point of their path (which should be off-screen) and then, if they have not been shot down, destroy them when they have finished their path and reached their end point (off-screen).
I shall now remind you that this is how I might do it (although I have just thought of this on the fly), but it may not necessarily the best way to go about it. This is not exactly AI. AI is about making dynamic decisions, of which the technique described does not.
To make your enemies smarter, you might like to have them strafe sideways and/or backwards when they come under fire, and then return to their next point when the have the opportunity. I personally can''t see that many AI possibilities in a game like such, though.
-----------Autumn Fog - A 2D Action Wargame
I was thinking about this one recently myself. I, too, have never implemented this sort of AI but I''m thinking of making a Galaga clone.
The predefined flight paths I think is a great idea for the bonus levels where the player tries to take out as many enemies as possible. But for the standard levels it may become too predictable. My thoughts were identify squadrons which would dive a periodic intervals and calculate a bezier curve between their position and the player. The squadron would then follow the bezier.
Again, this might be too predictable. A more advanced version would provide each enemy with an individual AI and let it run autonomously. During the dive it could adjust its flight path in process. Something similar to Mat Bucland''s Lunar Lander demo from his book "AI Techniques for Game Programming." A little fuzziness would help to control the skill level of the enemy.
-Kirk
The predefined flight paths I think is a great idea for the bonus levels where the player tries to take out as many enemies as possible. But for the standard levels it may become too predictable. My thoughts were identify squadrons which would dive a periodic intervals and calculate a bezier curve between their position and the player. The squadron would then follow the bezier.
Again, this might be too predictable. A more advanced version would provide each enemy with an individual AI and let it run autonomously. During the dive it could adjust its flight path in process. Something similar to Mat Bucland''s Lunar Lander demo from his book "AI Techniques for Game Programming." A little fuzziness would help to control the skill level of the enemy.
-Kirk
you may perhaps store each type of enemy in it''s own derived class with each enemy type having it''s on behavior patterns (and perhaps they all look the same to the player, but are differentiated by their behavior)
Behaviors might dictate a path which is really just a simple math formala or loop to produce a "flight pattern". Since the behavior in this case is just a formula, it could easily be modded with variables to produce behavioral variations.
Lets say a guy flies in a spiral. You could modify the speed of the movement and the spread of the spiral. If he moves in circles, you could vary the radius and the number of times around the loop before flying off.
that sort of thing.
Behaviors might dictate a path which is really just a simple math formala or loop to produce a "flight pattern". Since the behavior in this case is just a formula, it could easily be modded with variables to produce behavioral variations.
Lets say a guy flies in a spiral. You could modify the speed of the movement and the spread of the spiral. If he moves in circles, you could vary the radius and the number of times around the loop before flying off.
that sort of thing.
quote:
Original post by kirkd
I was thinking about this one recently myself. I, too, have never implemented this sort of AI but I''m thinking of making a Galaga clone.
The predefined flight paths I think is a great idea for the bonus levels where the player tries to take out as many enemies as possible. But for the standard levels it may become too predictable. My thoughts were identify squadrons which would dive a periodic intervals and calculate a bezier curve between their position and the player. The squadron would then follow the bezier.
Again, this might be too predictable. A more advanced version would provide each enemy with an individual AI and let it run autonomously. During the dive it could adjust its flight path in process. Something similar to Mat Bucland''s Lunar Lander demo from his book "AI Techniques for Game Programming." A little fuzziness would help to control the skill level of the enemy.
-Kirk
If you want to write a Galaga clone, then predicitability is what you want. Those early games were EXTREMELY predictable about the paths they chose. The little fly guys always came in 2 or 3 distinct paths, the bees did too, as well as the guys that sucked yer ship up...
You could use that predictability, however, to your advantage by throwing in very small chances of altered paths. You can make the player relax his brain to not worry about unknown occurences. The last 1000 times a bee guy came down he went left or right... but Now, he is going zig-zag and shooting twice as fast... That can really mess a player up... =)
Stonicus,
Very good point! I get stuck often in autonomous agents that adapt to situations. I like the idea of predictable with subtle random variations.
-Kirk
Very good point! I get stuck often in autonomous agents that adapt to situations. I like the idea of predictable with subtle random variations.
-Kirk
February 17, 2004 09:15 PM
If you have a large enough set of patterns, you might want to bump up the probability of paths that have been working - decrement the probability when the whole squadron dies
Predictability is not bad - space invaders was as predictable as you can get - still a great game
other good games to clone are centepede and zaxxon
Predictability is not bad - space invaders was as predictable as you can get - still a great game
other good games to clone are centepede and zaxxon
I believe a mix of set paths and random moving enemies is the way to go.
Anyhow, when spawing enemies to fly defined paths, why not assign them to groups? Ie when a stream of six ships come one after the other along a set path, create a group for them. Then, when one ship in the group is destroyed (or a certain percentage of the group), they all scatter and take up random movement. Just a thought.
Anyhow, when spawing enemies to fly defined paths, why not assign them to groups? Ie when a stream of six ships come one after the other along a set path, create a group for them. Then, when one ship in the group is destroyed (or a certain percentage of the group), they all scatter and take up random movement. Just a thought.
-----------Autumn Fog - A 2D Action Wargame
I really like the idea of set paths with a small amount of randomness. I had not thought of throwing in some random movements. Excellent idea.
My main reason for asking this intitally though was geared towards what kind of data structure to use to store the paths. It sounds like a list of way points is the way to go.
Thanks to everyone for the replies!!
Marcus
My main reason for asking this intitally though was geared towards what kind of data structure to use to store the paths. It sounds like a list of way points is the way to go.
Thanks to everyone for the replies!!
Marcus
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement