Fight Game AI

Blitz3D Forums/Blitz3D Programming/Fight Game AI

splinux(Posted 2005) [#1]
I need help: i'm programming a fight game and I finished the player, a sample level, lifes, win/lose, etc...
The problem is: in wich way can i make an enemy ai(there are 1-2 enemy for each level).

The game is a 2d tile based game and the players can jump from a platform to another and fire bullets.


Rob Farley(Posted 2005) [#2]
I assume you're using the same bit of code for the enemies as your own player.

If this is the case you would have a get input function (or something similar) that will either take keyboard input or do the AI.

This way all players act and react in the same way.

So then you get to the AI bit.
Without seeing your game at all it's a very difficult question to answer.

So here goes with wild assumptions.

When player gets to end of platform, check to see where enemy is (ie the good guy). If he is above check for platforms I can jump to, if below can I drop down without cause injury? If not then try the other end of the platform... etc etc

This is basic state based AI.
State 1: Walk
State 2: Find new platform to jump to
State 3: attack
state 4: change direction
state 5: jump
etc etc

You've got to come up with the states and rules of your players, and what rules make it change from one state to another.

For example:
State 1: walk, at end of a platfrom change to state 2
state 2: I cannot find a new platform to jump to change state to 4
state 4: change direction, change state to 1
state 1: walk, at end of a platform change to state 2
state 2: Found a platform to jump to change to state 5
state 5: Jump, once landed change to state 1

get the idea?


splinux(Posted 2005) [#3]
Yes, thanks.
Good ideas, but to apply it i should use ifs or i should use a neural network?


Rob Farley(Posted 2005) [#4]
but to apply it i should use ifs or i should use a neural netwok?
I would use Ifs

I'd use your Neural NetWok to make yourself a Techno Stir Fry.


splinux(Posted 2005) [#5]
I read about using neural networks into os development, but ifs are easier.
Thanks for the help.


Damien Sturdy(Posted 2005) [#6]

I'd use your Neural NetWok to make yourself a Techno Stir Fry.



LMFAO.

Oh.

and maybe look at Case/Select. I find them much more readable than a pile of IFs.. use IF's in each case area :)


Nicstt(Posted 2005) [#7]
Will give an example using pacman type to help description

ghosts wander maze, either randomly or on prescribed routes, whichever you prefer, perhaps both:p

every movement check for pacman being in line of sight

if player in line of sight, then enter chase mode

if loose line of sight, then return to wandering maze

when player eats power pill and he is in line of site run away

When I was trying to work out what was needed i asked myself basic questions what i would do. It helped decide on the actions.

I'd use your Neural NetWok to make yourself a Techno Stir Fry.


agree /shudder


Rob Farley(Posted 2005) [#8]
Don't you just hate the fact that people can edit their posts and correct their typos!


splinux(Posted 2005) [#9]
I made an error typing, so, i've correct it.


Damien Sturdy(Posted 2005) [#10]
no, i dont hate it. Makes things better :)

Good ideas, but to apply it i should use ifs or i should use a neural netwok?



That one WAS quite funny though.


splinux(Posted 2005) [#11]
Why do you think funny a typing error?


Rob Farley(Posted 2005) [#12]



splinux(Posted 2005) [#13]
???


wizzlefish(Posted 2005) [#14]
LOL!


splinux(Posted 2005) [#15]
I haven't understood why you think funny a typing error.


Damien Sturdy(Posted 2005) [#16]
Sorry SpLinux... we're not laughing at you, its NetWok, followed by Rob Fartleys comment:


I'd use your Neural NetWok to make yourself a Techno Stir Fry.



THATS what was funny :) No offence meant!

[Edit]

DOH! now i've done it.! I wont edit that.. people can laugh at it.

[edit2]
No offence meant there Rob, and it was a genuine typo!

As for your Neuro..net..wok pics..... Hahahaha :D


splinux(Posted 2005) [#17]
Ok.