May 22, 2012, 11:55:57 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Please report any bugs or issues that you might be encountering with the Beta in the Support System so that we can better keep track of any oustanding issues that may come up.

GameCore Support System
 
   Home   Help Search Login Register  
Pages: 1 [2]
  Print  
Author Topic: AI?  (Read 1832 times)
Squat
Hero Member
*****
Posts: 592


View Profile
« Reply #15 on: January 08, 2009, 08:06:38 PM »

This is going to come in rather handy, especially after you setup various faction groups within your world such that AI's fight each other too. I need it to make sure that my Quest NPC's defend themselves and even help the players.

I've found that the AI right now behaves rather nicely, though it has a few necessary adjustments for my personal usages. I like the way it's set up with the bad guy contoller layered on top of the network character, it's going to work out well for my purposes and I can't see any issues with me layering my own ideas on top of it. I just gotta see how he handled getting a pointer to the AI's name, which should be nothin.

This, however, leads me to ponder the notion of having one object be able to run more than one script. It can be scripted that way, but much easier to just list multiple scripts that all get ran in queue.

If I were to ask for anything huge regarding AI, it would basically be a point in the right direction as to how I can get a literal swarm of enemies that don't fight the CPU for commands. I'd like to explore a way to group enemies into types and send more global commands to them, at a more intelligent interval that's based on the game, not an internal clock.

For instance, the resending of the "moveto" command doesn't need to happen unless where it's moving to is no longer good. I'd rather he be told and forgotten until you, the target, tell him you've moved a meter or more. I'd like to set that range value up into a controller setting.

When the AI's get to you, they keep going indefinitely, pushing you for eternity until you kill them or ditch them. They should get to you, stop moving and start attacking until you again, move 1 meter or more. This is understandably something specific to my needs and I think I can handle it. As long as I get help with my technical questions, I can usually get by.

I like the way it's heading right now, I think my game will be playable even if I put what's there in its current form. I could certainly make it something enjoyable and fun that takes up your time to play. I can path about 100 enemies without lag and as long as only about 8 are attacking me, it stays pretty clean. If I piss too much off, it drops down pretty quickly. But, I can tailor the game easily enough to ensure you don't piss too much off. It can be as simple as making each one of them hard as hell. I just want to make sure that I have the ability to toss in a ton of variety.

I don't necessarily want 100 enemies at one time in a big circle coming after me at all times, but I do want it to feel like you're being assaulted by 100's sometimes. I can use a particle effect at the source to make it look like thousands are gathered there. I just want to make sure before I spend the time to trick everybody into how much is going on, that what's really going on is exciting in its own right.

By the way, I've spent the last two days actually playing my game. Sure, it's the lego man with the protein blaster, but he's shootin MY enemies and it's in MY game. I have never felt so proud and it wasn't until 2.1 that I could really do it this cleanly. Adding goals is so easy its almost fun. I had that part literally a week after buying the engine. Spider chases ball, don't like you messin with his mug and WILL tell Dad! Easy stuff a newbie can do...I'm proof, cause I was big-time. Though, I've been programming in C for years.

What GC would need to make this truly easy for folks is to explore the Crysis Editor's AI flow graph system. Whatever basic commands are available are placeable in a graph tree that will link to the next event if conditions are met. It's almost identical to Max's particle editor. It's basically a visual GUI programming interface that can't be truly customized unless you're at the source. Crysis let you make a character shoot something, pick it up, walk to it, talk to it...etc. It could not, however, let you make a character act like a girrafe giving a monkey a hummer through a chain link fence because we all know how specific you have to be when that comes up in charades. At the very least, it's one variation on the notion of a "list of stuff AI should/could do". For the most part, everything's a variation on it's current position and what animation is called. So, I guess you could do the monkey thing...if you're some kinda weirdo.
Logged
acocq
Full Member
***
Posts: 164



View Profile
« Reply #16 on: January 09, 2009, 05:15:43 AM »

By 'layered AI' what we mean is that the base character controller is literally the same whether it is the local player, a network player or an AI character.  The default AI script (which is only one of many possible ways of handling the AI side of things) is essentially a layer on top of the character script and simply 'feeds' input to the character similar to how the player does. 

Gekido,
thanks for the information ... I think I'm going to have to wait for the documentation to be completed before I tackle this  Embarrassed ... I've still having a hard time grasping some of the conceptional basics in GC, I think.

For example, I find it difficult to "visualize" how the control flows are organized ... the basic player controller "does" certain things depending on events that are generated. Adding an AI layer on top would mean that the AI-code needs to "simulate" those events (e.g. keypress to move forward), correct (or GameCOREect ... bad pun, I know)

Since I am a very visual person, it would help me significantly to see the concept in some sort of graph/picture (call me a flow-chart junkie ... Wink) or can I think of it more in terms of a state transition diagram ?

