Important Message

You are browsing the archived Lancers Reactor forums. You cannot register or login.
The content may be outdated and links may not be functional.


To get the latest in Freelancer news, mods, modding and downloads, go to
The-Starport

Berths, Docking Behavior, Etc.

The general place to discuss MOD''ing Freelancer!

Post Thu May 19, 2005 2:49 pm

Berths, Docking Behavior, Etc.

Ok... I have successfully gotten every single docking point in FL to be usable by players and NPCs.

I couldn't get Moors working entirely to my satisfaction- the Mooring code is apparantly broken, and will not properly end with a fade-to-black transition to the Room/Transition scripts of Bases. We don't see this, because player-piloted ships can't use Moors. NPC ships that use Moors, moreover, use special, hard-coded behaviors that cause them to approach the Moor, reach the HpDockMount, and then reverse and seek a new Waypoint.

So I reversed this, got rid of every single Moor in the game, and then converted every ship that uses Moors to use Docks, with a gentle increase in the docking_spheres for everything, and with some modifications to the most troublesome HpDockMount and HpDockPoint entries in several CMPs.

The results are quite neat, so I thought I'd share this. It'll be in the next version of the XML Toolkit mod, so you can "steal" it directly, but I suspect that people will want to understand the theory behind it.

Basically put... FL uses the HpMounts to determine a host of behaviors, in lieu of the centerpoints of the CMPs and SURs normally used by the game engine.

HpMounts are used to determine the following things:

1. They are the point that must intersect a docking_sphere in order to complete a Berthing sequence.

2. They are the point used to determine the position of a ship CMP in any THN Scene.

3. They are used to offset the model when undocking from Stations, Bases, and other dockable locations.

As a result of this understanding, based upon several experiments, I think that my current solution could be improved. For example, there are some notable issues with large ships:

1. You have to move the HpDockMounts out quite a ways from Stations, or offset the ships' HpMounts so that they're far below the ship's centerpoint, so that they appear "above" the object they're un-docking from.

2. Because docking and un-docking reverse the position on the Z-axis of the game objects effected, it would be wise to have all HpDockMounts positioned so that they are as far away from the Dockable as the midpoint of the longest vessel in your mod. Otherwise, with certain geometries, it's quite possible that you will see ships spawning with some of their geometry intersecting the objects they're un-docking from

3. While putting the HpMounts significantly ahead of the ships decreases their problems with docking, it increases the problems outlined in (2), above. We should put HpMounts close to the true centers of our objects on the Z axis, 0 on the X, and position Y so that large things aren't buried in the "ground" in THN Scenes, nor appear inside of Dockables.

Lastly, I have done some physics hacking, and I think that I have arrived at the lowest stable steering values that should be used for ships that will be flown by NPCs. If you are careful about the AI you assign to these ships, their flight will look very natural, because of the damping effects caused by in the increased inertial values:

SHIP

linear_drag = 1
mass = 1000
steering_torque = 350000000, 350000000, 150000000
angular_drag = 1000000000, 1000000000, 1000000000
rotation_inertia = 300000000, 300000000, 300000000
nudge_force = 150000
strafe_force = 50000

ENGINE

linear_drag = 10000
max_force = 800000

Note that linear_drag counteracts Mass exceedingly quickly. This does mean that these ships accelerate and decelerate on a dime. This is masked with the rotation_interia values, however, which make spin acceleration quite slow, plus the low rate of top spin speed.

The nudge_force ratio to linear_drag is as high as it is because the Docking AI really demands it. FL's docking AI is about as smart as a drunken cockroach- it basically picks an approach, and if it runs into anything, it will make either a right or left-hand turn, do a full 360 at speed, and re-approach, using nudge_force to align itself. You don't want it any lower than 15M/S, even though this will occasionally result in odd behavior- FL's own defaults were similar.

Also note that the Z-axis torque is lower than the other values- this is to prevent ships from exhibiting bizarre-looking barrel-rolls, which look perfectly-reasonable with fighters but look silly with capships ;-)

At any rate, I know that most of this has been explained in one place or another before, but I decided to do a lot've experiments, and I'm satisfied that these values are about as low as you can go before NPC ships will start having problems. With these super-stiff steering values, large ships will act like they're large ships if collided with- ships with smaller values with spin and vector away from the impacts, but the large ships will continue on their way, as if they weighed millions of tons

Post Fri May 20, 2005 5:02 am

