Need help with setting up an AI

okay so here is my first AI (not too bad), got basic collision and movement, just need help making it look good.

Things I need help on:

  1. Avoid collision with objects with the property “ground”.
  2. No nodes/way-point needed to “follow” an object named “player”.
  3. Help setting up the AI’s weaponry. (Missiles and MG)
  4. (If possible) to make it STOP and fire at the vehicle.
  5. Weaponry changing.

I do not care if I need a script (hey I wrote my first script after watching a video :slight_smile:
to make this work, I’m fine with it.

But I just need help on this cause I do not know what or how I’m needing to do this.

Credits for the car goes to www.tutorialsforblender3d.com

File:Apache_AI.blend (1.09 MB)

Yeah, scripting is the only way to make a decent AI.
How familiar are you with python?

  1. Really? You want it to fly thorough the ground. I’m not sure collision groups are implemented yet (don’t quote me on that)
  2. Sure, just change the trackTo’s object. (trackTo.object = player sort of thing)
  3. I have a script that can manage this, but am hesitant to give it to you, as it will be hard to understand having not written it. I’ll give you some pointers though:
    • They are two separate weapons, with separate fire rates. Write a script where a property controls the fire rate, so you can use the same script for both
    • Have the machine-gun’s rotation change slightly each frame, use a property ipo with a random property.
    • Will AI always fire? Have a property called “fireProb” and compare a random number to it to see if it “choses” to fire
    • What else determines if you can fire? Can you see him? In range? Weapon temperature?
      If you take these into account you end up with a realistic firing pattern, where it is “predictably random”
  4. Yeah sure, simply stop it moving by de-activating the motion controller and setting a servo-motions velocities to 0
  5. It can’t fire both weapons at once. I reckon it can…

The first thing to do is to make a flow diagram. It makes things 10 times clearer, and when you get to writing code it is much easier.

I have an amazing AI script for enemies in zero-G. A helicopter is similar to this. If you want me to send you the script I can probably do so. BUT I would prefer to see you try first.

A final word:
Plan for more. It is easier to write a good script now, then to have to keep updating it later, so add in picking targets for when you have two players. Keep your scripts flexible, in an Object Oriented way (each object knows about itself).

Good Luck, don’t be afraid to ask for help.

I’m not really wanting it too go through the ground just avoid hitting it…

I’m still a newbie in python, but I’ll get straight on the script.

And thanks.

Okay I don’t know why, but I did post the post before this around 3am (9hours ago) but yet it shows up that I posted it at 10:37???

Anyways, I started around either 8am (after schoolwork, btw I’m home schooled.), and here is what I have so far… :confused: not tracking or anything, to me is just numbers and letters… but I’m still learning.

Anyways, I’m not even 10% sure how I should set up the python to the helicopter…

File:Apache_AI.blend (1.11 MB)

I know there is a lot of bugs but like I said, I’m just learning python.

For #1 what you have to do is fill in the Property blank on the Collision Sensor. That blank will cause your object to collide only with objects that have the propery listed. I do not know of a Bricks way to so the inverse (only collide with things that DON’T have a certain prop). So tag everything else with not_ground and use that.

For some of the AI, it sounds like a Navigation Mesh used in a bad guy’s Seek Sensor.

-rking

Okay I’ll do this right away.

:confused: that didn’t do anything…

and navigation mesh? I thought that was just to get from point A to point B…

And what’s stopping point B from being the player?

A is Helicopter and B is the Player, but its the ground that will stop it (or the Apache will just go through the ground)

Is that what you are wanting to know???

Other than that I don’t know what I’m needing to put in it to make it float/hover… I’m not sure what you need to type in… (just tell me a the part that will make it float.) So I can edit an add the collision and gun/missile scripts…

And how bad is my script??? (I’m guessing pretty bad…:/)