Improving Chopper AI in Battlefield 42

by Ghostwriter

 

This could be a way to set up helicopters to have better flight control. I am not sure if you can script this for bots but at least a human player will be able to use them.

Going by keyboard flight control examples "upArrow" "downArrow" "left/rightArrow" keys.

The key will be to setting the pitch forward / backward control in an unconventional way. A similar adjustment to setting roll left / right to compliment it should do the trick.

The max pitch foward must be set so that it is the least possible, just enough to where a stable copter will go forward but not down too fast.

THIS MUST ALSO BE THE DEFAULT SETTING FOR "accelerate". No more just straight up.

The forward button "upArrow" is off and won't be used.

The max pitch backward also must be set to a minimal so that holding the backward "downArrow" key down will keep the copter level. Getting it stable hovering in this way is the primary objective.

Holding the backward button "downArrow" will let you hover, letting go will automatically move forward, but also go down. It would just be a matter of holding down and letting go the "downArrow".

Now to turn, again it will be setting the max values to the absolute minimums so that even holding the "leftArrow" or "rightArrow" down, the copter will turn as slowly as possible. (For Now)

You can always adjust the movement for performance after you get stability in this way.

There should be no ability for an angle to drift backwards, even slightly if you hold "downArrow" too long, that might ruin the stability. Would be better to turn left or right effectively and change forward direction.

Of course you would have to set the max altitude as low as possible, just enough to clear any terrain/objects but always able keep ground targets in sight. This will give gunners max ability to use MGs.

You might want to increase the armor so that the copters can become airtanks, sorta. I am hoping that this also might be able to be scripted for bots.

"BotDeath from Above" ack!

That setup would probably work for bots pretty well as the heli would fly similar to a plane. The biggest problem I have had to work with in getting decent ai heli pilots was rolls, I have been working on a behaviour setup that seems to improve it quite a bit, as well as constantly tweaking the ai control settings until one day, if I live long enough, they will fly better then me.

One thing that works really well with current dc heli's, for both humans and bots, is to set a down angle on the camera and weapons so that you can be flyiing straight and level but your crosshair and weapons will fire down allowing easier ground targeting without having to pitch causing you to drive forward too much. I have set the camera's and weapons to rotate to 0/2.55/0 and it is pretty good like that. Another thing I changed that made a vast improvement on bots firing rockets at ground targets was to make the original weapons racks to fire fake and move the actual projectile firing postions to a point closer to the originator so they are more accurate at long range. Of course to get them to actually fire the rockets means you have to adjust the mass/drag to a value that is more bot friendly.

The bots do not use the choppers in bf well for this reason .. it is coded as an airplane. In DCX Zuser coded the choppers by moving the engine back in the choppers and set them up as "AI Only" choppers and they worked fairly well. Basicly bots DO NOT use the choppers well in the bf refractor engine. They made changes to the choppers in bfv so that the bots use them much better.

realized while trying to fly the choppers that it was set up like the airplanes, as soon as I tried to turn tongue.gif

I have seen that there is some control over the response in the planes in the mods (much better balance than the original settings). I don't know how much control though.

It would be the equivelent of being able to make a plane unable to do a barrel roll by limiting its max movement variables.

If you can do that scripting a plane, then you should be able to force stablization of the choppers in a similar manner that I proposed.

Can't blame a guy for trying to find a way. I don't mind if the choppers aren't totally functional. It is nice to hear them flyin around as backgrownd noise.

If nothing else, the bot pilots keep the enemy bots looking up while we sneak in under their noses.

 

This is what started me wondering about this. The bots equate "accelerate" with forward movement. I don't think you can code a way for them to "understand" going up is forward so they spend all their time stabizing.

Also the copters act and feel like a plane with a propeller on its head. Real copters have stablizers. Slowing down significantly the left/right roll should do the trick. This should also take care of the yaw that automatically happens when you turn in planes so bots won't overcorrect when trying to turn.

Adjusting the resistance for left/right roll might be the simple part, getting the bird to go forward as default on acceleration I would think is the tricky part. And disabling the "forward stick control" would be best for bf42.

The focus on control for bots would be to "keep pulling back on the stick" to level off and counteract the yaw slide when turning. Stablize the copter and the bot is free to do targeting.

Forward momentum will be a concern possibly for the bots if going too fast. Unless the copters are big lumbering airtanks that move very slowly (Would be nice to see those russian bohemoths move like that).

Ok, well you peaked my interest in messing with these again and I think I have found a solution that works really well for what I want.
Instead of making helicopters into slow planes, I messed around with making them fly more like helicopters really do... sort of.

I added wings that cause you to turn on a roll instead of just rolling sideways. Then added a vertical wing that forces the helicopter body to stay upright unless you apply roll, or pitch. Then I added a flap that creates positive pitch as soon as you start moving forward, this allows you to fly straight ahead with pitch instead of just diving forward, also maintains lift so you can get going pretty fast without having to pull up.

I only made a few moderate changes to the basic engines, just to increase torque to compensate for the wings drag, and the rear airbrake. I also modified the acceleration of the roll speed so you cannot roll over fast-- mostly because this is the biggest problem for the ai.

At hover it flies just like regular dc choppers, but at speed it flies alot more like a real helicopter does, although the pitch wing is more evident then it should be, it is easy to get used to and seems to force the ai to fly forward instead of just straight up and back. I wanted to try and eliminate roll at hover, as well as backward movement but couldn't find a way with the current engines so this will have to do for now.

I think like this they are actually alot more fun to fly and the ai seem to have no problem with them. I have tested in a map with all helicopters and the bots were flying around all over the place and killing each other and crashes were more rare then with regular planes.

