### AITurrets are too weak

There are no stupid questions, just stupid answers.
• 1
• 2

#### AITurrets are too weak

Code_Man
Posts: 55
Joined: Fri Jan 26, 2018 9:12 pm
I have been trying to play with turrets but despite tweaking the hell out of them i must say they feel pretty weak and useless.

Is it correct that AITurret can only rotate in 180 degrees?
Is there some way to hack around this?

Also is the turret required to see a player in order to target him?
Would it be possible to have the turret attack the player instantanious once he is within line of sight?

#### Re: AITurrets are too weak

Duion
Posts: 1120
Joined: Sun Feb 08, 2015 1:51 am

Well anything is possible, since you have the source code, it is just a question how much work it will be.

For example you could make the turrets always see the player no matter if there are walls etc and then raycast constantly if he is visible and then shoot instantly, thats how my bots work for example.

#### Re: AITurrets are too weak

fLUnKnhaXYU
Posts: 49
Joined: Wed Nov 15, 2017 8:19 am
The scanning seems a bit difficult to set up reliably . Im having trouble setting it up to where i cant just walk up to it . I am not a coder , i just use the editor and scripts as best I can .

#### Re: AITurrets are too weak

Chelaru
Posts: 201
Joined: Wed Jul 01, 2015 10:33 am
I did some work on the turret and i agree with you. Is a bit meh. To better understand the how turrets work you should take a look at some unreal or unity turret tutorials. After that you will have a better understanding. My opinion is that we need a new "general" turret tutorial and a new model. I started work on this but got stuck at the model part. Now i don't have time to finish it. I wish you good luck.

#### Re: AITurrets are too weak

fLUnKnhaXYU
Posts: 49
Joined: Wed Nov 15, 2017 8:19 am
I think that one of things to be sure and do is point the aiturret in the direction
it is to guard against else , as in my case , you could walk right up behind it .
Leads me to believe that it isnt scanning 360 degrees . Maybe the idea is so not to
have it turn against its own team .

Remember the datblock names where these fields are found , they can be refered to as
you wisht to access them in scripts .
*unless Im mistaken of course .

you could try these few edits to some default datablocks below . Everything is in
the one file mentioned below .

I'd like to add that the easiest way is to create a new datablock in the datablock
editor , Then you can hack away at whatever you like without worry of messing up
the original file . You can then assing your AI turret the new datablock , but in
my case it created a new object with the new datablock name which i can add through
the world editor , ..neato .
// ./art/datablocks/weapons/turret.CS

//---------------------------------------

datablock ProjectileData( TurretBulletProjectile )
{
projectileShapeName = "";

directDamage        = 500;//default = 5//<-------------THIS HELPS , 1 hit is 500 DMG
areaImpulse         = 0.5;
impactForce         = 1;

damageType          = "TurretDamage";  // Type of damage applied by this weapon

explosion           = BulletDirtExplosion;
decal               = BulletHoleDecal;

muzzleVelocity      = 120;
velInheritFactor    = 1;

armingDelay         = 0;
bounceElasticity    = 0;
bounceFriction      = 0;
isBallistic         = false;
gravityMod          = 1;
};

