SteeringController

All topics about ZGameEditor goes here.

Moderator: Moderators

Post Reply
User avatar
rrTea
Posts: 475
Joined: Sat Feb 15, 2014 9:54 am

SteeringController

Post by rrTea »

I'm trying to use SteeringController to make some enemies chase the player, think an arena with a few static walls and a player vs a pack of enemies. But I just can't get the enemies to behave right no matter what I try.

Before getting into details, just to confirm something: in the video (recorded using the SteeringController example that comes with ZGE, only I didn't spawn any BoidModel), it can be seen how the "CursorModel" bounces off the wall even when it's half a screen away from it. I didn't record it, but it also starts "spasming" (moving in the style of "two step forward, one step backward") if I keep the cursor behind the wall on the side opposite of the model... Is this how it's meant to behave or is this a bug?
Attachments
Capture-057.avi
(2.13 MiB) Downloaded 445 times
Last edited by rrTea on Tue Nov 17, 2015 3:19 am, edited 1 time in total.
User avatar
rrTea
Posts: 475
Joined: Sat Feb 15, 2014 9:54 am

Re: SteeringController

Post by rrTea »

One thing I can't get right is adding solid walls to the player + chaser situation.

The first thing I tried is to define a collision between categories of the wall and chaser with Action set to "Stop". This works well in the sense that the Chaser stops in front of the wall, but then it starts oscillating between two directions, which looks very bad. I dont' understand why doesn't this work smoothly? I'm attaching a video.

The next thing I tried is adding a SteeringBehaviour / Kind: WallAvoidance2D to it, like it is set in the example file ("Steering.zge") that comes with ZGE (for now I left the noise and separation behaviours out), but in my case the Chaser just passes through walls when it's perpendicular to the model it's chasing. Under certain circumstances the chaser also starts shaking uncontrollably.

The component that guides the chaser is here:

Code: Select all

ZZDC<?xml version="1.0" encoding="iso-8859-1" ?>
<SteeringController Comment="Seek Player" Mass="0.5" MaxSpeed="4" MaxForce="8" AdjustHeading="255" Radius="0.15">
  <Behaviours>
    <SteeringBehaviour Kind="5" TargetCategory="2" Weight="10"/>
    <SteeringBehaviour TargetModel="mod_Player" TargetCategory="1" Weight="2"/>
  </Behaviours>
</SteeringController>
The only solutions to this I know of is to bump the WallAvoidance2D Weight to 100 or so, but this also results in Chaser "spasming" when it reaches the point perpendicular to its target. Also the Weight in the example file is only 10 and yet the "boids" never pass through wall and they spasm much less. What am I doing wrong?
Attachments
Capture-059.avi
Using a collision: it works great, except for the "shaking" effect.
(852.86 KiB) Downloaded 420 times
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Re: SteeringController

Post by jph_wacheski »

hi rrTea, I have used SteeringControllers a fair bit in my productions,. I have found they are very useful in creating interesting interactions, however they are a tad unpredictable and require a lot of tweaking to get useful results.

It is probably best not to rely of the AdjustHeading for the objects animation (works sometimes for simple things), as indeed it will get jittery often. Instead set this with some other code like "pointToPlayer",. .

I use several SteeringControllers with different SteeringBehaviors on each object,. with timers and switches to get useful effects. balancing all the waights and settings is where all the fun is ;)

attachment my be useful to look at, (or not) to see how I abuse the system,. .
Attachments
avoidance_03.zgeproj
here are some ideas,.
(6.48 KiB) Downloaded 522 times
iterationGAMES.com
User avatar
rrTea
Posts: 475
Joined: Sat Feb 15, 2014 9:54 am

Re: SteeringController

Post by rrTea »

Hi! Yeah I guess it's best not to use AdjustHeading for anything other than super simple situations and just do whatever has to be done (like rotating the model, collisions...) manually.

Thanks for the example file!
Post Reply