QUOTE
If you have a chance to try changing the settings, could you test the ideas in these posts and let me know if they came close to working?


Ok, well you peaked my interest in messing with these again and I think I have found a solution that works really well for what I want.
Instead of making helicopters into slow planes, I messed around with making them fly more like helicopters really do... sort of.

I added wings that cause you to turn on a roll instead of just rolling sideways. Then added a vertical wing that forces the helicopter body to stay upright unless you apply roll, or pitch. Then I added a flap that creates positive pitch as soon as you start moving forward, this allows you to fly straight ahead with pitch instead of just diving forward, also maintains lift so you can get going pretty fast without having to pull up.

I only made a few moderate changes to the basic engines, just to increase torque to compensate for the wings drag, and the rear airbrake. I also modified the acceleration of the roll speed so you cannot roll over fast-- mostly because this is the biggest problem for the ai.

At hover it flies just like regular dc choppers, but at speed it flies alot more like a real helicopter does, although the pitch wing is more evident then it should be, it is easy to get used to and seems to force the ai to fly forward instead of just straight up and back. I wanted to try and eliminate roll at hover, as well as backward movement but couldn't find a way with the current engines so this will have to do for now.

I think like this they are actually alot more fun to fly and the ai seem to have no problem with them. I have tested in a map with all helicopters and the bots were flying around all over the place and killing each other and crashes were more rare then with regular planes.

Here is for the sa-342, the setup is pretty much the same for every helicopter you want to add this too. But the ai settings I have are a little different for each one, the plugin I included here does not work well with the mi24d or uh-60's but works fine with all the others.

Sa-342 objects.con. add these lines in the common complex bundle, right under the engines......


CODE
rem *** SA342Common ***


ObjectTemplate.addTemplate Gaz_Front_Wing
ObjectTemplate.setPosition 0/0/5
ObjectTemplate.setRotation 0/0/-90
ObjectTemplate.addTemplate Gaz_Rear_Wing
ObjectTemplate.setPosition 0/0/-5
ObjectTemplate.setRotation 0/0/-90

ObjectTemplate.addTemplate Gaz_Wing_Right
ObjectTemplate.setPosition 4/0/0
ObjectTemplate.addTemplate Gaz_Wing_Left
ObjectTemplate.setPosition -4/0/0

ObjectTemplate.addTemplate Gaz_Dive_Wing
ObjectTemplate.setPosition 0/0/-4.5



Physics.con

CODE

rem *** Gaz_Dive_Wing ***
ObjectTemplate.create Wing Gaz_Dive_Wing
ObjectTemplate.setNetworkableInfo SA342_wing_info
ObjectTemplate.setAutomaticReset 1
ObjectTemplate.setPositionOffset 0/0/0
ObjectTemplate.setMinRotation 0/-20/0
ObjectTemplate.setMaxRotation 0/20/0
ObjectTemplate.setMaxSpeed 0/90/0
ObjectTemplate.setAcceleration 0/-90/0
ObjectTemplate.setInputToPitch c_PIPitch
ObjectTemplate.setAutomaticReset 1
ObjectTemplate.setWingLift 0.26
ObjectTemplate.setFlapLift 0.26


rem *** Gaz_vert_Wing ***
ObjectTemplate.create Wing Gaz_Front_Wing
ObjectTemplate.setAutomaticReset 1
ObjectTemplate.setPositionOffset 0/0/0
ObjectTemplate.setWingLift 0.6
ObjectTemplate.setFlapLift 0.0

rem *** Gaz_vert_Wing ***
ObjectTemplate.create Wing Gaz_Rear_Wing
ObjectTemplate.setAutomaticReset 1
ObjectTemplate.setPositionOffset 0/0/0
ObjectTemplate.setWingLift 0.6
ObjectTemplate.setFlapLift 0.0

rem *** Gaz_Body_Wing ***
ObjectTemplate.create Wing Gaz_Wing_Right
ObjectTemplate.setAutomaticReset 1
ObjectTemplate.setPositionOffset 0/0/0
ObjectTemplate.setWingLift 0.8
ObjectTemplate.setFlapLift 0.0

rem *** Gaz_Body_Wing ***
ObjectTemplate.create Wing Gaz_Wing_Left
ObjectTemplate.setAutomaticReset 1
ObjectTemplate.setPositionOffset 0/0/0
ObjectTemplate.setWingLift 0.8
ObjectTemplate.setFlapLift 0.0


Change the acceleration in engine 3, only, for the roll direction (note the 20) This slows down the roll speed significantly. I also set all 3 engines to 16 torque and 4 on differential just to make them a bit faster.


CODE

rem *** SA342HoverEngine3 ***
ObjectTemplate.create Engine SA342HoverEngine3
ObjectTemplate.setNetworkableInfo SA342_engine_info
ObjectTemplate.setMinRotation -5000/-5000/1500
ObjectTemplate.setMaxRotation 5000/5000/5000
ObjectTemplate.setMaxSpeed 50/50/9500
ObjectTemplate.setAcceleration 20/50/25000
ObjectTemplate.setInputToRoll c_PIThrottle
ObjectTemplate.setAutomaticReset 1
ObjectTemplate.setEngineType c_ETPlane
ObjectTemplate.setTorque 16
ObjectTemplate.setDifferential 4
ObjectTemplate.setNoPropellerEffectAtSpeed 3000


Add this to Network.con for the new pitch flap.....

CODE
NetworkableInfo.createNewInfo SA342_wing_info
NetworkableInfo.setPredictionMode PMLinear



