Jetting for AI?

Scripting questions, discussions, etc
  • 1
  • 2
17 posts Page 1 of 2
cybore
Posts: 29
Joined: Fri Feb 13, 2015 10:18 am
by cybore » Tue Sep 15, 2015 5:24 pm
Has "jetting" capabilities for AI ever been successfully accomplished in Torque 3d?
rlranft
Posts: 298
Joined: Thu Feb 05, 2015 3:11 pm
 
by rlranft » Thu Sep 17, 2015 3:03 pm
It's on my to-do list (it's not a very long list but I rarely get around to it) because a game I'm tinkering with needs it, too. For a player you'd just do something like this:
function altTrigger(%val)
{
   $mvTriggerCount1++;
}

moveMap.bind( mouse, button1, altTrigger );
For an AIPlayer though - I don't think it applies because they don't even use the move map. I'll have to think about this. If I get it working I'll drop it here.
cybore
Posts: 29
Joined: Fri Feb 13, 2015 10:18 am
by cybore » Thu Sep 17, 2015 3:38 pm
Thanks riranft. I have tried several different approaches, "altTrigger" being one of them, to no avail. I've also tried getting AI to recognize "z" co-ordinates, but the AI will only recognize x and y. In the original Tribes, I believed they used a "gainHeight" function for the AI to "simulate" jetting. I have yet to figure that out though.
Steve_Yorkshire
Posts: 252
Joined: Tue Feb 03, 2015 10:30 pm
 
by Steve_Yorkshire » Thu Sep 17, 2015 5:41 pm
MoveTrigger's are all simulated in the AIPlayer.cpp getAIMove() function. You'd have to write a function (and expose it to TS) to activate the jetting moveTrigger. Navmeshes do the same with the "jump" moveTrigger in AiPlayer.cpp line ~585 and I wrote some functions for AI to use the "pose" moveTrigger.
rlranft
Posts: 298
Joined: Thu Feb 05, 2015 3:11 pm
 
by rlranft » Fri Sep 18, 2015 2:34 am
I think it should be:
%aiplayerobj.setMoveTrigger(1); //this is alt trigger, but pretty sure that's default for jet
// to stop
%aiplayerobj.clearMoveTrigger(1);
cybore
Posts: 29
Joined: Fri Feb 13, 2015 10:18 am
by cybore » Fri Sep 18, 2015 3:15 am
That actually works riranft. Once the trigger is enabled, the ai player jets straight up. I need to tweek my ai scripts to regulate air control, but it does work. Thanks!
cybore
Posts: 29
Joined: Fri Feb 13, 2015 10:18 am
by cybore » Fri Sep 18, 2015 8:00 pm
Has anything changed with "air control" in 3.7? I can't seem to get it working for my player or for the ai.
rlranft
Posts: 298
Joined: Thu Feb 05, 2015 3:11 pm
 
by rlranft » Sat Sep 19, 2015 2:59 am
Air control should be the same - but the AIPlayer has to be moving in the desired direction as well as jetting. It helps if they're moving before they leave the ground. You may need to tweak the value in the datablock.
cybore
Posts: 29
Joined: Fri Feb 13, 2015 10:18 am
by cybore » Sat Sep 19, 2015 3:39 am
I may have something screwed up. When I set my air control, my player barely moves in the direction I aim it. The jetting is working fine, but I get very little air control.
rlranft
Posts: 298
Joined: Thu Feb 05, 2015 3:11 pm
 
by rlranft » Sat Sep 19, 2015 5:25 pm
Check the value in the AIPlayer datablock - the default should be set in the DefaultPlayerData datablock in art/datablocks:
datablock PlayerData(DefaultPlayerData)
{

// ....
   jumpForce = "747";
   jumpEnergyDrain = 0;
   minJumpEnergy = 0;
   jumpDelay = "15";
   airControl = 0.3;

// ....
};
You can override it for your AIPlayers in their separate datablocks, for instance to have heavier units have less control and ligher units more:
datablock PlayerData(DemoPlayer : DefaultPlayerData)
{
   shootingDelay = 2000;
   // added:
   airControl = 0.6; // or whatever you like
};
In theory, this should allow you to tune your AI movement.
  • 1
  • 2
17 posts Page 1 of 2

Who is online

Users browsing this forum: No registered users and 1 guest