Cheers,
Andreas
Logged

__________________________
Easy to use ... is easy to say ! Wink
Squat
Hero Member
*****
Posts: 592


View Profile
« Reply #17 on: January 09, 2009, 07:29:07 PM »

There are a couple of requests for features to add that I think everybody can use in their games.

1. Expose character HP to the controller setting (mentioned and noted)

2. Create and expose a damage modifier for any weapons they're using.

3. Create and expose the maximum slope angle an AI can traverse.

4. Expose a boolean operation for keeping AI upright or aligned to terrain. Think past bipeds.

5. Add a stamina meter with walk, run and jump modifiers for draining it, plus recharge time.

6. Add HP and Stamina meters to the Simple Character's HUD.

7. Add ammo readouts on the silly little weapons.

8. Add an automatic firing weapon with adjustable Rate of Fire.

These 8 things to me will open the doors for us to make characters from soldiers to magicians.

I'm still waiting for those 3 types you promised us: 1. Runs into range, shoots 2. Stays put, turns and shoots things in range 3. Pulls off your head with a grapple hook and eats it.

9. Fix flamethrower so clicking fast doesn't kill at any distance. weird huh? try it
Logged
grubert
Full Member
***
Posts: 183


Everybody is very nice, but my jacket disappeared.


View Profile WWW
« Reply #18 on: January 10, 2009, 06:14:59 PM »

Good requests, Squat!

Specially these:

Quote
Create and expose the maximum slope angle an AI can traverse

4. Expose a boolean operation for keeping AI upright or aligned to terrain. Think past bipeds.

5. Add a stamina meter with walk, run and jump modifiers for draining it, plus recharge time.

6. Add HP and Stamina meters to the Simple Character's HUD.

Logged

my portfolio and weekly posting:
http://athossampaio.blogspot.com
Squat
Hero Member
*****
Posts: 592


View Profile
« Reply #19 on: January 10, 2009, 06:27:02 PM »

How can we control what speed the AI decides to move at if we're not giving it control inputs ourselves? For instance, I want the AI to walk the path while he's wandering it, but when he's pissed at me, I want him to run after me. Right now it appears that the AI is completely locked into the run speed.

Also, I'd like a way to be able to more naturally control some of their tendencies to wander or idle. Right now they hit a waypoint and it's straight to the next. All the wandering bots in the game act like New Yorkers. They're starting to make me jittery and paranoid cause they never calm down.

It would also be nice to be able to set patrol areas where they will wander around. Actually, if you made us a cow that eats for yay minutes, moves slowly to somewhere else and eats again and doesn't like you, we could turn that into anything and everything. It wouldn't need waypoints, it could just turn for a random amount of time and set off straight forwards, maybe decide to turn here and there.

One of the keys though, is a way for us to get them to go around something that's blocking their path. They need to stop, wait a second and then transfer to pathfinding. Players can set mini-circles around their obstacles and we'd effectively have full-world navigation.

Also, I don't see any way for a bot to cross from one object's waypoints to anothers. Think about giving us parameters that are built directly into the waypoints. Perhaps a set of tendency percentages that will help direct the AI's decision, built right into the pathing editor. Some tendencies could be "pause here", "maintain forward", "Turn around", "scan for enemy", "move to new object path(@object)". If no values are set, the tendency is ignored.

That way, we could put like 8 points around a building that if the AI encounters while on a chase, he uses the paths to go around and once he gets to a particular point, he breaks and goes back on the hunt, based on the path information, not his own constant checks.

Is there a way for the players themselves to maintain a variable with the closest waypoint to them? If an enemy reads that player as its target, it can always know which waypoint to go instead of having to scan the world to figure it out.
« Last Edit: January 10, 2009, 06:41:55 PM by Squat » Logged
acocq
Full Member
***
Posts: 164



View Profile
« Reply #20 on: January 12, 2009, 07:07:58 AM »

One of the keys though, is a way for us to get them to go around something that's blocking their path. They need to stop, wait a second and then transfer to pathfinding. Players can set mini-circles around their obstacles and we'd effectively have full-world navigation.

Also, I don't see any way for a bot to cross from one object's waypoints to anothers. Think about giving us parameters that are built directly into the waypoints. Perhaps a set of tendency percentages that will help direct the AI's decision, built right into the pathing editor. Some tendencies could be "pause here", "maintain forward", "Turn around", "scan for enemy", "move to new object path(@object)". If no values are set, the tendency is ignored.

That way, we could put like 8 points around a building that if the AI encounters while on a chase, he uses the paths to go around and once he gets to a particular point, he breaks and goes back on the hunt, based on the path information, not his own constant checks.

Squat,
some very good requests / points ...

This is starting to head into the same direction I was going ...

I think what you are in essence describing is a way for the NPC/Bots to perform some advanced level pathfinding (incl. obstacle avoidance) ...