The control plugin----
The AI are very good with these helicopters with my current control plugin but I think it may need some adjustments now as I adjusted this control plugin for the regular helicopter.

Code starts under this line...

aiTemplatePlugIn.create ControlInfo3d SA342(S,H,M,L,G)Ctrl


^ I left that out since there are 5 different helicopter control plugins there that have to be done.

CODE

aiTemplatePlugIn.driveTurnControl     PIYaw
aiTemplatePlugIn.driveThrottleControl PIThrottle
aiTemplatePlugIn.aimHorizontalControl PIYaw
aiTemplatePlugIn.aimVerticalControl   PIPitch
aiTemplatePlugIn.driveRollControl     PIRoll
aiTemplatePlugIn.drivePitchControl    PIPitch
aiTemplatePlugIn.aimRollControl       PIRoll
aiTemplatePlugIn.aimThrottleControl  PIThrottle
aiTemplatePlugIn.throttleSensitivity -0.3
aiTemplatePlugIn.pitchSensitivity     0.14
aiTemplatePlugIn.rollSensitivity      0.3
aiTemplatePlugIn.yawSensitivity       0.14
aiTemplatePlugIn.throttleLookAhead    1.6
aiTemplatePlugIn.pitchLookAhead       0.8
aiTemplatePlugIn.rollLookAhead        0.3
aiTemplatePlugIn.yawLookAhead         0.6
aiTemplatePlugIn.throttleScale        5.0
rem *** Angle in radians ***
aiTemplatePlugIn.pitchScale           5.0
aiTemplatePlugIn.rollScale            5.0
aiTemplatePlugIn.yawScale             5.0
aiTemplatePlugIn.maxRollAngle         0.0133
aiTemplatePlugIn.maxClimbAngle        0.0001



aiTemplatePlugIn.create Mobile SA342(S,H,M,L,G)Mobile

CODE

aiTemplatePlugIn.vehicleNumber 1
aiTemplatePlugIn.maxSpeed 80.0
aiTemplatePlugIn.turnRadius 40.0
aiTemplatePlugIn.coverSearchRadius 450.0
aiTemplatePlugIn.avoidCollisionLookAhead 150.0


If you want them to shoot rockets, you have to make sure the ai weapons setting are correct, several of the dc weapons.con for ai are not right. You also need to adjust the drag/mass on the rockets themselves. Basically add mass or lower drag, either one works you just have to find the balance of what you want and what works for the AI.
I set the hydra's like this and they shoot them at me all the time.
ObjectTemplate.drag 0.5
ObjectTemplate.mass 35

 

 

Well I need to add, that if someone does want to put these to use in DC, there is a problem with using it on lan game unless you edit a couple more things.

Adding that "dive" wing requires a net info, and pushes all the helo's into the dreaded too many statemasks error. Easy to fix though, all you have to do is rem out the net info for the rotational bundles that the engines are attached to, these are not needed and should not have been there anyway.

Just rem it out on all of those for any helicopter.

Objects.con

CODE
rem *** SA342DummyEngineRack ***
ObjectTemplate.create RotationalBundle SA342DummyEngineRack
rem ObjectTemplate.setNetworkableInfo SA342_body_info


CODE
rem *** SA342EngineRack1 ***
ObjectTemplate.create RotationalBundle SA342EngineRack1
rem ObjectTemplate.setNetworkableInfo SA342_rack_info


On the apache or uh-60, you can also rem out the netinfo to the rear flap as it is just for show and has no effect on physics so no need for net info on it.
Physics.con

CODE
rem *** AH64RearFlap ***
ObjectTemplate.create RotationalBundle AH64RearFlap
rem ObjectTemplate.setNetworkableInfo AH64_body_info
ObjectTemplate.geometry AH64_Flap


CODE
rem *** UH-60RearFlap ***
ObjectTemplate.create RotationalBundle UH-60RearFlap
rem ObjectTemplate.setNetworkableInfo UH-60_body_info
ObjectTemplate.geometry UH-60_Flap



With those extra net info's out I have tested this in lan games and with a dedicated server with no problem.

I will work on getting a better ai plugin for these new physics.


Ok, well I have some worked out alot better. Mi24 is a menace in the sky, and pretty good at getting you on the ground as well, but they don't do too well if there are mountains around. The apache's are like stunt pilots, I don't know how they survive the stuff they do.. very rare that they crash and really good at dive bombing. The gazelle's unfornutaley cannot overcome the inertia modifier so they dive bomb right into the ground pretty often, but I have always had that problem with them and the only solution is to redo that helicopter with different name and lower that forward inertia.

I have the pitch and roll rates worked out pretty well, but the yaw is tricky since it changes based on how much throttle you are using.. it is close enough that the ai is not doing spins very often and when they are hovering over a target they can keep the nose pointed right at it. Also I made some changes to the wing settings on some helicopters based on the mass/drag of the pco. I have not done alot with uh-60 because we don't use it much, and the bots flight characteristics are very different in unarmed planes. I also have only started messing with the little bird helicopters and have not had much testing time on those.
It's nowhere near perfect, but it is much more fun. I have been playing it alot to test and ussually end up hiding in a building to watch or dying from rockets.

Here is what I have come up with so far. I leave alot of stuff out so you have to just look at where it goes. Also don't forget the net info's or you will see the desktop!!

Objects.con

CODE

rem *** AH64Complex ***
ObjectTemplate.create Bundle AH64Complex

rem seats and wheels.. blah blah..........

rem this is not really a flap :)
ObjectTemplate.addTemplate AH64RearFlap
ObjectTemplate.setPosition 0/0.208/-6.220

rem physics wings start here

