Fake aircraft, real airstrike

Faking Overhead Aircraft and Real Airstrikes In T3D

Faking aircraft zooming overhead like all the cool FPS's have … but let's expand that and have fake aircraft deliver REAL airstrikes! In T3D using scripted objects, baffling 3D maths and raycasts.

So you're playing the latest 3A installment of the world's biggest FPS franchise, ''"Ball of Fruity 9001: This Time It's Global War … Again"'', and in the middle of all your very shiny, yet absurdly close-range firefights, with some butch AI character constantly shouting "''Take Down That X With Your Y''" at you, there are jets screeching low overhead to really set the scene of a grand, combined arms battlefield …

… well those jets aren't real vehicles, they're all scriptObjects, and they're a small redbox with an arrow for forward vector coming off them, and sometimes they've got a small orange box called an "origin" which draws a line to another small orange box to mark out a linear path. In-game the small redbox displays a shapefile and moves down the path between the orangebox at whatever rate is scripted for it, then it deletes.

And you can do the same thing in Torque3D and have your own fake jest screaming close overhead … but let's make it even fancier and add the ability to for those scriptObject aircraft to deliver airstrikes.

For this you will need:

1 x shapeFile model for your aircraft

1 x smoke emitter to display where the airstrike will be

1 x explosion for bombs

1 x water explosion for bombs striking water

1 x aircraft noise audio file

How you wish to deploy an airstrike is up to you, personally, in my custom stuff I have my player equipped with a laser designator weapon but in this example we'll have a simple function called from console that will bring an airstrike in on whatever the player is looking at … so don't be looking at your own feet when you test this …

There are a few commented out sections which refer to spawning markers to help in aiding the visual marking of positions and vectors in editor (not that the stock markers have a visible forward angle). Apart from the aircraft model, there are no objects to spawn, everything is handled with vectors and positions in script (save for the final explosions - which are of course explosion data). For explosions and particles, we'll use stock data in this example.
If you find that you're aircraft model is flying in sideways or backwards, it's because you exported it facing the incorrect angle. Here we are using a StaticShape as our "scriptObject" for the aircraft model.

Create a new cs file, I'd suggest using art directory. Call it whatever you want, but here let's call it'' bomber_shape''.cs. Don't forget to exec it (datablockExec.cs).

You'll also need a few useful utility functions that aid in 3D math - including the function to actually make the static shape move.

Make a note of these math functions - they are useful for a whole number of things …

And now the meat of the airstrike itself. Create a new cs file, I'd suggest in "scripts/server" directory and call it ''airstrike.cs'' - don't forget to exec it (in scriptExec.cs).

Now, on to the meat of the actual airstrike.

The theory is this:

  1. Player calls in strike at position that they are looking at.
  2. Aircraft does some checks to make sure that there won't be a collision with anything and attempts to alter it's attack height to fly higher than obstacles. (Feel free to combine viewMask and Bombmask into a global)
  3. Aircraft flies in due left of the player's view, heading out due right of the players view - ie: across the screen fom the player's view.
  4. Bombs drop on a schedule derived from the aircrafts flight time, not from the aircraft itself.

Now you could have any sort of airstrike that you like, but I have a hankering for'' clusterbombs''.

So we're going to have clusterbombs spawn after the aircraft passes, and rain down from a right angle, 100 units along the aircraft's flight path, and "saturate" the target area, where our smoke has popped up to mark. For this tutorial, we'll be using the stock particleFX/exposion data of the rocket launcher.

Note that bombs will explode on the surface of water, giving the waterExplosion.
When the airstrike hits, it will explode the clusterbombs one at a time, starting with the nearest strike to the point of launch.
Rather than use a standard "radiusDamage" - to show that bombs have much more penetrative power than normal projectiles and can thus punch through walls and obstacles, we're going to use a custom damage function that will ignore all cover.

Finally add:

And that should be that!

Now when you aim the player at a point and enter the command into the console:

A cloud of smoke should mark the target area, an aircraft should spawn 2k units out to the left of the player's view, race across infront of the player in 8 seconds, and 10 bomblets impact on the target zone.

And it should look something like this (only without my custom art assets obviously):

HD VIDEO Example (YouTube)

Apologies for the annoying "pings" as I swap camera/player control :P

