I’m working on a simple game with multiple planes flying through the sky. they’re all kept at the same height, so effectively on a flat plane.
I’ve been working on some logic for making the computer-controlled airplanes seek out and chase other planes (it’s a free for all, so not just the player). The searching for a good plane to follow works, but often if two enemy planes end up close they just circle around each other, since neither can get behind the other.
What’s some best-practice pointers on making human-like AI for this type of game? ANy ideas?
Hmmm – good ideas. Maybe I’ll add a “behind” tracker, so that if an enemy is begin chased they’ll switch up their activity or, depending on how “scared” they are, try to run away instead of attack whoever they’re currently trying to attack.
Maybe if they get stuck chasing each other one barrel rolls out. Also it would be sweet if one was chasing on of them and they did kinda like a back flip over plane chasing them. Kinda like a 3D effect.
+1 I already have the backflip And I added a timer for how long they’d tolerate someone within X degrees of their rear end before flipping backward, so there’s some variety in tolerance. There’s also a “boost” ability, which triples the speed for a short while, helping to remove patterns. Still two can end up in a big, boost circle, though. So more work is needed
The more things I add, the more “random” it seems, although patterns still emerge. I’ve just added pickup spawning, and once I get the AI to be attracted to pickups, that’ll randomize it even more.
However, do you guys know of the method or concept that’s used to make the AI choose one thing over another using something like weighted preferences vs. hard things?
Like, there’s 8 different pickups, some better than others. And like mario kart, only one “weapon” pickup can be held at once, so if AI has a missile loaded, they likely won’t want to get another missile pickup. Also, if they have full shields, they likely won’t be attracted to a “heal shields” pickup. And I’d like to have some AIs that prefer one thing over another – like one that wants to collect everything, and one that prefers to hunt other ships instead of pickups, etc.
How does one go about designing this in a way that allows for a random “personality” to be set up at start?
I know i’ve seen some games with AI characters that have things like “aggressiveness” etc, and I’m sure this is the concept I’m looking for, but I’m having a headache figuring it out.
There is a couple idea that come off the top of my head. The first is would be adding a bunch of if and else statments but that could get really complicated and hard to debug if something is not working right. The second is you can extend the script and make a new script. I don’t know if you can use the second method in javascript but I have been using it in C#.
Have you heard of extending scripts before? If not I can explain it.