//------------------------------------------------
datablock AITurretShapeData(AITurret)
{
// Rotation settings                 //JUST EXPERIMENT WITH THESE AND DONT GET DISCOURAGED
//The numbers to the right of the remarks are defaults
minPitch = 90;//15//<-------------------------
maxPitch = 90;//80//<-------------------------
pitchRate = 359;//50//<-----------------------

// Scan settings

maxScanPitch = 90;//10//<---------------------
maxScanDistance = 300;//20//<-----------------
trackLostTargetTime = 2;

maxWeaponRange = 300;//30//<------------------

accufire = 1;//-------------------------------not so sure what it is

//======================================== YOU CAN EXPERIMENT WITH THESE TO SEE
//======================================== HOW YOU CAN ASSIGN DIFFERENT WEAPON
//======================================== DATABLOCKS TO THE MOUNT/S PLACED IN
//======================================== THE MODEL
//
//THIS ONE IS THE DEFAULT AITURRET WEAPON

//   weaponAmmo[0] = AITurretAmmo;
//   weaponAmmoAmount[0] = 10000;
//
//   maxInv[AITurretAmmo] = 10000;

weaponAmmoAmount[0] = 10;

//-=============================================

{
//   Basic Item properties
emap = true;

//   Specify mount point
mountPoint = 0;

//   Add the WeaponImage namespace as a parent, WeaponImage namespace
provides some hooks into the inventory system.
class = "WeaponImage";
className = "WeaponImage";

Projectiles and Ammo.
ammo = AITurretAmmo;

projectile = TurretBulletProjectile;
projectileType = Projectile;
projectileSpread = "0.005";//0.02//<---------------- THIS HELPS ACCURACY
//YOU CAN EVEN MAKE IT
//ZERO

//===========================================================

This is a really nice fun engaging Item for levels with lots of potential for good game play .
I havent even tried out the turret like the one mounted on the cheetah , Have to try my hand at
building a nice vehicle for just that .

#### Re: AITurrets are too weak

fLUnKnhaXYU
Posts: 49
Joined: Wed Nov 15, 2017 8:19 am
OK , this was necessary too . See the lifetime field . Its necessary for projectile covering longer distance .
datablock ProjectileData( TurretBulletProjectile )
{
projectileShapeName = "";

directDamage        = 500;//default = 5//<-------------THIS HELPS , 1 hit is 500 DMG
areaImpulse         = 0.5;
impactForce         = 1;

damageType          = "TurretDamage";  // Type of damage applied by this weapon

explosion           = BulletDirtExplosion;
decal               = BulletHoleDecal;

muzzleVelocity      = 120;
velInheritFactor    = 1;

armingDelay         = 0;
lifetime            = 5000;//   992;//<----------------------at 992 the projectile only exists for a couple hundred meters ,
//,---------------------- 5000 seems to be 800 meters  , give or take .
bounceElasticity    = 0;
bounceFriction      = 0;
isBallistic         = false;
gravityMod          = 1;
};

The lead velocity seems a bit tricky with weird things happening close to the turret even turning away as i would walk forward in front of it . So, Im playing around with that now , as it seems quite useful for AI . Anyway , these couple of changes were quite effective , I think , and the turret turned out to be quite a bit more fun .

#### Re: AITurrets are too weak

Code_Man
Posts: 55
Joined: Fri Jan 26, 2018 9:12 pm
I read that a cone in the model of a turret is used as the scan angle specifier, however i dont know how exactly this works.
Does anyone know if such a cone could be used to make a full 360 scan angle or scans in multiple direction at the same time.
Is there a point in this kind of specification vs datablock field?

Another problem i have is that it seems i cannot read out the items in the ignore list, which is troublesome to me.

I havent done much experimentation with turrets otherwise so far.

#### Re: AITurrets are too weak

Azaezel
Posts: 413
Joined: Tue Feb 03, 2015 9:50 pm

it's not so much a 'model' as a construction based on the entries to make a trigger and an set of angle checks. you can see the particulars of that right around https://github.com/GarageGames/Torque3D ... e.cpp#L733

on the ignore list end, theres a few methods listed https://github.com/GarageGames/Torque3D ... 1243-L1279 that'll let you drill down there. though personally, I found it far simpler to just stick to adding a U8 to shapebase for teams and doing up a compare in https://github.com/GarageGames/Torque3D ... e.cpp#L373 and be done with it.

#### Re: AITurrets are too weak

Code_Man
Posts: 55
Joined: Fri Jan 26, 2018 9:12 pm
The methods to read the ignore list are either not available or not documented in the torquescript api.

Thanks for pointing them out, i will certainly try these.

#### Re: AITurrets are too weak

fLUnKnhaXYU
Posts: 49
Joined: Wed Nov 15, 2017 8:19 am
Torque 3D Documentation Release 3.5.1

page 529

AiTurretShape
Shape file nodes
scanPoint node
If the scanPoint node isn't present within the shape file then the turret's world transform is used .
aimPoint node
If the aimPoint is not found on the turrets shape then the pitch node will be used .

page 618
turretShape
shape file nodes
pitch -

says both nodes are controlled by the turretShape code and shouldnt be animated by the artist , nor should
it have anything but its default transform applied to it .

p. 621
Turret Optional Animation Sequences "heading" and "pitch" will be played as the turret rotates . And
mentions , may be used for animating wheels or gears during the rotation .

I imported the DAE's into Blender and I didnt see any of the nodes mentioned here in the turret_head or
Turret_legs DAE files in the art/shapes/weapons/Turret folder .

--------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------

Doesnt exactly clear it all up , but Id expect that you could probably animate the the scanPoint node or
its parent like with the eye node being animated throught moving the head node in a player model.
maybe 90 degrees right and left might achieve 360 degrees . but really it seems that scanning from the
turrets world transform while using the terrain type mask sounds like potential problem and it "appears"
that that is what is being done .
• 1
• 2

#### Who is online

Users browsing this forum: No registered users and 3 guests