- Title: Advanced Top Down Shooter Artificial Intelligence
- Description:
Clever AI that DOESN'T simply run at the nearest target. It intelligently seeks out the best target, attacks at a comfortable distance, takes cover where necessary, dodges slow projectiles (this functionality can be removed easily for hit scan projectiles, or for difficulty adjustments), shoots while leading the target, and has support for an infinite number of teams, or free-for-all! All this, AND it's quite simple to implement! - GM Version: GM8
- Registered: Yes
- File Type: .gmk
- File Size: ~0.02mb
- File Link: host-a.net
- Required Extensions: None
- Required DLLs: None
- Tags: GMCTUTORIALS GMCAI GMCTOPDOWN
Summary
Many games (such as yours, I suspect) call for some sort of intelligence on the part of the non-player characters. Of these, some are top down shooters. Of these, some call for the very best top down shooter AI; capable of advanced behaviours such as smart target selection, movement, avoidance, cover usage, shooting, assisting team mates, and more. These games could and should use this AI example!

The important stuff that you need to know about: Most of the AI behaviour is handled by a single script (named scr_ai() in the example). The script has no arguments for simplicity (feel free to modify the script, obviously; you can fiddle with how the AI moves, for example, by changing this code). Every player/AI object has a team variable (if the value is the same, then the two entities are on the same 'team' and won't target one another, such as obj_player.team == obj_ai.team == 1). Projectiles, or any other damage dealing entity, also need a team variable. There are a couple of other miscellaneous variables that are necessary: hp, spd, dir, target, searchx and searchy. You may need to modify the script to address the fact that the AI will potentially target obj_unit_par, and will treat obj_wall as cover. Of course, there are comments in the example gmk.
Most of the drawing code, shadow and particle drawing code, HUD code, etc is unnecessary. You won't need to copy that over to your project. It is quite clear what is needed, but if you have any questions, don't hesitate to ask. Also, if you have any questions of any other aspect of the program, then again, ask away!!
Should you find this example useful, credit and +reputation are appreciated! Thanks!



Find content
Male











