AI
Blitz3D Forums/Blitz3D Programming/AI
| ||
what's the best start to creat an ai-system?! maybe waypoints? or what else? hope some of you have a clue where to start, and how a system should look like? |
| ||
Finite state machines seem popular. Each AI friendly or enemy can be in several different states representing beahviour. like STATE_FLEE, STATE_ATTACK, STATE_KAMAKAZEE, etc. etc. These states each have a set of if statements that define the behaviour. these if statements can also switch the AI to different states. An FSM combined with waypoints should work very nicely. |
| ||
If you're interested in a tutorial and demo on finite state machines, go here. |
| ||
There's also the concept of levels of AI to consider - e.g. an overall 'commander' who deploys units across the battlefield, then perhaps local 'generals' - but each unit also has its own AI specific to local conditions. |
| ||
one more suggestion I use a sort of 'cascading' waypoint system which goes from least to highest important, which I've found useful patrol waypoint - preset patrol route - least important deploy waypoint - unit is sent to enemy's last known pos' attack waypoint - when an enemy is in range and the unit makes its own mind up about where to go. retreat waypoint - when a unit has decided to retreat regardless of its orders avoid waypoint - when a unit needs to steer around another unit or get out of another unit's way. When a goalpoint is reached or no longer needed, it's cleared and the unit then takes the next least important so if a unit has not been deployed and is not engaging the enemy and is not in retreat or avoiding another unit, it'll follow the patrol waypoint path. |
| ||
very interesting. thanks for the points. will have a look with one works best for me :) |
| ||
I got myself "AI Game Programming Wisdom" book which is pretty good although bit technical at times... there's now "AI Game Programming Wisdom 2" too available: http://www.aiwisdom.com/ |
| ||
i like the weights system, which can be used in state machine style. the more angry goes up the the lower calm goes angery = 0 calm = 100 same with happy and sad happy = 50 sad = 50 same with these too. scared = 0 bravery = 100 just very basic example but if you do a search on the net you find these kind of ai styles. |
| ||
One last suggestion - plan out as much as possible before beginning coding - define what essential features the AI must be able to handle and try to code a system that's essentially modular. Bad AI can wreck a game and it's easy to get into a mess of conflicting rules/statements that don't work reliably. |