Jump to content

Naval Operations Scripting - SU33, AV8, F/A18, F-14


Durham

Recommended Posts

With the arrival of the SU-33 and the upcoming arrivals of the Harrier, Tomcat and Hornet, controlling ships will become more important for relevant mission development.

 

I wished to prepare for this by using the assets we have already: Kuznetsov + SU-33 to create a carrier group which could be attacked by Viggens and Mirages and anyone else for that matter.

 

First issue I noticed is that the carrier group could not hold formation, either as a group or as individual units with formated waypoints.

 

So: I thought, why don't I write a script that commands the followers in a formation to hold heading and relative bearing from the carrier.

 

First stop, watch youtube/read google and see the way that formations are done in regular game AI with dragons and trolls etc. - not hard, loop, predict position of formation leader, predict position of angle and distance off for each subsidiary unit, convert cartesian, set waypoint, rinse and repeat.

 

At mission start we all need to form up, so I wrote an FSM inFormation boolean, where if false halts leader and lets followers form up.

 

I could not return a valid unit:getPosition() or unit:getPoint() from the lead ship because ships work at a group and not a unit level. Passing a group object to those two functions just generated a compile error.

 

Then I got stumped by groupStopMoving(groupObject), which only works with ground units. Then I went lower StopRoute, but that is readonly.

 

So basically, I have all the math to keep a carrier group in formation, but don't seem to be able to set any variables with ship type assets, in the way that I have been with airplane, helicopter and ground assets.

 

My guess is that nobody has cared about this, but with the launch of all these carrier-borne air-frames, maybe somebody should!

 

We are going to need a carrier FSM, where when recovering aircraft, it turns into the wind, and thereafter returns to its original route. How do we do that if we cannot even get its position?

 

As always, all help and guidance gratefully appreciated,

 

Durham

Link to comment
Share on other sites

And having thought about it more - at present the only solution I can come up with is to use my C# DCS-FlightPlanner application which reads a .miz file (application written for other reasons) and then write back the lead unit (carrier) as a new unit to the mission with its route, and pass its starting position to the mission on mission start, so that the followers can set their initial waypoints accordingly. I also need collision avoidance, but I would like to see whether the low level DCS C++ AI handles that, as the ships get into formation, before doing it myself.

Link to comment
Share on other sites

Group.getByName('whatever'):getUnit(1):getPosition().p will return the lead units position.

 

Attached a basic mission to show what I mean.

 

Last I checked the ships don't have a whole lot of behavior logic for collision avoidance. There are bug reports open on it. Ships can collide but they just pass through one another. Also if ships get to close to the shore they just stop.

 

While groupStopMoving won't work you can use Controller.popTask() which will remove its current tasking and stop the ship. Of course you will need to reassign the task for the formation stuff.

 

 

You already have access to the mission file within the scripting engine, so you can access any data you need, you just have to find it. Have a look at the code I used within mist for mist.getGroupRoute. The env.mission is the mission file. Then you gotta iterate through the env.mission.coalition[coa_side][country][groupCategory][groupId] to find the group you are looking for.

getShipPos.miz

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Link to comment
Share on other sites

I was using your heading function which used unit:getPosition(). I remember seeing the .p extension either in my code or yours. I am with you on getGroupRoute, because then (if absolutely necessary I could group:destroy and then coalition.addGroup...). I can just stop the ship, wait until the fsm says that formation is true and then give back the waypoints to the lead ship. As always, thank you so much Grimes. Best. D

Link to comment
Share on other sites

My flight planner uses a LuaParse class to strip everything out of the mission file. Unfortunately it is not much more efficient than your engine as each time it returns a "LuaObject" which doesn't give you any data until you are at the end leaf of the tree. So the C# reader is not much different from foreach in coalition, foreach in country, foreach in category etc... I tried with NLUA and luajson, but that still did not give me an object on which I could use either xpath or LINQ.

 

Happy to share. Best. D

Link to comment
Share on other sites

  • 1 month later...

Back doing this again using MIST, which makes things so much easier.

 

Trying to get speed from:

 

leaderSpeed = mist.vec.mag(leadGroup:getUnit(1):getVelocity())

 

where leadGroup is a group object.

 

According to DCS, group is sailing at 11kts and I get a return of 5.65, which increases as the ship accelerates.

 

I expected a return in knots and cannot think of another unit of speed that has a lower result than knots, so do you know what is happening?

 

Given that all I care about is relatives, should I care. However, in order to predict cartesian co-ordinates one time period in the future, I need to get back to meters per second.

 

Thanks for any advice you can provide.

Link to comment
Share on other sites

So, I got it to work. However, the problem is that when I pushTask or setTask with the new derived waypoint, the ship slows to 0kts and then has a think and then sets off at max speed to new waypoint.

 

I logged every step of the way with the deltax and deltay and the trigometry and all seemed to work. However, in order to take a new task the ship seemed to have to go to 0kts.

 

They followed all of their leader's turns, but it was like a Battle of the Atlantic rerun where the escorts would sprint and then stop to listen.

 

I think I will put them all into a DCS Group and then get the lead to turn into the wind with carrierOps = true, and then return to route when carrierOps = false

 

Best

 

D

Link to comment
Share on other sites

  • 1 month later...

Distance from shore

 

Group.getByName('whatever'):getUnit(1):getPosition().p will return the lead units position.

 

Last I checked the ships don't have a whole lot of behavior logic for collision avoidance. There are bug reports open on it. Ships can collide but they just pass through one another. Also if ships get to close to the shore they just stop.

 

While groupStopMoving won't work you can use Controller.popTask() which will remove its current tasking and stop the ship. Of course you will need to reassign the task for the formation stuff.

 

 

I'm not trying to hijack the thread, so I apologize. How close is too close to the shore? Is there any set distance and is there anyway to un-stuck them if they do get to close? Thank you.

 

I'm also eager to know of any progress on this. Thank you.


Edited by shnicklefritz
fix qoute
Link to comment
Share on other sites

I'm not trying to hijack the thread, so I apologize. How close is too close to the shore? Is there any set distance and is there anyway to un-stuck them if they do get to close? Thank you.

 

I'm also eager to know of any progress on this. Thank you.

 

Unstucking them would be to respawn em further off shore pointing in the opposite direction so they are sailing away from the coast. In terms of the actual distance, I didn't measure it and I'm not sure if it is uniform. One would hope that with the naval aircraft on the horizon ED will address issues with ship AI.

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Link to comment
Share on other sites

  • 2 weeks later...

No, I gave up as the AI units did not seem able to take in the new waypoint quickly enough to enable formation flying - they would just got to a point, stop, think, and then set off to a new point. I found putting them in a group in the ME was better than what I could do.

Link to comment
Share on other sites

  • 5 months later...

Is there a way to have an AI aircraft; let's say an E2 Hawkeye launch from a specific CAT?

 

cheers

 

VCAW-99_sig_ED_BD-3.png

 

Alienware New Aurora R15 | Windows® 11 Home Premium | 64bit, 13thGen Intel(R) Core(TM) i9 13900KF(24-Core, 68MB|  NVIDIA(R) GeForce RTX(TM) 4090, 24GB GDDR6X | 1 X 2TB SSD, 1X 1TB SSD | 64GB, 2x32GB, DDR5, 4800MHz | 1350W PSU, Alienware Cryo-tech (TM) Edition CPU Liquid Cooling  power supply | G2 Rverb VR

Link to comment
Share on other sites

Only via take-off from runway and spawning the aircraft directly on a given catapult. Currently the cat usage from taking off from ramp is automated and dependent on the situation. For example with a player aircraft starting from ramp and you spawn in an AI, the AI will go to cat 2 because it assumes cat 1 is reserved for the player.

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...