ObjectTemplate.addTemplate AH64DiveFlap
ObjectTemplate.setPosition 0/0/-4.5

ObjectTemplate.addTemplate AH64_Wing_Front
ObjectTemplate.setPosition 0/0/4.5
ObjectTemplate.setRotation 0/0/-90
ObjectTemplate.addTemplate AH64_Wing_Rear
ObjectTemplate.setPosition 0/0/-4.5
ObjectTemplate.setRotation 0/0/-90

ObjectTemplate.addTemplate AH64_Wing_Right
ObjectTemplate.setPosition 4/0/0
ObjectTemplate.addTemplate AH64_Wing_Left
ObjectTemplate.setPosition -4/0/0




Physics.con

CODE


rem NOTE roll changes to hover engine 3
rem increase torque to offset wing drag

rem *** AH64HoverEngine1 ***
ObjectTemplate.create Engine AH64HoverEngine1
ObjectTemplate.setNetworkableInfo AH64_engine_info
rem -------------------------------------

rem -------------------------------------
ObjectTemplate.setMinRotation -5000/-5000/1500
ObjectTemplate.setMaxRotation 5000/5000/5000
ObjectTemplate.setMaxSpeed 50/50/9500
ObjectTemplate.setAcceleration 50/50/20000
ObjectTemplate.setInputToRoll c_PIThrottle
ObjectTemplate.setAutomaticReset 1
ObjectTemplate.setEngineType c_ETPlane
ObjectTemplate.setTorque 20
ObjectTemplate.setDifferential 6
ObjectTemplate.setNoPropellerEffectAtSpeed 3000

rem *** AH64HoverEngine2 ***
ObjectTemplate.create Engine AH64HoverEngine2
ObjectTemplate.setNetworkableInfo AH64_engine_info
rem -------------------------------------

rem -------------------------------------
ObjectTemplate.setMinRotation -5000/-5000/1500
ObjectTemplate.setMaxRotation 5000/5000/5000
ObjectTemplate.setMaxSpeed 50/50/9500
ObjectTemplate.setAcceleration 50/50/20000
ObjectTemplate.setInputToRoll c_PIThrottle
ObjectTemplate.setAutomaticReset 1
ObjectTemplate.setEngineType c_ETPlane
ObjectTemplate.setTorque 20
ObjectTemplate.setDifferential 6
ObjectTemplate.setNoPropellerEffectAtSpeed 3000

rem *** AH64HoverEngine3 ***
ObjectTemplate.create Engine AH64HoverEngine3
ObjectTemplate.setNetworkableInfo AH64_engine_info
rem -------------------------------------

rem -------------------------------------
ObjectTemplate.setMinRotation -5000/-5000/1500
ObjectTemplate.setMaxRotation 5000/5000/5000
ObjectTemplate.setMaxSpeed 50/50/9500
ObjectTemplate.setAcceleration 20/50/20000
ObjectTemplate.setInputToRoll c_PIThrottle
ObjectTemplate.setAutomaticReset 1
ObjectTemplate.setEngineType c_ETPlane
ObjectTemplate.setTorque 20
ObjectTemplate.setDifferential 6
ObjectTemplate.setNoPropellerEffectAtSpeed 3000

rem doesn't need net info... it doesn't do anything
rem *** AH64RearFlap ***
ObjectTemplate.create RotationalBundle AH64RearFlap
rem ObjectTemplate.setNetworkableInfo AH64_body_info
ObjectTemplate.geometry AH64_Flap
ObjectTemplate.setMinRotation 0/-35/0
ObjectTemplate.setMaxRotation 0/35/0
ObjectTemplate.setMaxSpeed 0/120/0
ObjectTemplate.setAcceleration 0/-120/0
ObjectTemplate.setInputToPitch c_PIPitch
ObjectTemplate.setAutomaticReset 1

rem needs net info added
rem *** AH64RearFlap ***
ObjectTemplate.create Wing AH64DiveFlap
ObjectTemplate.setNetworkableInfo AH64_wing_info
ObjectTemplate.setMinRotation 0/-30/0
ObjectTemplate.setMaxRotation 0/30/0
ObjectTemplate.setMaxSpeed 0/120/0
ObjectTemplate.setAcceleration 0/-120/0
ObjectTemplate.setInputToPitch c_PIPitch
ObjectTemplate.setAutomaticReset 1
ObjectTemplate.setWingLift 0.255
ObjectTemplate.setFlapLift 0.25

rem *** AH1_Vertical_Wing ***
ObjectTemplate.create Wing AH64_Wing_Front
ObjectTemplate.setAutomaticReset 1
ObjectTemplate.setPositionOffset 0/0/0
ObjectTemplate.setWingLift 0.6
ObjectTemplate.setFlapLift 0.0

rem *** AH1_Vertical_Wing ***
ObjectTemplate.create Wing AH64_Wing_Rear
ObjectTemplate.setAutomaticReset 1
ObjectTemplate.setPositionOffset 0/0/0
ObjectTemplate.setWingLift 0.6
ObjectTemplate.setFlapLift 0.0

rem *** AH1_Body_Wing ***
ObjectTemplate.create Wing AH64_Wing_Right
ObjectTemplate.setAutomaticReset 1
ObjectTemplate.setPositionOffset 0/0/0
ObjectTemplate.setWingLift 0.8
ObjectTemplate.setFlapLift 0.0

rem *** AH1_Body_Wing ***
ObjectTemplate.create Wing AH64_Wing_Left
ObjectTemplate.setAutomaticReset 1
ObjectTemplate.setPositionOffset 0/0/0
ObjectTemplate.setWingLift 0.8
ObjectTemplate.setFlapLift 0.0


AI /objects.con (starts at control)

CODE

aiTemplatePlugIn.create ControlInfo3d AH64Ctrl
aiTemplatePlugIn.driveTurnControl     PIYaw
aiTemplatePlugIn.driveThrottleControl PIThrottle
aiTemplatePlugIn.aimHorizontalControl PIYaw
aiTemplatePlugIn.aimVerticalControl   PIPitch
aiTemplatePlugIn.driveRollControl     PIRoll
aiTemplatePlugIn.drivePitchControl    PIPitch
aiTemplatePlugIn.aimRollControl       PIRoll
aiTemplatePlugIn.aimThrottleControl  PIThrottle
aiTemplatePlugIn.throttleSensitivity -0.3
aiTemplatePlugIn.pitchSensitivity     0.16
aiTemplatePlugIn.rollSensitivity      0.28
aiTemplatePlugIn.yawSensitivity       0.198
aiTemplatePlugIn.throttleLookAhead    1.8
aiTemplatePlugIn.pitchLookAhead       0.6
aiTemplatePlugIn.rollLookAhead        0.3
aiTemplatePlugIn.yawLookAhead         0.5
aiTemplatePlugIn.throttleScale        5.0
rem *** Angle in radians ***
aiTemplatePlugIn.pitchScale           5.0
aiTemplatePlugIn.rollScale            5.0
aiTemplatePlugIn.yawScale             5.0
aiTemplatePlugIn.maxRollAngle         0.0133
aiTemplatePlugIn.maxClimbAngle        0.0001

aiTemplatePlugIn.create Mobile AH64Mobile
aiTemplatePlugIn.vehicleNumber -1
aiTemplatePlugIn.maxSpeed 70.0
aiTemplatePlugIn.turnRadius 55.0
rem aiTemplatePlugIn.coverSearchRadius 650.0
aiTemplatePlugIn.avoidCollisionLookAhead 160.0


objects.con

CODE
rem *** Mi24DComplex ***
ObjectTemplate.create Bundle Mi24DComplex
rem should be stuff here
ObjectTemplate.addTemplate Mi24DLGEngine
ObjectTemplate.setPosition 0/0/0

rem (start here)
rem side wings slow roll rate and reset to level
rem front/rear allow wide turns in roll instead of hitting the ground

ObjectTemplate.addTemplate Mi24D_Front_Wing
ObjectTemplate.setPosition 0/0/5
ObjectTemplate.setRotation 0/0/-90
ObjectTemplate.addTemplate Mi24D_Rear_Wing
ObjectTemplate.setPosition 0/0/-5
ObjectTemplate.setRotation 0/0/-90
ObjectTemplate.addTemplate Mi24D_Wing_Right
ObjectTemplate.setPosition 4.5/0/0
ObjectTemplate.addTemplate Mi24D_Wing_Left
ObjectTemplate.setPosition -4.5/0/0

rem aids turning while rolled and pulls nose up to allow forward flight

ObjectTemplate.addTemplate Mi24D_Dive_Wing
ObjectTemplate.setPosition 0/0/-4.5



physics.con

CODE


rem *** Mi24DHoverEngine1 ***
ObjectTemplate.create Engine Mi24DHoverEngine1
ObjectTemplate.setNetworkableInfo Mi24D_engine_info
ObjectTemplate.loadSoundScript Sounds/HindEngine.ssc
rem -------------------------------------
rem -------------------------------------
ObjectTemplate.setMinRotation -5000/-5000/2000
ObjectTemplate.setMaxRotation 5000/5000/5000
ObjectTemplate.setMaxSpeed 50/50/9500
ObjectTemplate.setAcceleration 50/50/6000
ObjectTemplate.setInputToRoll c_PIThrottle
ObjectTemplate.setAutomaticReset 1
ObjectTemplate.setEngineType c_ETPlane
ObjectTemplate.setTorque 16.2
ObjectTemplate.setDifferential 4.8
ObjectTemplate.setGearUp 0.7
ObjectTemplate.setGearDown 0.3
ObjectTemplate.setNoPropellerEffectAtSpeed 150

rem *** Mi24DHoverEngine2 ***
ObjectTemplate.create Engine Mi24DHoverEngine2
ObjectTemplate.setNetworkableInfo Mi24D_engine_info
rem -------------------------------------
rem -------------------------------------
ObjectTemplate.setMinRotation -5000/-5000/2000
ObjectTemplate.setMaxRotation 5000/5000/5000
ObjectTemplate.setMaxSpeed 50/50/9500
ObjectTemplate.setAcceleration 50/50/6000
ObjectTemplate.setInputToRoll c_PIThrottle
ObjectTemplate.setAutomaticReset 1
ObjectTemplate.setEngineType c_ETPlane
ObjectTemplate.setTorque 16.2
ObjectTemplate.setDifferential 4.8
ObjectTemplate.setGearUp 0.7
ObjectTemplate.setGearDown 0.3
ObjectTemplate.setNoPropellerEffectAtSpeed 150

rem *** Mi24DHoverEngine3 ***
ObjectTemplate.create Engine Mi24DHoverEngine3
ObjectTemplate.setNetworkableInfo Mi24D_engine_info
rem -------------------------------------
rem -------------------------------------
ObjectTemplate.setMinRotation -5000/-5000/2000
ObjectTemplate.setMaxRotation 5000/5000/5000
ObjectTemplate.setMaxSpeed 50/50/9500
rem lower roll speed
ObjectTemplate.setAcceleration 20/50/6000
ObjectTemplate.setInputToRoll c_PIThrottle
ObjectTemplate.setAutomaticReset 1
ObjectTemplate.setEngineType c_ETPlane
ObjectTemplate.setTorque 16.2
ObjectTemplate.setDifferential 4.8
ObjectTemplate.setGearUp 0.7
ObjectTemplate.setGearDown 0.3
ObjectTemplate.setNoPropellerEffectAtSpeed 150

rem *** lift_Body_Wing ***
ObjectTemplate.create Wing Mi24D_Front_Wing
ObjectTemplate.setAutomaticReset 1
ObjectTemplate.setPositionOffset 0/0/0
ObjectTemplate.setAutomaticReset 1
ObjectTemplate.setWingLift 0.55
ObjectTemplate.setFlapLift 0.0

rem *** lift_Body_Wing ***
ObjectTemplate.create Wing Mi24D_Rear_Wing
ObjectTemplate.setAutomaticReset 1
ObjectTemplate.setPositionOffset 0/0/0
ObjectTemplate.setAutomaticReset 1
ObjectTemplate.setWingLift 0.55
ObjectTemplate.setFlapLift 0.0

rem *** roll_Body_Wing ***
ObjectTemplate.create Wing Mi24D_Wing_Right
ObjectTemplate.setAutomaticReset 1
ObjectTemplate.setPositionOffset 0/0/0
ObjectTemplate.setWingLift 0.75
ObjectTemplate.setFlapLift 0.0

rem *** roll_Body_Wing ***
ObjectTemplate.create Wing Mi24D_Wing_Left
ObjectTemplate.setAutomaticReset 1
ObjectTemplate.setPositionOffset 0/0/0
ObjectTemplate.setWingLift 0.75
ObjectTemplate.setFlapLift 0.0

rem netinfo!!
rem *** lift_from_Dive_Wing ***
ObjectTemplate.create Wing Mi24D_Dive_Wing
ObjectTemplate.setNetworkableInfo Mi24D_wing_info
ObjectTemplate.setAutomaticReset 1
ObjectTemplate.setPositionOffset 0/0/0
ObjectTemplate.setMinRotation 0/-20/0
ObjectTemplate.setMaxRotation 0/20/0
ObjectTemplate.setMaxSpeed 0/90/0
ObjectTemplate.setAcceleration 0/-90/0
ObjectTemplate.setInputToPitch c_PIPitch
ObjectTemplate.setAutomaticReset 1
ObjectTemplate.setWingLift 0.245
ObjectTemplate.setFlapLift 0.24



AI stuff...

CODE
aiTemplatePlugIn.create ControlInfo3d Mi24DCtrl
aiTemplatePlugIn.driveTurnControl     PIYaw
aiTemplatePlugIn.driveThrottleControl PIThrottle
aiTemplatePlugIn.aimHorizontalControl PIYaw
aiTemplatePlugIn.aimVerticalControl   PIPitch
aiTemplatePlugIn.driveRollControl     PIRoll
aiTemplatePlugIn.drivePitchControl    PIPitch
aiTemplatePlugIn.aimRollControl       PIRoll
aiTemplatePlugIn.aimThrottleControl  PIThrottle
aiTemplatePlugIn.throttleSensitivity -0.3
aiTemplatePlugIn.pitchSensitivity     0.17
aiTemplatePlugIn.rollSensitivity      0.323
aiTemplatePlugIn.yawSensitivity       0.224
aiTemplatePlugIn.throttleLookAhead    0.9
aiTemplatePlugIn.pitchLookAhead       0.6
aiTemplatePlugIn.rollLookAhead        0.2
aiTemplatePlugIn.yawLookAhead         0.4
aiTemplatePlugIn.throttleScale        4.5
rem *** Angle in radians ***
aiTemplatePlugIn.pitchScale           0.0114
aiTemplatePlugIn.rollScale            0.0014
aiTemplatePlugIn.yawScale             0.0020
aiTemplatePlugIn.maxRollAngle         0.0001
aiTemplatePlugIn.maxClimbAngle        0.0001

aiTemplatePlugIn.create Mobile Mi24DMobile
aiTemplatePlugIn.vehicleNumber 1
aiTemplatePlugIn.maxSpeed 70.0
aiTemplatePlugIn.turnRadius 60.0
aiTemplatePlugIn.avoidCollisionLookAhead 200.0

 

objects.con

CODE
rem *** Mi24DComplex ***
ObjectTemplate.create Bundle Mi24DComplex
rem should be stuff here
ObjectTemplate.addTemplate Mi24DLGEngine
ObjectTemplate.setPosition 0/0/0

rem (start here)
rem side wings slow roll rate and reset to level
rem front/rear allow wide turns in roll instead of hitting the ground

ObjectTemplate.addTemplate Mi24D_Front_Wing
ObjectTemplate.setPosition 0/0/5
ObjectTemplate.setRotation 0/0/-90
ObjectTemplate.addTemplate Mi24D_Rear_Wing
ObjectTemplate.setPosition 0/0/-5
ObjectTemplate.setRotation 0/0/-90
ObjectTemplate.addTemplate Mi24D_Wing_Right
ObjectTemplate.setPosition 4.5/0/0
ObjectTemplate.addTemplate Mi24D_Wing_Left
ObjectTemplate.setPosition -4.5/0/0

rem aids turning while rolled and pulls nose up to allow forward flight

ObjectTemplate.addTemplate Mi24D_Dive_Wing
ObjectTemplate.setPosition 0/0/-4.5



physics.con

CODE


