News:

Don't forget to visit the main site! There's lots of helpful docs, patches, and more!

Main Menu

[General] Programming an AI

Started by interdpth, May 30, 2013, 06:00:05 PM

Previous topic - Next topic

interdpth

For all you advanced and such hackers making custom enemies and the like. How did you make their AI? What went into it, how does it's thought process work?

Crashtour99

As someone who has at least disassembled multiple enemy AI's for Super Metroid I can tell you that for the overwhelming majority of them there is no thought process to speak of.  They usually just follow a predetermined pattern and completely ignore the player (or use a detection system to guide them in the general direction of the player, which is usually simple left or right directions).  There are a few exceptions however.

For instance, when Ridley runs the routine that determines which attack to use, he will take Samus' current position/state, as well as movement direction and speed into account.  If the player is doing a few specific things, he will use specific attacks to counter those.  Otherwise he will simply use an RNG computation to select from a table of available attacks and follow one of those patterns (J-swoop, tail bounce, fireballing, etc.).  Torizo has some similar elements, but is more reactionary in nature (if the player is doing x, then perform action y).

The hard part isn't so much coming up with patterns for your enemy to use, but meshing the patterns together and coming up with a way for the AI to determine which one to use and when.  Tilemapping and hitbox coding for the graphic AI table is tedious work but pretty straight forward and simple, and overall would probably take up much more time than coding the movement and detection/decision routines in the running AI (this is probably what has been holding me back the most from trying to improve space pirates so they're not so damn retarded).