Help with AI codes

Blitz3D Forums/Blitz3D Beginners Area/Help with AI codes

NerdyBrendan(Posted 2010) [#1]
Hi....... I'm new...ish to Blitz3d and I was wondering if I could get some advice on programming Enemy AI


Serpent(Posted 2010) [#2]
What kind of AI do you need? Come up with an AI type that suits your project. For example: enemies might run away from you or towards you depending on the game; if enemies have health they might choose to chase you or run away depending on how much health they have. If it is the player against the enemy in an FPS game you would want to simulate the qualities of another player - i.e. random numbers used for inaccuracy, only attack you when in their sight, etc.

As for actual code, you'll need to be more specific about what you want your enemies to do before anybody can physically come up with something.


Kryzon(Posted 2010) [#3]
Hello Brendan,

until you can be more specific on the genre of game you are developing, I can only give you the following advice: start with pseudo-code.
In whatever enemy AI programming situation you find yourself in, what you'll be doing is imagining all the different reactions and conditions for those reactions to happen, like our reptile fellow said above - whether it be for enemies, players or other elements.

If you can sketch out simple diagrams of how these reactions [and their conditions] apply through the course of the game, you can start to write code that portray them - of course, always keeping things modular in order to facilitate debugging and tweaking.


Charrua(Posted 2010) [#4]
hi

see:

http://www.blitzbasic.com/codearcs/codearcs.php?code=2253

the following code isn't mine, i copy/paste some time ago from one thread, (and don't know now wich)



probably it helps

Juan


NerdyBrendan(Posted 2010) [#5]
I was thinking about (because I'm making a FPS) having AIs that would come after you and attack you (eg. shoot you)until they have less than 10% Health, which is when they flee the scene.

Also, I made a map in 3D-World-Studio and I would like to know how to make the AI walk around walls and stuff... If that is possible...

Thanks,
NerdyBrendan


Charrua(Posted 2010) [#6]
A*

you have to have some x,y matrix of your world and mark where are the walls, then A* (a star is the name of the algorithm) do the job.

http://www.policyalmanac.org/games/aStarTutorial.htm

Juan