May 22, 2012, 11:55:32 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
AI?
« on: December 27, 2008, 03:28:00 PM »

I was able to take the little lego guys and put my own characters in there with little to no effort. However, I haven't looked deeply enough into the AI to see about the weapons they're able to use. As it stands right now, I've got spiders with frickin lazer beams.

I remember reading about the different types of AI and was wondering if they're implemented yet. I admit I have not scoured the entire RC2 build for what's new quite yet, but I think I saw most of it. Then somebody mentions "ally characters" and I never saw that so maybe I missed a template?

Has anybody else played with the AI yet and gotten anything more than that out of it?
Logged
Squat
Hero Member
*****
Posts: 592


View Profile
« Reply #1 on: December 27, 2008, 06:59:30 PM »

Ok, now I've got spiders with knives and that's better because they have to get right up on you to attack. I know I can drop that out for an invisible weapon and use a biting animation or something, but there's some major concerns I have about it.

1. When I duplicate them to about 36, it lags to all mighty hell. Though, they are behaving rather nicely by basically bum-rushing me. I tried tuning the physics down, but they all start bouncing too much and then fall through the floor.

2. I can't see a way to alter their hitpoints. I saw it in the revive portion of the script, but not where it's initialized and that's a core script anyway so we need that expsed in the controller settings.

3. I've yet to grasp what you've done with the animations. Mine aren't in one animation file, they're too long and specific for that and I have to bake my IK before I export so I can't re-edit that kind of thing easily and hope I can continue to have separate animation files.

4. I don't understand how you've set up the motion blending between upper and lower body.

5. Only the idle animation appears to be taken on mine, everything is a derivitive of that. However, death and attack seem to work with the right animation, but walk or run or anything like that uses the idle animation for some reason.

6. The lego-bots can see you and shoot you through boxes with collision, but can't walk through them.

My number one concern is how we can go about getting exactly 36 AI entities to move towards and attack the player without the game dropping to 1 FPS and this is on the empty "Arena.wld" using the lego-bots only. They gotta be thinking too much and we need ways to simplify their behavior for more varied uses. I want to boil them down to basically turn and move in a straight line with the only additional call being a Y-position thing to keep it on top of stuff. I personally don't even like the notion of physics being involved, I'd rather cycle world-coordinates than bog that part down.

I'd like for the player to send the message out that he's moved and the AI not alter it's current assignment until it reads a change in that part. Also, I don't want it thinking too quickly. I want to slow that brain down to like one decision every 1 to 3 seconds. I don't mind if they go off in a straight line and smack a wall if they figure it out somewhat quickly to turn. The way it is now, the game goes into super lag mode the instant I piss about 9 of them off and pretty much freezes if I storm into the crowd and they're all on me. Clearly they're bouncing around and pushing and fighting for position and I'd rather that they just see another one in their input area and outright stop everything and idle until it's out of there, then it again just realigns itself to the player over the course of one tick and again begins to cycle the world-coordinates to get it directly there in a straight line, while somehow staying on top of stuff in a way that's not also laggy.

Put it this way, I'd like Everquest 1 AI and movement if that's possible. If a tiger was chasing you and came across a house, it would appear on the roof of the house and never slow down laterally. While I'd have problems with some aspects, I could take that notion and run with it and try to work in the vertical offset as a way to keep it's physical speed in check because it would be going about a billion miles an hour to go from the ground to the roof in one tick. I understand this is going to get quite complicated, but I'm very interested in pushing the limits of it and finding workarounds for special situations if at all possible.

Again, my goal is exactly 36 entities in one swarm without a massive hit on the CPU, not hundreds or thousands. Still, there's got to be some kind of crowd management system or something we can make to do it cleanly.

In the end, if all fails and it's not going to work out that there's a lot at once, I can still develop a decent game with only a few enemies at a time. It may just mean that each and every individual is more difficult and meaningful to the storyline. But most of me is hoping to be able to spray them down in droves. It would be the difference I guess between playing something like Left 4 Dead and Fallout 3. I can't in any way right now imagine my game idea working with swarms because if it's that bad on the simple demo, then it's basically gonna melt my computer if I put it into my actual world running something like 300k polys and 150MB of textures on multilayered shaders at any one given time. I do plan to attack my storyline as a series of worlds instead of one large one now, but how can I get more stripped down than 1 box, a player and the enemies?
Logged
gekido
Guest
« Reply #2 on: December 28, 2008, 05:28:58 PM »

