Jump to content

  • Log In with Google      Sign In   
  • Create Account

AI for Galaxian Game


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 arcangelg   Members   -  Reputation: 122

Like
Likes
Like

Posted 20 January 2000 - 12:07 PM

Hi, Please, If someone has some stuff about ai for a kind of game like Galaxian or Phoenix Arcades, I will appreciate so much I have some questions like: When the enemies must attack? When the enemies must fire? What kind of techniques can I use? Please, I you have some examples o you can tell me where can I find some stuff, I will apreciatte so much Thanks a lot Cheers, Arcangel arcangelg@yahoo.com

Sponsor:

#2 Stoffel   Members   -  Reputation: 250

Like
Likes
Like

Posted 21 January 2000 - 06:06 AM

I don''t know the answer. All I can tell you is that Galaxian always kicked my butt. Man, I sucked at that game.

#3 Machaira   Moderators   -  Reputation: 1028

Like
Likes
Like

Posted 21 January 2000 - 06:55 AM

While I''m far from an AI expert here''s a couple of points:

* An enemy can attack at a regular interval or randomly, your choice. Neither is particularly hard to implement.

* An enemy would probably fire similarly, again your choice.

* To implement this you could do something like:

An enemy could the following variables to handle this:

An action variable that would be an enumerated value - ACTION_IDLE, ACTION_ATTACKING, ACTION_REGROUP, etc.
A variable to determine when to attack, again possibly an enumerate value - ATTACK_RANDOM, ATTACK_INTERVAL
A variable to tell when it last attacked
A variable to tell when to fire, similar to the attack variable

Each time through your update loop you would check the attack and last attack variables, make a decision whether it''s time to attack again based on their values and set the attack variable appropriately. The next time through the update loop if an enemy is now set to attack it would begin it''s attack. It would then begin to evaluate the time it should fire.

This is a VERY simple explanation and it''s probably missing a lot of stuff, but it''s off the top of my head and might help you in starting to build this.


Breakaway Games

#4 TANSTAAFL   Moderators   -  Reputation: 1152

Like
Likes
Like

Posted 21 January 2000 - 01:40 PM

in the games like galaxian, and galaga, all of the AI was pattern based.

#5 Aries   Members   -  Reputation: 122

Like
Likes
Like

Posted 08 February 2000 - 12:27 AM

How about this:
if distance (playerX,playerY,enemyX,enemyY)>400 chase
if distance (playerX,playerY,enemyX,enemyY)<40 evade
if hit by bullet evade
calculate where player would be after a bullet reached the distance(playerX,playerY,enemyX,enemyY) and turn in that direction , direction reached OPEN FIRE !!!
I use this in my RTS game but it would also work in arcade


Programming is an art


#6 Harvester   Members   -  Reputation: 122

Like
Likes
Like

Posted 08 February 2000 - 01:25 AM

AI is not such complicated as it sounds. However, it is essential that you can seperate your thoughts in pieces.

First you need to know what you would do.
Ie. It is you and 5 other players. Player 3 is the stronger, and you have assigned him a score of 1000
Others are not much strong.
1 (you) score 600
2 score 100
4 score 500
5 score 300

What would you do?
1. You would try to get the stronger one (3) to attack the others but you, so that he weakens. So, the AI character (1), will try to make some aliance with the player 1, and he will try to forge a war between the aliance and the others.

This is a very basic thing. All this can be extended greatly, and finally end up with Personalities. But above all, you must try to analize your thoughts. Remember that the best AI is always hidden within your brain

tips:
Use scores that are generated based on some stuff.
Multiple scores for a character is the best choice.
To generate a score, take in account the user''s army, facilities, technology, resources production rate (if avaliable), player''s personality, etc...

Hope these will give you a start-up boost.

c''ya

#7 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 08 February 2000 - 03:22 AM

Dunno if this is of any use for you anymore, but
i''ll tell you how i did the ''AI'' in my (little)
vertical scrolling 2d-shooter, where the enemies
just keep on coming on the screen in random
patterns.


As stated before, the ''AI'' in this kind of game
is (usually) pattern-based. As my game is actually
a very simple example game for my soon-to-be game-
engine, i ended up with a simple control-point
solution.


The control-point structure:

typedef struct{
int iXPos;
int iYPos;
}CONTROL_POINTS;

The 2 variables (iXPos and iYPos) tell where on the
screen the particular control-point is. This structure
can be extended, so that the enemies would stop on
certain control-points etc. So for making
the patterns i just made a 2 dimensional array of
control-points, like this:

CONTROL_POINTS ctrlPoints[NUM_PATTERNS][NUM_POINTS];

All control-points are loaded from a file, which
contains all of their x and y values.

So now i had NUM_PATTERNS of different patterns which
all consist of NUM_POINTS control-points. The first
and the last control-point in a pattern are reserved
for starting and ending points, which must be outside
of the screen. Why? Well it would look pretty silly
if the enemies would pop on the screen from nowhere
or disappear in the middle of the screen.

So how did i use this then?


In my game every enemy has a variable which shows
which pattern it is following and another variable
which tells which control-point is the enemys next
''target''.

In every AI-cycle i would just check if the enemy has
reached a control-point, and if it has, increment the
the target-variable by one. If the target-variable
is NUM_POINTS, then the enemy must be destroyed, as
it has reached the last control-point. If the enemy
hasn''t reached the target control-point, i just moved
the enemy towards it until the enemy is on top of it.

Some pseudocode to show how i did it (the enemies
are stored in an array of Enemy[NUMBER_OF_ENEMIES] ):

for( int i = 0; i < NUMBER_OF_ENEMIES; i++ ){

//Move the enemy:

if( ctrlPoint[ Enemy.Pattern ][ Enemy[i].Target ].iXPos < Enemy[i].X )
Enemy[i].X -= Enemy[i].Speed;

if( ctrlPoint[ Enemy[i].Pattern ][ Enemy[i].Target ].iXPos > Enemy[i].X )
Enemy[i].X += Enemy[i].Speed;

//the exact same for y-points

if( Enemy is on top of the controlpoint ){
Enemy[i].Target++;
if( Enemy[i].Target == NUM_POINTS ) //The last controlpoint was reached
Enemy[i].Alive = FALSE; //Destroy the enemy
}//End if

}//End for


When i created an enemy, i would randomly give it a pattern,
then put its x and y position as ctrlPoint[Enemy.pattern][0].x
and CtrlPoint[Enemy.pattern][0].y and finally set the enemys
target control-point as 1 (0 is the starting-point).

Very basic, and extremely easy.


What about shooting? Well i used a random variable on
that. When ever a random variable hit a certain value,
the enemy would shoot.


This isn''t probably the best and the fastest way of doing
all this, but it works just fine as an example. Hope that
atleast someone understands what i''m trying to say here,
and that this post would be helpful.


--BerLan





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS