🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

player-written AI

Started by
2 comments, last by Shudder 23 years, 6 months ago
What does everybody think about the player writing AI scripts in a game? The problem is that I was wanting to write something which included team based AI in a hierarchial structure, with commands being passed down the chain of command and interpreted to fit the situation, by whoever recieves them. The player could be anywhere in this structure, and may end up wanting to give orders of their own, to do this, they would pass the orders down until they reached the grunts at the bottom. The main problem I can see with this is the AI being too stupid and just generally not doing what the player wants. Things like telling people to move to a certain location couldn''t be too hard, but what if the player wants to tell them to do something more complex like use certain tactics in a fight. On way of doing that would be to have pre-determined tactical orders, but there might be things that the player wants to do which aren''t included. The solution I was thinking of was to implement a scripting system that would be available to the player during the game. The player would write what units should do when given a particular order. The units would have different actions they could perform, and by slapping them together in a particular order, the player would get the result they wanted, the player would also be able to edit commands that already exist to suit them. This would grant the player full control over their units, and they could get reports back from commanders with the information they need by writing a command for it, like ''tell me how many people died because of [whatever]''. The biggest problem I can see is that writing all these scripts would seem more like a programming task then a game, but after the player has ammounted a large array of commands it would make the game easier to control. Does anyone have any thoughts on this?
Advertisement
Baldur''s Gate 2 had text-file based AI scripts as I recall. This did allow the player to write his/her own custom AI scripts, though I doubt many bothered, as the AI was already pretty horrendous as I recall.


-Ryan "Run_The_Shadows"
-Run_The_Shadows@excite.com
"Doubt Everything. Find your own light." -Dying words of Gautama
If you have pre-defined AI routines that you''ve worked out.. like football plays, then the players can pick and choose how and when to impliment them.. then that''ll work out best. You''ve got to think.. the SWAT teams all have basically a football plan to go off of. The main team goes in towards the front door, and the secondary team goes around the back. The teams have configurations.. a front man with a shotgun and usually something to break down doors with. The rest have MP5s usually, along with other gear. The second man always covers the first man if he''s doing any other kind of duty.
Play SWAT and SWAT 2, etc.. by sierra. It''ll give you a good idea how things work. It''s literally a script. Move to door, use mirror on door. Slice the pie into the next room. Move to next door.. etc.
What would be easy to do is to have people make location scripts and walking scripts. A location script is the general one. Move from A to B. B to C. C to D. And you put them in an order. Grunt1 move from A to B. Grunt2 move A to B. Grunt 3 A to C.. etc.
The walking script is what the AI does while walking from A to B. It could include: Cover Grunt1, Watch for hostile target in direction N, Engage tragets as they appear, Stealth, etc. Then, according to these scripting directions, the targets would do subscripts which are inculded in the game. Cover Grunt1 means to look around occasionally, and make sure no one is about to pop a cap in grunt1. Watch in direction N means to move along a line in one way, while keeping a watch towards another, usually. So the character has to look to make sure they''re not walking into something, and then they have to occasionally look over and sight the direction for possible targets.
Then you add in an if(target). If they see a target, they have options. Fire on sight is one.. LOL. Identify target should come first.. but some people would want to take that out and go pure brute force. They might accidently engage one of their own, though..

All AI is really written in scripts. It''s all a matter of how complex you want to get. What i''ve laid out is all fairly basic. You just have to put it together, write out lists of things the players could have the AI do, and then what happens when the player chooses the AI to do something. You add in a small randomness element so it''s not always the exact same (say, when checking around for gaurding someone.. you might scan left for a few seconds, then right for a couple.. etc.
Getting more complex, you have sights and sounds. If you see someone, what do you do then? And if you hear something.. what then? Those are options for you, the developer, to work out

Although, if you want some help.. feel free to bounce ideas offa me. (wouldn''t Naz be proud?)

J
I found a site dedicated to game AI called (appropriately enough) The Game AI Page. It might prove useful.

======================================

Dave Myers
Co-Founder/Programmer/Designer
Twenty-One Six Productions

This topic is closed to new replies.

Advertisement