Quote
1. When I duplicate them to about 36, it lags to all mighty hell. Though, they are behaving rather nicely by basically bum-rushing me. I tried tuning the physics down, but they all start bouncing too much and then fall through the floor.

the problem is that you have every single AI character that you want in your world active and 'seeking' at once - most games don't do this, they have a smaller number of enemies that are active at one time, and spawn the other enemies as the player gets near them.

Quote
2. I can't see a way to alter their hitpoints. I saw it in the revive portion of the script, but not where it's initialized and that's a core script anyway so we need that expsed in the controller settings.

hmm...will look into this - might have been overlooked.  easily enough done though.  thanx for pointing it out.

Quote
3. I've yet to grasp what you've done with the animations. Mine aren't in one animation file, they're too long and specific for that and I have to bake my IK before I export so I can't re-edit that kind of thing easily and hope I can continue to have separate animation files.

I'm working on a version of the old 'soldier' character with the full set of animations - the animation blending is fairly simple to setup, but does take a bit of figuring out to get them all setup.

Basically the weapon animations are all 'upper body only' - and are layered on top of the primary 'move' motion, which provides all of the lower body / main animations.  The various upper body motions are also layered on different motion channels which allows them to override lower-channel animations as necessary as well.

Quote
4. I don't understand how you've set up the motion blending between upper and lower body.

the simplest way to explain it is that there are a couple of OPR properties that you can specify:

Code:
MotionIgnoreObjectAndChildren Bip01
MotionIncludeObjectAndChildren Bip01 Spine1

so basically what you can do with these two is either 'ignore' a joint and it's children, or 'include' a joint and children.  What the above does is ignore everything (Bip01 is the character studio 'parent' joint) and then includes the Bip01 Spine1 joint and children - giving me only the upper body motion from the animation.

Here's my full set of motions for the Soldier from Combat:Spec Ops that you can see in this video:

Code:
LoadObject ForceRecon.FBX
LookAtCenter 0 1.5 0

LoadAnimation Idle combatIdle.FBX
LoadAnimation Walk combatWalkRifle.fbx
LoadAnimation WeaponHandheld WeaponHandheld.fbx
LoadAnimation CrouchWalk combatCrouchWalkRifle.fbx
LoadAnimation CrouchIdle combatCrouchIdleRifle.fbx
LoadAnimation IdleCrawl IdleCrawl.FBX
LoadAnimation ForwardCrawl ForwardCrawl.FBX

# Motions

AddMotion IdleMotion
MotionAnim Idle
MotionScalarRef 0.5
MotionSelectVar Velocity
MotionSelectMax 0.2
MotionFadeInTime 0.1
MotionChannel 0

AddMotion WalkMotion
MotionAnim Walk
MotionScalarVar Velocity
MotionScalarRef 2
MotionSelectVar Velocity
MotionSelectMin 0.2
MotionFadeInTime 0.1
MotionChannel 0

AddMotion CrouchIdleMotion
MotionAnim CrouchIdle
MotionScalarRef 0.5
MotionSelectVar Velocity
MotionSelectMax 0.2
MotionFadeInTime 0.1
MotionChannel 0

AddMotion CrouchWalkMotion
MotionAnim CrouchWalk
MotionScalarVar Velocity
MotionScalarRef 2
MotionSelectVar Velocity
MotionSelectMin 0.2
MotionFadeInTime 0.1
MotionChannel 0

AddMotion ProneIdleMotion
MotionAnim IdleCrawl
MotionScalarRef 1
MotionSelectVar Velocity
MotionSelectMax 0.2
MotionFadeInTime 0.1
MotionChannel 0

AddMotion ProneWalkMotion
MotionAnim ForwardCrawl
MotionScalarVar Velocity
MotionScalarRef 1
MotionSelectVar Velocity
MotionSelectMin 0.2
MotionFadeInTime 0.1
MotionChannel 0