rem *** Mi24DHoverEngine1 ***
ObjectTemplate.create Engine Mi24DHoverEngine1
ObjectTemplate.setNetworkableInfo Mi24D_engine_info
ObjectTemplate.loadSoundScript Sounds/HindEngine.ssc
rem -------------------------------------
rem -------------------------------------
ObjectTemplate.setMinRotation -5000/-5000/2000
ObjectTemplate.setMaxRotation 5000/5000/5000
ObjectTemplate.setMaxSpeed 50/50/9500
ObjectTemplate.setAcceleration 50/50/6000
ObjectTemplate.setInputToRoll c_PIThrottle
ObjectTemplate.setAutomaticReset 1
ObjectTemplate.setEngineType c_ETPlane
ObjectTemplate.setTorque 16.2
ObjectTemplate.setDifferential 4.8
ObjectTemplate.setGearUp 0.7
ObjectTemplate.setGearDown 0.3
ObjectTemplate.setNoPropellerEffectAtSpeed 150

rem *** Mi24DHoverEngine2 ***
ObjectTemplate.create Engine Mi24DHoverEngine2
ObjectTemplate.setNetworkableInfo Mi24D_engine_info
rem -------------------------------------
rem -------------------------------------
ObjectTemplate.setMinRotation -5000/-5000/2000
ObjectTemplate.setMaxRotation 5000/5000/5000
ObjectTemplate.setMaxSpeed 50/50/9500
ObjectTemplate.setAcceleration 50/50/6000
ObjectTemplate.setInputToRoll c_PIThrottle
ObjectTemplate.setAutomaticReset 1
ObjectTemplate.setEngineType c_ETPlane
ObjectTemplate.setTorque 16.2
ObjectTemplate.setDifferential 4.8
ObjectTemplate.setGearUp 0.7
ObjectTemplate.setGearDown 0.3
ObjectTemplate.setNoPropellerEffectAtSpeed 150

rem *** Mi24DHoverEngine3 ***
ObjectTemplate.create Engine Mi24DHoverEngine3
ObjectTemplate.setNetworkableInfo Mi24D_engine_info
rem -------------------------------------
rem -------------------------------------
ObjectTemplate.setMinRotation -5000/-5000/2000
ObjectTemplate.setMaxRotation 5000/5000/5000
ObjectTemplate.setMaxSpeed 50/50/9500
rem lower roll speed
ObjectTemplate.setAcceleration 20/50/6000
ObjectTemplate.setInputToRoll c_PIThrottle
ObjectTemplate.setAutomaticReset 1
ObjectTemplate.setEngineType c_ETPlane
ObjectTemplate.setTorque 16.2
ObjectTemplate.setDifferential 4.8
ObjectTemplate.setGearUp 0.7
ObjectTemplate.setGearDown 0.3
ObjectTemplate.setNoPropellerEffectAtSpeed 150

rem *** lift_Body_Wing ***
ObjectTemplate.create Wing Mi24D_Front_Wing
ObjectTemplate.setAutomaticReset 1
ObjectTemplate.setPositionOffset 0/0/0
ObjectTemplate.setAutomaticReset 1
ObjectTemplate.setWingLift 0.55
ObjectTemplate.setFlapLift 0.0

rem *** lift_Body_Wing ***
ObjectTemplate.create Wing Mi24D_Rear_Wing
ObjectTemplate.setAutomaticReset 1
ObjectTemplate.setPositionOffset 0/0/0
ObjectTemplate.setAutomaticReset 1
ObjectTemplate.setWingLift 0.55
ObjectTemplate.setFlapLift 0.0

rem *** roll_Body_Wing ***
ObjectTemplate.create Wing Mi24D_Wing_Right
ObjectTemplate.setAutomaticReset 1
ObjectTemplate.setPositionOffset 0/0/0
ObjectTemplate.setWingLift 0.75
ObjectTemplate.setFlapLift 0.0

rem *** roll_Body_Wing ***
ObjectTemplate.create Wing Mi24D_Wing_Left
ObjectTemplate.setAutomaticReset 1
ObjectTemplate.setPositionOffset 0/0/0
ObjectTemplate.setWingLift 0.75
ObjectTemplate.setFlapLift 0.0

rem netinfo!!
rem *** lift_from_Dive_Wing ***
ObjectTemplate.create Wing Mi24D_Dive_Wing
ObjectTemplate.setNetworkableInfo Mi24D_wing_info
ObjectTemplate.setAutomaticReset 1
ObjectTemplate.setPositionOffset 0/0/0
ObjectTemplate.setMinRotation 0/-20/0
ObjectTemplate.setMaxRotation 0/20/0
ObjectTemplate.setMaxSpeed 0/90/0
ObjectTemplate.setAcceleration 0/-90/0
ObjectTemplate.setInputToPitch c_PIPitch
ObjectTemplate.setAutomaticReset 1
ObjectTemplate.setWingLift 0.245
ObjectTemplate.setFlapLift 0.24



AI stuff...

CODE
aiTemplatePlugIn.create ControlInfo3d Mi24DCtrl
aiTemplatePlugIn.driveTurnControl     PIYaw
aiTemplatePlugIn.driveThrottleControl PIThrottle
aiTemplatePlugIn.aimHorizontalControl PIYaw
aiTemplatePlugIn.aimVerticalControl   PIPitch
aiTemplatePlugIn.driveRollControl     PIRoll
aiTemplatePlugIn.drivePitchControl    PIPitch
aiTemplatePlugIn.aimRollControl       PIRoll
aiTemplatePlugIn.aimThrottleControl  PIThrottle
aiTemplatePlugIn.throttleSensitivity -0.3
aiTemplatePlugIn.pitchSensitivity     0.17
aiTemplatePlugIn.rollSensitivity      0.323
aiTemplatePlugIn.yawSensitivity       0.224
aiTemplatePlugIn.throttleLookAhead    0.9
aiTemplatePlugIn.pitchLookAhead       0.6
aiTemplatePlugIn.rollLookAhead        0.2
aiTemplatePlugIn.yawLookAhead         0.4
aiTemplatePlugIn.throttleScale        4.5
rem *** Angle in radians ***
aiTemplatePlugIn.pitchScale           0.0114
aiTemplatePlugIn.rollScale            0.0014
aiTemplatePlugIn.yawScale             0.0020
aiTemplatePlugIn.maxRollAngle         0.0001
aiTemplatePlugIn.maxClimbAngle        0.0001