Argh i have gotten moors to work fully, e.g. you command the ship to dock and the station says 'proceed to moor #' as it does for npc's,when you unmoor you start facing towards the station,controller says 'disengaging mooring link' and the ship backs up to HpMountA02 performing a 90 degree turn. I got these results by doing this:

set your mooring point as the first in the docking sphere entries, second comes its jump hardpoint - *this is the critical part* with the two hardpoints occupying the same place make the moor sphere large(this tells it you're close enough to start the sequence,i think)and the jump just large enough to intersect with spconnect.voila thats it - now your ship will drive right up to the mooring point and when it enters the jump sphere it will land(i don't remember if theres a fade sorry).your ship will unmoor from the first dock point in the solar, the moor you made,you can add as many moors as you want but theres not much point since you'll never leave from them only #1. also if you add a dock after it the controller will always call it dock 2,3,etc,however many entries there are before the dock.

unfort it doesn't sound like you've solved the always-launches-from-dock-1 bug(well actually an oversight i think)which makes it absolutely pointless to mix docks and moors because a docking fighter will leave the moor,unless its a dock in which case unmooring freighters are now leaving from a dock <_<

Edited by - Cold_Void on 5/20/2005 6:18:42 AM

Post Fri May 20, 2005 6:29 am

Hi!

Cold_Void: Do you still have the code and could you post it here. I'm also working on getting mooring to work and until now was not successful. As good as I understand, I did nearly the same as you, but it does not work. So, could you post your code here? This would be very helpful and of course I will give you credit, if it solves my problems.

Thanks!

Black Eagle

Post Fri May 20, 2005 12:08 pm

Hey, thanks Cold_Void... Chips will probably read that and give Mooring another whirl. For myself, after correcting the Docking issue with Berths... I'm pretty tempted to make HpDockMountA (etc.) in a "safe position", so that egress from the Bases works even for very large ships. I thought it was HpDockMountB, like with Gates, but if you say it's A... well, that's easy to test

I really like what I'm seeing after converting everything over to Berths, actually. It makes NPC ships land on a lot more stuff, and makes player landing on Bases more interesting, and while the ships disappear when they finish the sequence, it's not terribly noticable, because I've gotten the docking_spheres set up so that it only happens as they get fairly close to the docking bay doors. So, with small ships at least, you hardly even notice. Now that you've shared that important point about where player ships undock from, I can even see doing some Hardpoint manipulation on all of the Dockables to ensure smooth operation for players, even in gigantic capships... which would be nice, since in the next version of the Toolkit, every single ship from FL's files will be flyable

Post Tue May 24, 2005 2:41 am

with of course the lifeboat, no?

Post Sun Jan 01, 2006 1:16 pm

Cold_Void your idea does not work for me...

What spconnect hardpoint are you referencing?
and when i put it like this:

docking_sphere = moor_medium, HpDockMountI, 50.000000
docking_sphere = jump, HpDockMountI, 10.000000
docking_sphere = berth, HpDockMountA, 2.500000, Sc_open dock1
docking_sphere = berth, HpDockMountB, 2.500000, Sc_open dock2

the whole station gets bugged and you can dock with your can_use_medium_moors on every dock and the "moor" on HpDockMountI ist not called like a moor, its called like a jump ("Request granted, proceed to five"..)

Post Mon Jan 02, 2006 9:58 am

that was a mistake on my part, HpMount as Argh has said,is the ships docking point that tells it when to engage cutscenes and the rest of docking.

docking_sphere = moor_medium, HpDockMountI, 50.000000
docking_sphere = jump, HpDockMountI, 10.000000

instead of that it should be
docking_sphere = moor_medium, HpDockMountA, 50.000000
docking_sphere = jump, HpDockPointA02, 10.000000
or

docking_sphere = moor_medium, HpDockMountA, 50.000000
docking_sphere = jump, HpDockMountB, 10.000000

it has been a long time since i had this working,however it *does* work when its executed perfectly(the experiments i was working with were lost sadly,and a lot of my random tests were based on orientations of hardpoints - let me recommend using a clean slate for your test case,and lay out your docking points as revolutes so you can read their orientation easily)

needless to say HpMount(not spconnect) needs to be on the front of the ship to intersect the jump sphere

sorry my info is so bad,but scouts honor it worked(imperfectly)with the only drawback being that you undock at the first dock sphere no matter what

Return to Freelancer General Editing Forum