AddMotion Move
MotionChild IdleMotion
MotionChild WalkMotion
MotionChannel 0

AddMotion CrouchMove
MotionChild CrouchIdleMotion
MotionChild CrouchWalkMotion
MotionChannel 0

AddMotion ProneMoveWeaponHandheld
MotionChild ProneIdleMotion
MotionChild ProneWalkMotion
MotionChannel 0

AddMotion WeaponHandheld
MotionAnim WeaponHandheld
MotionTimeVar LookUpDown
MotionIgnoreObjectAndChildren Bip01
MotionIncludeObjectAndChildren Bip01 Spine1
MotionChannel 0

AddMotion MoveWeaponHandheld
MotionChild WeaponHandheld
MotionChild Move
MotionChannel 0

AddMotion CrouchMoveWeaponHandheld
MotionChild WeaponHandheld
MotionChild CrouchMove
MotionChannel 0

Quote
5. Only the idle animation appears to be taken on mine, everything is a derivitive of that. However, death and attack seem to work with the right animation, but walk or run or anything like that uses the idle animation for some reason.

You need to setup the motion variables for your 'Move' animation properly based on the speed of the character's movement:

So if you have an 'idle' motion and a 'walk' motion like so (i've removed everything but the important bits):

Code:
AddMotion IdleMotion
MotionAnim Idle
MotionSelectVar Velocity
MotionSelectMax 0.2

AddMotion WalkMotion
MotionAnim Walk
MotionSelectVar Velocity
MotionSelectMin 0.2

What this does is specify that you have an idle motion that will only be selected (ie - played) when the motion variable 'Velocity' is below 0.2.  The Walk motion is only selected if Velocity is above 0.2.

Code:
AddMotion Move
MotionChild IdleMotion
MotionChild WalkMotion

The Velocity variable is set automatically by the character script and will set your character to automatically switch between the two animations based on it's speed.  The 'Move' motion itself is what the script calls (plays) to set the character in motion, and by updating the Velocity variable, the character will automatically switch animations based on how fast their are moving.

Adding a Run motion is the same, except that you would want to have a MotionSelectMax for your walk motion as well.  You can see an example of this in the Simple Character.opr

Quote
My number one concern is how we can go about getting exactly 36 AI entities to move towards and attack the player without the game dropping to 1 FPS

If you want dozens of AI characters active in a world at once you probably need to be doing the AI differently - for example using a higher-level 'hive mind' kind of script that controls more than one enemy.

The other option is to reduce the amount of time that each Ai script is being calculated - so only a small sub-set of characters is 'active' at one time - this is what alot of games do. The AI characters basically do a round-robin style of processing, so they only update the player's position etc every so often, instead of continually processing.

Either way, your probably going to require custom scripting for this - which is one of the nice things about the layered system that we're using for the AI - you can create / modify the AI script and still use the lower-level functionality that the character / weapon scripts use 'as is'.
« Last Edit: December 28, 2008, 05:37:42 PM by gekido » Logged
Squat
Hero Member
*****
Posts: 592


View Profile
« Reply #3 on: December 28, 2008, 07:46:12 PM »

Sweet, thanks for the info on the animations.

I'm going to start trying to get something playable with my characters and weapon against some simple AI and see if I can't put together an actual playable game in a week or two.

I guess my first plan will be to try and slow down the decision making for the AI that's in there, and then see if I can't figure out how to get one script to control a group of characters. I'll start by just trying to get 2 to 3 function under the same script and I guess I'll see about what parts I can strip out that I don't really need. Some of the hearing and FOV abilities are more than I need. I actually just want them to spawn and go right for you.

I should note that I tried this without any paths in the world and I will need those in my game. I should start testing that out and see what I can get.

I hope to be asking specific questions concerning the code from now on and if I get anything working, I'll post it up so others can have it too.
Logged
gekido
Guest
« Reply #4 on: December 29, 2008, 02:24:43 AM »

without paths might cause problems as the AI assumes that there are paths in the world and may be overloading things while they all are constantly looking for paths - once they have a path things should mellow out quite a bit.

we did specifically setup the AI so they aren't updating / scanning for the player all of the time, so they should be somewhat easy (compared to the old NPC scripts) on the performance, but we haven't done a whole lot of load-testing of it yet.

the default character script itself and pathfinding system is actually pretty optimized already though - we've run scenarios with hundreds of characters in scenes following paths and kept up pretty good framerates.
Logged
Squat
Hero Member
*****
Posts: 592


View Profile
« Reply #5 on: December 29, 2008, 10:05:12 PM »

That sounds pretty good and I'll report my results with using paths.
Logged
Squat
Hero Member
*****
Posts: 592


View Profile
« Reply #6 on: December 30, 2008, 01:24:34 PM »

So far, using paths has given me approximately one hundred billion percent better performance. J/K, it's not saving the entire world, but it's DEFINITELY better. I've got something like 14 AI's right now and it feels smooth and they're still the super-thinkers from RC2 and i've pissed them all off at one time and they're still climbing on top of each other to get to me.

However, I still can't get the damn things to use any animation other than what's set for IDLE. If I put a walk animation in the idle motion, they walk in place and walk to me and walk to attack, BUT they use the death animation when killed. However, this animation is perpetually looping and I can't stop it (unlike the lego-man, who's defined the death motion as "false" and doesn't repeat. If I put the death animation in the idel motion, they die over and over again no matter what.

Here's my .OPR with the non-related stuff stripped out.
Quote
# Animations            #
#
AlwaysAnimate 1
LoadAnimation Walk SpiderWalk.FBX
LoadAnimation Idle SpiderWalk.FBX
LoadAnimation Death SpiderDie.FBX

#
# Motions               #
#

AddMotion Death
MotionAnim Death
MotionChannel 5
MotionFadeInTime 0.1

AddMotion IdleMotion
MotionAnim Idle
MotionSelectVar Velocity
MotionSelectMax 0.2
MotionScalarVar Velocity
MotionScalarRef 0.1

AddMotion WalkMotion
MotionAnim Walk
MotionSelectVar Velocity
MotionSelectMin 0.2

AddMotion Move
MotionChild WalkMotion
MotionChild IdleMotion



ObjectScale 0.1500 0.1500 0.1500

ControllerType Scripted
ControllerSetting DefaultScript Characters/network_character.gsl
Logged
Squat
Hero Member
*****
Posts: 592


View Profile
« Reply #7 on: December 30, 2008, 01:27:31 PM »

BTW:

Quote
MotionScalarVar Velocity
MotionScalarRef 0.1

Was added to the IDLE because that animation is running slow when I use my run cycle. I've set the value from 0.001 to 9.999 and not gotten any difference in the animation speed that's being called by the IDLE motion, even though clearly IDLE is being used for both IDLE and WALK by my AI. So, it doesn't work and doesn't help to remove it.
Logged
Squat
Hero Member
*****
Posts: 592


View Profile
« Reply #8 on: December 30, 2008, 01:32:27 PM »

Lastly:

Quote
LoadAnimation Idle SpiderWalk.FBX

is supposed to be:

Quote
LoadAnimation Idle SpiderLOOK.FBX

Again, I'm trying to figure out what motion is being used. I perhaps am missing some motions like weaponhandheld that are being called in the script? Why is the script running the animations? I wanted the motionselect simplicity and not have to write too many animation contollers. As far as I understood, what I have in my .OPR should be working, correct?

WhyTF doesn't it switch to the walk animation and whytf doesn't the speed of the animation scale with velocity? My files were working fine before but I suppose I can try re-exporting with a newer .FBX module.
Logged
Squat
Hero Member
*****
Posts: 592


View Profile
« Reply #9 on: December 30, 2008, 04:06:34 PM »

I have very nice performance with 36 AI all pathfinding as long as not many are seeking me at any one time. I have noticed that even one AI seeking me drops the framerates significantly and I can see in the code that it's updating our position, it's angle and sending a "moveto" command every dynamics step once it's aggro.

Can't it just be told "moveto" once?

Can it be told "MoveAlongPathTo" instead?

Doubling the number to 72 significantly reduces performance.

Setting the AI to imposters improves performance drastically, though I noticed they often disappear.

The "performance setting" for your character's .OPR to set max distance and distance fade don't appear to take hold on the spawned entities. They're in full view always regardless of those settings.

All of the pathfinding tutorial worlds cause my editor to crash with a fatal exception.

I want to add some behaviors, such as once it's pissed off, it doesn't lose you by way of sight anymore. If I make the sight detection very low so I have to run right up and it chases, I have to keep myself really close to it for it to keep coming because it gives up. I'd like to increase that value dynamically once it's aggro. I'd also like to be able to aggro them from shooting them one time aswell as add the ability for it to enter other AI's radius and transfer the target and aggro so anything it passes joines the hunt...again, kind of a hive mind thing. I very much plan to actually increase the bahaviors for single AI entities such as boss characters and whatnot throughout the game, but right now I'm all about the drones.

Would we benefit any way from trying to put the AI's in groups and managing the group's behavior? Or does the distribution of commands basically cancel that out?

Some of these aspects and questions I know the answer to already, but I think they help anybody else looking to figure out putting their own stuff in to read about that and see how it affects them.

Behavior is pretty sweet and framerates aren't the worst ever. I think it's close to something I'm going to be confident putting into my game. Again, I don't even really want more than 36 at once and it seems to be playable with that.

Last, but not really, I didn't see a place to add a death FX to the characters. Perhaps the players want to make things explode or show blood or something. Can we get a controller setting for that? Also would nice for a time to live on the corpses and perhaps a fade time until they're deleted from the world. My game's action, so there's no freakin way I can leave that much crap lying around.

Here's some fun I've been having with it. This was very laggy and yes, those are knives.

Logged
Merrie
Full Member
***
Posts: 149



View Profile
« Reply #10 on: December 30, 2008, 10:37:40 PM »

Oh look at those little guys with /big/ knives Smiley Though I did get quite a chuckle with the laser beam spiders.
Logged

+---+---+----+----+----+----+----+----+----+----+----+----+
Vibe GameCore Training Graduate
3D Modeler - 3DS Max, AC3D, Gimp
GameCore Indie, Windows XP Media, Alienware Area 51 7500
Squat
Hero Member
*****
Posts: 592


View Profile
« Reply #11 on: December 30, 2008, 11:32:13 PM »

The fricken lazer beam spiders were kicking my ass big time, LOL.
Logged
grubert
Full Member
***
Posts: 183


Everybody is very nice, but my jacket disappeared.


View Profile WWW
« Reply #12 on: January 01, 2009, 01:34:34 AM »

I guess they?ve spill some venom in those blades before attack, when planning. Grin

Wish I had some time to play with the new stuff.
A question for you that are exploring the new templates: is there documentation for them somewhere, like in the User Guide (I?ll take a look there later)?


Cheers!
Logged

my portfolio and weekly posting:
http://athossampaio.blogspot.com
acocq
Full Member
***
Posts: 164



View Profile
« Reply #13 on: January 06, 2009, 08:45:17 AM »


Sorry for hijacking this thread ...

I read that RC2 allows for "layered" AI ... what does this mean ?  And how will it help in the development of AI ?

AI is not my field of expertise, but I am accumulating some knowledge because I work with Intense Illusions' IntenseX plugin for 3DGS.

One thing I find impressive with it is that it is goal-oriented instead of just a finite state machine. Adding new goals is a reasonably simple (and quick) process. Sure, you need to know how to program in order to add custom goals etc., but the base package.

From what I've read so far, the GC AI is not intrinsically goal-based, but is rather state based ... is that correct ?

Cheers,
Andreas
Logged

__________________________
Easy to use ... is easy to say ! Wink
gekido
Guest
« Reply #14 on: January 08, 2009, 05:56:32 PM »

To answer the OP question:  Yes they can be instructed to MoveAlongPathTo instead of simply MoveTo

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. 

Using this same technique, you could add another layer on top of the AI to handle things like squad behaviors or other kinds of 'grouped' behaviors - and so on. The system is designed to be very freeform, and would definitely let you setup all kinds of advanced goal-based systems.

I'm working on a project that is using the same AI script for enemy characters, friendly squadmates that the player can control as well as friendly characters that are not under the player's direct control.  How they behave depends upon how you specify their goals and objectives.
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!