aiTemplatePlugIn.create Mobile Mi24DMobile
aiTemplatePlugIn.vehicleNumber 1
aiTemplatePlugIn.maxSpeed 70.0
aiTemplatePlugIn.turnRadius 60.0
aiTemplatePlugIn.avoidCollisionLookAhead 200.0

 

It needs to be put in something 8) ,...I just reinstalled DC 1942 with hopes of figuring it out and winrfa'ing away myself but months away makes you rusty

Edit
well the rust is flaking off yippy kiyay
I managed to get the ah64 code in there it did stay aloft for quite some time.
Its weird how it flies especially the rolling when you get it just right.
The bots definately agree with it's control and I must say it the first time you see a bot guided helo FLYING towards something and STEERING in bf42 you will be amazed.
I so far have not had a shot fired by the pilots but during my own tweaking
I hooked up the passenger bots skills pretty good so I just need to fly it into a
pack of not locked on targets bots.
I made a boo boo lol
I don't know what to set it to if they arent shooting and I did the other 2 item tweak mass on rockets thing mentioned.
weapons cons please?If its a trade secret or some other reason I'll understand,...

Woops I might have been in the wrong mod dir to change the mass and so on of the missles my bad.
Great WORK OF ART RPW regardless
my bot apache gunners thank you for this most stable of firing platforms if thats all I can get working.
EDIT PTII
Got the whole thing working very sweet it is
I suppose this is THE big news for maps/mods with helos?
Mod of the what,..."year"?
AWESOME no more of that "cramped feeling" from flying in BFV sized maps
if you just had to play with helo ai bots that was the only way.TILL NOW

Cool that someone tried this out finally. I have found that once you get used to the way they fly you won't want to go back to the dc heli physics anymore. I was racing a friend around iwo jima in apache's and you can really get some speed going.
Also if you want to make them faster, you can lower the flap lift only of the rear flap just a bit and then you will really have to put some forward pitch into it to keep level but it will go really fast.

Also found a good way to make the rockets fire better, at least for me. If you add the line ObjectTemplate.addRootSpeed 0 to any of the heli rockets weapons it makes the rockets fly where your crosshair is pointed no matter what speed or direction your going, sort of a bf42 guided missile simulation I guess... You just have to get the crosshair on the tank and fire and it will hit them.

The root speed 0 doesn't seem to make any difference with the bots firing behaviours. I still get shot out of apache when a bot in a hind sneaks up on me, which they do alot.

Also I have done the Uh-60 and uh-60l and have seen good results from the bots in them, especially the uh-60l for some reason they are really good at killing tanks with that one. So if you want those I can post them here or just pm them to you whatever is easier.

I'm still tinkering with ah-6 but the other iraqi versions of those they are good with, just can't get them to fire the weapons very often on the ah-6 yet.

Just let me add : I applied some of RPW's tricks (especially the four stabilizer wings) to the Flettner (the heli on 'Raid on Agheila') and lifted the 'Engine Bundle' from a height of 0.7 to 5.7. This stabilizes the Flettner very good and now for the first time the Flettner is used by the bots to fire rockets and MG on ground troops, vehicles and other Flettners tongue.gif
A first AI add-on for RoA with this features is available at
http://www.schoeldgen.de/bf1942/
Its not final, but WIP. Thanks go to RPW for sharing his finds

 

That setup would probably work for bots pretty well as the heli would fly similar to a plane. The biggest problem I have had to work with in getting decent ai heli pilots was rolls, I have been working on a behaviour setup that seems to improve it quite a bit, as well as constantly tweaking the ai control settings until one day, if I live long enough, they will fly better then me.

One thing that works really well with current dc heli's, for both humans and bots, is to set a down angle on the camera and weapons so that you can be flyiing straight and level but your crosshair and weapons will fire down allowing easier ground targeting without having to pitch causing you to drive forward too much. I have set the camera's and weapons to rotate to 0/2.55/0 and it is pretty good like that. Another thing I changed that made a vast improvement on bots firing rockets at ground targets was to make the original weapons racks to fire fake and move the actual projectile firing postions to a point closer to the originator so they are more accurate at long range. Of course to get them to actually fire the rockets means you have to adjust the mass/drag to a value that is more bot friendly.

A quick update on some success I had while trying to get the bots to fly the dc blackhawk better, the one with the miniguns on it.

The problem with helicopters is that the bots can only fly them fairly well if they have a weapon, it's when they have a target that they will really start to fly those helicopters decent. So I added a weapon that just shoots a blank projectile to the pilot postion, and setup an ai template to get them to focus on infantry. I also had to cut the cameras rotation controls because I wanted them to use the fire command, so they wouldn't be trying to call artillery all the time, and I already know they will surely crash if they press fire and the camera turns, I have tried that before...lol
Ok so anyway, adding a fake weapon and setting the control sensitivites to have them fly very slow and smooth and not ever actually attempt to pitch to the target, along with adding a spawn for the gunner postions and now I have bot helo's flying sniper cover in dc lost village for the first time.