andrewbuck {l Wrote}:Bodsda {l Wrote}:Is it the combat AI that you are having issues with?
Yes. I tried to do a field based approach which is what the Field class is for. Basically allied creatures are surrounded by a positive field, and enemies are negative. The closer you are to a given creature the stronger the field is. If you want a creature to "charge" you make them try to walk towards the negative field and to "retreat" you walk towards the more positive. Each creature calculates the field based on the allies and enemies it knows about (through sight, etc). This works pretty well and makes the fighters charge toward the enemies but when they get close they start... well... dancing, is the best way I can put it. They just oscillate back and forth whilst beating the crap out of eachother. Once one of them dies the survivor goes and finds someone else to kill and the "dances" with them.
The end result is a combat simulator that kind of works but very poorly. I think this is a good way to do it, and there are other games like OD which use a field based approach like this, but I am unable to get it to work decently. It basically just needs some love.

-Buck
My initial thoughts are, why not break away from that function once the initial action is fulfilled, like this
- {l Code}: {l Select All Code}
while
{
if (doINeedToCharge)
{
while (!(nextToEnemy))
{
charge()
}
{
if(targetInRange)
{
attack()
}
else
{
break
}
}
}
Ok, so my psuedocode is not great, but you get the idea. If hes in range, kick his ass, if hes not, go find his ass, then kick his ass. Basically, break out of your movement function when you get into a 'combat stance', check for target, if hes there, throw a punch then check if he is still there.
Obviously that is an overly simplified version of what your after, but I think breaking it off into a separate fight function would eliminate the pirouetting pets.
Bodsda