Ideally, they would be able to respond to dynamically changing environments.  As a matter of fact, there are some algorithms to do that ... most of them are based on an A* pathfinding algorithm with some additions for a.) changes to the paths during runtime and b.) restricting the (re-)calculation of the path (google "Constrained Dynamic Route Planning" or CD* algorithm).

But all these algorithms require a 2D graph, so the bot knows where to traverse.  Putting the nodes into a level will most likely always be a manual task, but generating the edges connecting the nodes could be automated (see what IntenseX is doing in 3DGS). The GC path points are woefully inadequate for this, because they merely connect point A to point B and the Bot can use it as a "rail" to move along, not to independantly navigate through the level.

Enhancing Bot AI to include various behaviours requires some sort of control mechanism (either a pure finite state machine or a "goal based" AI).  That way you could have different reactions / behaviour.

But this is something that (from what I now understand) can be handled through the layered AI that GC supports. However, GC does not intrinsically provide such complex AI (neither does 3DGS !). It needs to be programmed (and it is no trivial task ... the IntenseX folks have worked on it I think for nearly two years).

So basically, what needs to be programmed (by someone ... it's not automatically Gekido's job to provide everything we need) is:

a.) A good pathfinding functionality (A* or even better CD*)
b.) A "Grid Generator" that builds up the pathfinding graph
c.) Some AI control code - the basic state machine support in GC goes a long way towards this, but GOAP (Goal Oriented Action Planning) would be "better"

Cheers,
Andreas
Logged

__________________________
Easy to use ... is easy to say ! Wink
Squat
Hero Member
*****
Posts: 592


View Profile
« Reply #21 on: January 12, 2009, 04:43:33 PM »

I decided to just go ahead and duplicate the core scripts for my own use. I need to strip them down. I've noted some things for further optimizing/enhancing the behaviors. Again, I still believe these are falling into the category of "common behaviors" that every developer can use, not just me. Even though I REALLY need it Smiley

I've noticed the AI's code for firing is not synched up with the weapon's rate of fire. The AI's trying to fire every 0-0.25 seconds.

The AI does not check to see if the enemy is dead and stop/wander. It keeps randomly deciding to shoot or move forward.

There should be a setting to "return to start" for AI that runs out to attack, kills something, and then goes back to its spot.



Just to note, I was quickly able to make every weapon be able to pull the AI from any range by adding the following to a copy of the weapon_handheld.gsl and pointing to that. It's not setting you as the enemy target, rather just sending it to where it was hit from to investigate. If you're in its range, you get targeted anyway. (I like this pulling method, gonna use it as-is in my game)

Quote
// tell the object it was hit
if (damage > 0)
{
hitObject.SetControllerVariable( "MoveTo", muzzlePos);
hitObject.SetControllerVariable( "HitNormal", normal);
hitObject.SetControllerVariable( "HitPosition", intersect);
hitObject.SetControllerVariable( "HitDamage", damage);

I can't figure out why the AI are running up to me, starting to attack and then dying by themselves. They do register that the player has died by the "IsDead" controller variable, but for some reason they're no longer taking any commands because they're dead. I should also note that they continue to fire off their attack.

I also don't know how to make my death animation stop looping.
« Last Edit: January 12, 2009, 05:58:32 PM by Squat » Logged
Ransom
Full Member
***
Posts: 132



View Profile
« Reply #22 on: January 13, 2009, 11:46:48 AM »

Hi Squat, long time no post (for me)...

Quote
I also don't know how to make my death animation stop looping

You're either calling the PlayAnim() command over and over again, or you need to set
Quote
AnimLooped [0 or 1]
in the object's OPR to 0.

Logged
Squat
Hero Member
*****
Posts: 592


View Profile
« Reply #23 on: January 17, 2009, 09:19:53 PM »

Hey, I noticed that the bad guy controller isn't recognizing when the characterobject it's controlling dies itself. It knows when the characterobject's target is dead, but even then it doesn't always register the after commands. Also, they're still killing themselves.

Here's what we need:

I think it would be nice to have options added to those controllers for what to do on death.

Respawn or at the least delete the controller object from the world that isn't needed.

A time to live on the dead Ai corpses, or a max # of corpses option would also be handy for us.

A sound file to play on the AI's death.

What sound to play on attack.

An "ALERT" phase with a timer option.

# of AI to spawn. (keep max # in world + delay time)

BTW, I've got lots of this stuff done on my end, but it's not the core scripts. I do think we all need that stuff though.
Logged
Pages: 1 [2]
  Print  
 
Jump to:  

 
Powered by MySQL Powered by PHP bluBlur Skin © 2006, hbSkins
Powered by SMF 1.1.14 | SMF © 2006-2011, Simple Machines LLC
Valid XHTML 1.0! Valid CSS!