Better docking

A quieter space for design discussion of long-term projects
FluffyFreak
Posts: 1343
Joined: Tue Jul 02, 2013 1:49 pm
Location: Beeston, Nottinghamshire, GB
Contact:

Re: Better docking

Post by FluffyFreak »

Ugh, looking at the docking code I think the quickest way of doing this is to put a pair of Y-fronts on my head, stick two pencils up my nose, set fire to my PC and run away screaming...

Right lets put those thoughts aside... from the modellers points of view I propose that these are the only locators they will need to provide:
Assuming a 1 bay, 1 port spacestation:
  • entrance_port01
  • locator_p01_s0_500_b01
For a 4 bay, 1 port spacestation:
  • entrance_port01
  • locator_p01_s0_500_b01
  • locator_p01_s0_500_b02
  • locator_p01_s0_500_b03
  • locator_p01_s0_500_b04
For a 4 bay, 2 port spacestation - where 1st port take ships 0-500 and 2nd takes ships 500-5000:
  • entrance_port01
  • locator_p01_s0_500_b01
  • locator_p01_s0_500_b02
  • entrance_port02
  • locator_p02_s500_5000_b01
  • locator_p02_s500_5000_b02
And then because I've gone completely button-moon I propose getting rid of the "ship_launch_stage", "bay_groups", "dock_anim_stage_duration", "undock_anim_stage_duration" from the station `define_orbital_station` & `define_ground_station` Lua file functions.

This will come with some restrictions I think but for now lets handwavium those away and discuss how docking will work in our perfect utopian future.

Modeller Example:
Take the preview of nozmajners new spacestation:
There's an entrance and many bays.
So with this scheme all that Noz' has to do is place a correctly named locator in the centre of each landing bay, and then one more in the entrance to the station and that's it everything else is handled by the engine internally, hopefully reducing modeller workload by the maximum I can think of.

Inner Workings:
This is a little bit trickier but it work thusly:
  • load the model as usual,
  • read all "entrance_port_" tags
  • read all "locator_port_" tags
  • build the port/bay data structures
Now we know where we enter and leave (entrance's) and where we're going. This is probably enough information for a player to manually dock with a station so long as we visually identify which pad they're supposed to land on, and they can manage to fly through the entrance.

For the A.I. we'll need to do some more work. From the locator we can create another position which I will call the "hook" - this has the same orientation as the locator but it is offset from the locator along it's UP axis by some amount (I haven't decided how I'll determine this yet) so it's floating some distance above the landing pad. For the entrance I'll do the same thing but this time I'll generate 2 new positions that are hopefully on either side of the entrance and the offset will be along the FORWARD/BACKWARD axis.

As far as the code will care these new points will be just like the old "docking_" & "leaving_" locators that you currently have to place, so the autodocking should still work.

Without any other changes this would all just trigger EXACTLY like it currently does, so instead we'll need to also change it so that the auto-docking only happens if you've got the autopilot enabled. The "collision_pad_X" geometry will only have to cover the landing pad itself, like it does on the ground stations because this is the final trigger which says "Right I am really landed now!".

Hmm, there's some other details that will need working out but that's a decent incremental change I think.
I've been looking into the docking code tonight and it's just hideous to deal with, a real mind bender in places :/

I'll think more about it tomorrow but that should give us basic manual docking like we can with the ground stations, but the auto-docking should still work (ugly as it is) as it currently does.

EDIT:- updated with encoding the bay size in the locator name.
FluffyFreak
Posts: 1343
Joined: Tue Jul 02, 2013 1:49 pm
Location: Beeston, Nottinghamshire, GB
Contact:

Re: Better docking

Post by FluffyFreak »

I now have this working for ground and space stations with caveats.

I'll try to deal with those remaining caveats later tonight if I get chance too.

The only one I won't be able to fix is, ironically since I made it originally, the hoop_spacestation. Or at least, I cannot think of a good way of fixing it right now.

nozmajners new_crappy (should be "awesome_hoop" or something btw), the existing big_crappy and both ground stations will all be fine though.
FluffyFreak
Posts: 1343
Joined: Tue Jul 02, 2013 1:49 pm
Location: Beeston, Nottinghamshire, GB
Contact:

Re: Better docking

Post by FluffyFreak »

There's a build available for testing now.

I'll quote myself from IRC:
<FluffyFreak> to make converting existing ones easier it's currently enough to just do some simple renaming
<nozmajner> nice
<FluffyFreak> "approach_stage2_bay1" becomes "entrance_port01"
<FluffyFreak> "docking_stage3_bay1" becomes "loc_A001_p01_s0_500_b01" ... which is, maybe not so simple :)
Ok there are some caveats here: loc_A001_p01_s0_500_b01

