Computer Science Canada

Artificial Intelligence.

Author:  KeyBladeMaster [ Thu Nov 22, 2007 3:35 pm ]
Post subject:  Artificial Intelligence.

I Have know idea what I am doing.
im making a game that u need to fight little things.
i dont know how to make them random
these are the declarations for the enemy

Turing:

var delayTime : int
const heart := "Shadow_Walking.gif"
const heartA := "Shadow_Attacking.gif"
var heartx :int :=400
var hearty :int :=10
var framesH : int := Pic.Frames (heart)
var framesHA : int := Pic.Frames (heartA)
var picsH : array 1 .. framesH of int
var picsHA : array 1 .. framesHA of int
Pic.FileNewFrames (heart, picsH, delayTime)
Pic.FileNewFrames (heartA, picsHA, delayTime)

Author:  Euphoracle [ Thu Nov 22, 2007 4:38 pm ]
Post subject:  RE:Artificial Intelligence.

Is there a question in this post? :S

What do you need help with?

Author:  Tony [ Thu Nov 22, 2007 4:52 pm ]
Post subject:  RE:Artificial Intelligence.

Grammar, apparently.

Also there was something about "random". He might be looking for Rand.Int()

Author:  KeyBladeMaster [ Thu Nov 22, 2007 5:18 pm ]
Post subject:  RE:Artificial Intelligence.

Sorry, guess i didnt make it that clear...
I want to know how to make the character attack and walk randomly

would someone be able to give me an example code or something?

Author:  Tony [ Thu Nov 22, 2007 5:57 pm ]
Post subject:  RE:Artificial Intelligence.

something like
Turing:

var p_c : int := maxcol div 2
var p_r : int := maxrow div 2
loop
   p_c += Rand.Int(-1,1)
   p_r += Rand.Int(-1,1)

   locate(r,c)
   put "*"
   cls
end loop

maybe

Author:  petree08 [ Thu Nov 22, 2007 7:52 pm ]
Post subject:  RE:Artificial Intelligence.

mabey you want to have a comparasion between the players position and the enemy and have the enemy folllow the player, thats what i did for my jedi game


heres some psuedo code for a side view

if XEnemy < XPlayer - (A random distance from player) then
move enemy right
elsif XEnemy > XPlayer + (A random distance from player) then

move enemy left
else
Enemy is still (may face player though)
end if

sorry for crappy formating

make sure the random distance from the player doesn't change after it's randomized (using randint or Rand.Int) other wise enemy tends to "spaz out"
and constantly change dierction

also you could have the enemy go on a set path that is calculated with random values

OR

the players position tells the enemy what path to follow base on set values

or the enemy could be in a "patrol sate" (where the enemy walks back and forth) until the player gets with in range
when the player is in the range the enemy is in an "attack state", well that's the basic idea behind my halo game's ai system

Well hope that helped there are many differn't ways to do AI try out differnt things see what works out

Author:  LaZ3R [ Thu Nov 22, 2007 9:50 pm ]
Post subject:  Re: Artificial Intelligence.

code:
var x : int := 320
var y : int := 200
loop
    x += Rand.Int (-5, 5)
    y += Rand.Int (-5,5)
    drawfilloval (x, y, 3, 3, black)
    delay (100)
    cls
end loop


Random moving circle??

That's not AI though... It's in no way intelligent. That only comes in when you factor in the environment around the enemy. So on a blank white screen, he shouldn't be having a heart attack running in circles. If he see's a player, based on his character, he would charge them or be defensive, etc etc...

Author:  KeyBladeMaster [ Fri Nov 30, 2007 5:02 pm ]
Post subject:  RE:Artificial Intelligence.

thanks, that actually helped a bit:D


: