The truth is, I've been behaving somewhat underhandedly, trying to squeeze my doubts on other threads and only making oblique questions.
In any case, my ideas had matured enough that I was already trying to get some work done for show before starting to ask for more specific help.
Obliqueness nonwithstanding, it seems my questions raised eyebrows and now DaddyHoggy made a suggestion which natural development would eventually lead to my intentions.
Therefore it's time to come clean.
I was trying to turn the Kirin into a extremely automated beast of war. I guess everybody knew that already, but not the scope...
First of all, the subents: turn the player entity to a singularity and the player's
entire ship to a subentity - it gives you complete control over the damage received and of destroyable kits, enabling you to simulate extreme danger when the player itself is quite safe; If the code decided it was time for te ship to be destroyed, it could auto-eject the crew...
...and the player singularity, by replacing the mortal shell of a subentity with a
isHulk
NPC and fly away with an escape capsule-shaped body -
FLY YOUR ESCAPE CAPSULE YAY!!!!!!!!!!!!!
Then, there's the autopilot. I tried to merge the Autoskim and TAF reset OXPs to "give the bridge to your #1", which is to say, allow the ship to be piloted by the AI... I've almost got it running, it should set the ASC's target as its own, get there, and (if dockable) dock - even auto-engage hostiles (I still can't auto-change the ASC itself, though) -
PLAYER AUTOPILOT YAY!!!!!!!!!!!!!
As for the ship itself...<roll drums>
The basic concept derived from this sentence on [wiki]Shipdata.plist[/wiki] entry for missile_launch_position:
This position should lie outside the bounding box of the core entity and not just outside of the ships mesh. Default value: (0, -4, 1)
If the position does lie inside the bounding box, the launch position is shifted along its direction until the launched missile lies outside the bounding box of the central entity. (Bounding boxes of subentities are ignored) The collision radius of the launched missile is taken into account. The collision radius for a plain missile is 4.52 meter.
This means that if the entire ship is a subent and you can reduce the missile's collision radius to a singularity,
you can station missiles and mines right by the mesh.
Moreover, if they are
launched by the player (not spawned), the
owner
isPlayer
. This should mean that
their subent lasers equate to the player's lasers even though they are on a NPC -
REAL PLAYER MULTILASERS YAY!!!!!!!!!
"And how to fire-control the mine's laser subents", you may ask, "if they're controlled by the mine? Won't they open fire on anything that crosses the sights, regardless of your will?"
Since there isn't a handler to fire lasers as there is for missiles, I figured out a workaround: put the player ship's laser position elsewhere, pointing at a buoy fixed to the player's position. If the buoy is hit, the lasers are
ON
, and the subents go to an attack AI - they'll fire on their own, but probably only if the player is aligned...
"So, unless aligned, they won't fire? How daft!"
Well, the mines don't necessarily share the same position as the player - they must remain outside the mesh. Which means that
a mine's scan won't be precisely centred with the player So you can bind another singularity just outside the player's range, but still inside the mine's and make it its target (
accuracy =10
).
Now, each time you press fire, the laser flag goes
ON
and the subents already have a nice target to attack - and if the player's target is in the way, so much the worse for it...
It doesn't end there: if they
fire submunition with
nullAI
, a set speed (+player speed) and the same alignment as the ship, you get a railgun which causes
isPlayer
collision damage -
isPlayer
MISSION-FINISHING PRIMABLE EQUIPMENT YAY!!!!!!!!!!!!!
A further development: target an enemy, determine the space-time intersection point of the target's vector and a that of an unfired "bullet", and you get a rudimentary firing predictor. Changing the "main weapon" to the railguns and affixing a (singularity) target to that point allows to autolock-on to it, showing where to fire the railguns to hit the target n seconds later.
"What about the turrets", you may ask. Using one or more extra entities (depending on how the collision code works), you can have extra fire control centres throughout your ship. One singularity sets scan range to 3Km radius and is affixed at the same distance, you'll scan more or less the same area as the turrets' range. Either make the turrets on this facing subents to the scanner mine, or if that makes for a huge collision radius, associate each turret to a different mine and bind their target to the scanner mine (stopping it will deny the turrets new targets, so they'll become inactive) -
TURRETS WITH INDEPENDENT TARGETING AND FIRE CONTROL YAY!!!!!!!!!!!!!
If instead of adding ball turrets, one digs a foxhole on the hull mesh and binds an armed, spherical rotating attack mine into it, it can function as a much more powerful and precise turret (holding as many singularity laser subents as desired). If the mine's "forward" area is cut off, one can add "laser barrel" subents without changing the collision radius, making it visually multibarreled.
The fit can even be quite tight, as long as it doesn't touch the mesh. It shouldn't be able to shoot the ship, as if it goes below its clear field of fire it'll also leave the scanner mine's range, resulting in a target lost message -
LASER TURRETS YAY!!!!!!!!!!!!!!!!.
There are more ideas where these came from, but this is the basic for this project.