ID:154342
 
Has anybody implemented sophisticated AI in any of their programs? I've been reading quite a bit about AI programming and I've found some really interesting stuff (check www.gamasutra.com under features, programming and artificial intelligence, if you are interested). I am interested in perhaps implementing some of this stuff in one of my own programs and I'm interested in what results anybody else has had with it. Im not certain of byond's suitability for complex (and repetitive) procedures.
Anyway, one article I was reading actually suggests the creation of a process manager that will execute individual perceptions, actions and behaviors at the rate of once per a defined number of frames and based on certain prioritys. Influences on priorities include distance from user, visibility, currently available proc time, etc. Anyway, the pm is executed and passed a parameter indicating cpu time available, then, based on the influences to each agent, some of the agent's perception, action and behavior functions are called (each of these basic functions in the set should be simple and indivisible).
The article goes on to suggest the pm should actually be developed into a separate and common language for more effective implementation (and the ability to actually build off of others' progress). There are a few basic goals for the pm, ensuring that not too-many processes are executed in a single frame (so the frame delay for each is set so that they have a large and not-frequently occuring lowest common multiple), getting important tasks done and spreading vital tasks for efficiency over multiple frames (interruptable and resumable processes).
One interesting point I read was the smearing of a process over multiple frames. This gave me a great idea, create certain processes genetically to reflect higher behavior forms. Genetic algorithms are created in a language like lisp that allows algorithms to made and bred together over many generations to produce efficient solutions to various problems. The key to simple ai is coming up with simple rules that produce complex and favorable results. Genetic algorithms are perfect for finding this (where one's own ability to come up with intuitive simple rules fails, which is probably very quickly).
I know I have a tendency to ramble on, but ai is really an interesting field (I'll be dealing with it some next semester). I've been getting it in my head recently to actually build an ai language that allows the implementation of actual goals. The key then would be pathfinding techniques that take place conceptually. I don't think A* would exactly work for this (although, given a set of processes available with predictable results that can be chosen from as an action matrix, perhaps a very abstract adaptation would be possible(joke)).
Ha, I know this is not so feasible to the average byond programmer, but it is something interesting to think about. If I get a chance to implement a process manager and basic ai setup in byond, I will probably release it as a library, although I am more likely going to develop this over the christmas break using pseudocode and produce it in java. Also, I'll send word when my PhD arrives in the mail.
sorry, not trying to bump this post, but I was thinking: the basis for learning where you could define a few actions, have an agent try them for results and weigh them for later usage. you could also let the agent weight stuff by seeing it done and perhaps even attempt complex combinations of actions. then, the agent can do acquired skills and change weights depending on the circumstances (like if one learned style doesnt work in a case, lower the weight and let other styles become open that were previously weighted too low). a simple matrix could be defined where skills are ranked for the goals they achieve
Cybergen wrote:
Has anybody implemented sophisticated AI in any of their programs?

AI is a big interest to me, and I'm hoping post-LivingDead and Birdland to concentrate mostly on strategy games that involve interesting AI.

So far my delving into the area has been to do a lot of work on pathfinding:

byond://Deadron.PathFindingDemo
byond://Deadron.PathFinding

Though I don't consider pathing to be AI really.

LivingDead has an AI that could more or less be considered a Finite State Machine. It's not implemented that way formally, but each sentient mob uses a set of criteria to determine its current state and act appropriately.

One thing I discovered in L&D recently that I've never read about is a way to simplify more complicated decisions. In one case there is a "weapon" that is actually cast on people who are getting beat up to protect them. At first I was going to add a whole separate set of code in the main AI to consider whether it had a "helping" weapon and if anyone needed help...but that was a pain.

Finally I realized that it was much simpler if the AI didn't know anything about whether the weapon is good or bad. It simply always tries to attack the bad guy with its current best weapon. In this case, the "good" weapon has attack AI added to it, and that AI figures out who the bad guy is pounding on, then does its thing to the victim to help save them.

The effect -- already commented on by the beta testers -- is that the mobs appear very "smart" in figuring out who that someone needs help and trying to help them. But in fact they are just trying to attack the bad guy, and there are a few extra lines of code in the weapon that do the rest.

Simple distribution of AI responsibilities that causes complexity to emerge. That's my favorite approach.

We'll start releasing incremental versions of Sneak II soon, and one of the things I'll be trying there is "influence mapping", which is a way for the AI to analyze the map and figure out where to defend, where to attack, etc. That should be interesting.

As a general rule I try to stay away from anything "fancy" in AI...genetic algorithms, neural networks, etc. If it's not a very simple approach that I can apply direcly and immediately with known results, I'll leave it to the academics.
In response to Deadron
On the subject of AI, which kinda goes in with this post, I remember seeing an article one on of my daily checked websites ( www.geek.com I -think-) about evelutionary programs.

The way it worked was the scientist specified the wanted results from the evolving program ( In this case it was be able to diferentiate between the words 'go' and 'stop', and depending weather it was go or stop, produce a 5volt current across a line, or none at all). The computer would randomize some code (20 attempts I think), and then test each one for useability, and then take the winner, and repouduce 20 more from that one, with random changes to them. After something like 15000 generations the resulting program was able to diferentiate them almost all the time, and then change the voltage acordingly.

Now to get where this fits in ^_~ the scientist who ran the program ran the results by a decent engineer, and the engineer was baffled. The program did what it did with almost none of the regular tools that engineers would use (the program was based to replicate an electric circut, so tahts why an engineer and not a programmer) like a timer. Now if any of you have had to deal with sound, then you know that timers are pretty much crucial to trynig to understand or reproduce it (frequency is a function of time after all).

So just because you have access to all these funky tools when you're programming AI, doesnt mean you should use them ^_^ Ive run into some BOTs on IRC that could converse with you about as well as most of the people in the channel (well, about as well as an -insane- person in teh chan, which was all of us *L* ). They finally had to delete it because it kept kicking and banning this one guy that was going out with a girl that the bot somehow decided it was in love with @.@ it was soooooo wierd.

Annnyways, Ill stop ranting ^_^;;

Elorien
In response to Deadron

LivingDead has an AI that could more or less be considered a Finite State Machine. It's not implemented that way formally, but each sentient mob uses a set of criteria to determine its current state and act appropriately.

Oh man, I could go on forever about this. I read about a situation calculus that somebody developed where the current state of a system can be expressed recursively.

for instance, the action do(a, s) will do action a in situation s. the action results in a new state of the situation. s can be expressed recursively: do(a, do(a, s0))
where s0 is the start state. this method is useful for expressing the possibility of certain actions (in what situation they are doable) so that in a nondeterministic artificial intelligence, an agent can search out viable actions

Finally I realized that it was much simpler if the AI didn't know anything about whether the weapon is good or bad. It simply always tries to attack the bad guy with its current best weapon. In this case, the "good" weapon has attack AI added to it, and that AI figures out who the bad guy is pounding on, then does its thing to the victim to help save them.

Hmm, that is an interesting solution. The bad guy attacks adjacent mobs automatically and the weapon itself does all the important work? In this case you could have weapons with different effects set up in their attack procs.

Simple distribution of AI responsibilities that causes complexity to emerge. That's my favorite approach.

Yeah, that is the key for making processor-efficient AI, but sometimes actually designing the rules becomes trial and error

We'll start releasing incremental versions of Sneak II soon, and one of the things I'll be trying there is "influence mapping", which is a way for the AI to analyze the map and figure out where to defend, where to attack, etc. That should be interesting.

I would really like to see the way this comes out

As a general rule I try to stay away from anything "fancy" in AI...genetic algorithms, neural networks, etc. If it's not a very simple approach that I can apply direcly and immediately with known results, I'll leave it to the academics.

Ha, probably safer but I can't help myself sometimes