I've highlighted one important part, this must ALWAYS be 4 characters long.
They can be letters or numbers, symbols and other things might work, or they might explode horribly, I haven't tested it yet.

Now i'll break down that locator tag a bit:
  • loc_ <- this is how we identify the locator tag
  • A001_ <- a 4 character namelike : A001, JOHN, i0X3, BILL, etc0
  • p01_ <- can also be p1_ / p0000001_ / p999999_ but: p1_ / p0000001_ == entrance_port01, and p999999_ == entrance_port999999
  • s0_500_ <- ship size allowed (this is a bit broken currently) s0_500_ == sizes 0 to 500
  • b01 <- the bay number, must still be sequential from 0 to 240 can be b01, b00001, b1 etc.
This is work in progress right now but is functional enough to test with.
bszlrd
Posts: 1084
Joined: Mon Jul 01, 2013 3:25 pm
Location: Budapest HU

Re: Better docking

Post by bszlrd »

How do I name the collision mesh for the pads? With collision_pad# it doesn't care which one I hit, it tows me to the designated port. Or I'm just trying to set it up for manual landing, but it's not supposed to do that? (I must be tired).
It's sure simpler to set it up either way.
FluffyFreak
Posts: 1343
Joined: Tue Jul 02, 2013 1:49 pm
Location: Beeston, Nottinghamshire, GB
Contact:

Re: Better docking

Post by FluffyFreak »

Remember I said I was going to do it in two parts?
First change the docking locators so you only need one-per pad and then later on change the collision part?

This is just part 1 :)
Collision and docking still works the same with it hitting any tagged collision_pad# geometry and then auto-docking.

Part 2 will be me changing that, somehow.
bszlrd
Posts: 1084
Joined: Mon Jul 01, 2013 3:25 pm
Location: Budapest HU

Re: Better docking

Post by bszlrd »

Yeah, sorry. :) I was quite tired when I asked.
FluffyFreak
Posts: 1343
Joined: Tue Jul 02, 2013 1:49 pm
Location: Beeston, Nottinghamshire, GB
Contact:

Re: Better docking

Post by FluffyFreak »

Might as well discuss it now anyway, how would you like it to work?

I was expecting you would want to do like we have with the ground stations, a single mesh on the pad called "collision_pad#".

That's fine but we still need something for the AI to hit and begin auto docking for AI or players on auto-pilot. so I suggest turning the existing "collision_pad#" geometry into something called "collision_ai_dock" and then I handle in code whether it means we begin auto-docking or not.

Two other things:
  • The new sexy spacestation has holes at both ends, do you want me to add support for an optional "exit_port#" tag that would mean the Ai approachs from one end and leaves out of the other?
  • Highlighting the docking bay the player wants, have you seen the Elite:Dangerous docking videos? I see no reason we can't do something like that with docking bay navlights (& maybe something nicer in future).
I'll get on with making the docking work and not spin the ship around now :)

Andy
bszlrd
Posts: 1084
Joined: Mon Jul 01, 2013 3:25 pm
Location: Budapest HU

Re: Better docking

Post by bszlrd »

Yes, collision_pad# was the way I was thinking when fooled around with it. collision_ai_dock seems logical to me for auto_docking.
exit_port# would be nice too. I'm constantly thinking about just turning around the ships for this station, instead of sending them trough the whole dock when exiting. Both seems logical and counterintuitive the same tim. Anyway from a modelers viewpoint, it's not too much do add another tag for each port (I'm assuming port is a collection of bays)

Yes, I was thinking about a way to highlight the bay. I guess there should be billboard lights at minimum. Also it would be nice if the nav target marker would be on the given bay.
And also it would be nice to have some kind of nav tunnel on the HUD. along the axis of the station (indicated by tags in the model) to help align with the entrance.
Maybe even some pad specific animations, like moving those cranes over the ship when landed, and moving it away before takeoff. (I know, I should shut up now :D )
FluffyFreak
Posts: 1343
Joined: Tue Jul 02, 2013 1:49 pm
Location: Beeston, Nottinghamshire, GB
Contact:

Re: Better docking

Post by FluffyFreak »

I haven't had time to do anything on this as I've been run off my feet with the new job.

I'm going away for a wedding this week so won't be back until next Saturday afternoon... just in case anyone wonders why I'm not working on it ;)
FluffyFreak
Posts: 1343
Joined: Tue Jul 02, 2013 1:49 pm
Location: Beeston, Nottinghamshire, GB
Contact:

Re: Better docking

Post by FluffyFreak »

From IRC:
<nozmajner> FluffyFreak: is there a way to add some kind of easing to those automatic movements?
<FluffyFreak> yeah could start and end easing in/out
<FluffyFreak> actually could treat the position as a bezier spline and have it be quite smooth I suppose
Post Reply