New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Easier to model docking - Part 1 #3075
Easier to model docking - Part 1 #3075
Conversation
Uses single point for the pad location, an offset called "pad_offset" set in the lua, and a single entrance locator. All other points required for docking and launching are generated from these.
…nto better_docking
…nto better_docking
|
@impaktor, @johnbartholomew would anyone be able to take a look over the code here for obvious issues, style etc? Testing would be cool too :) |
Thanks for the confidence, but I'm afraid I'm very unfamiliar with this code and don't understand much, but I'll gladly give this a test and report back tomorrow. I've looked through the code, and as an example of my lacking understanding, I don't see the point in using If you want more reviewers, maybe if you scratch @lwho's back (#2773), he will scratch yours. ;) |
@impaktor I didn't even notice #2773 needed reviewing :) I use const excessively, but especially for parameters passed in because it means things coming into a method aren't going to change during it's usage. Too much experience has shown that every time someone re-uses a parameter variable during a method, someone else won't know/notice that and then you've got a bug. |
I've tested this a little bit, with the two different ground stations, and the crappy orbital. When landing in London there seems to be a small glitch in the animation just when I'm put on the landing pad, nothing major, but it is the only thing I noted when testing it so I'm mentioning it now. The "glitch" was most noticeable when my ship was facing outward, and then just when I touch down I seem to do a 180 spin in one frame or something. As I said, nothing major. |
@impaktor thanks I'll look into that :) |
I'll have a look at the code. Might take some time though, since I'm also not familiar with this part of the code. |
@@ -54,7 +54,8 @@ void SpaceStation::Save(Serializer::Writer &wr, Space *space) | |||
wr.Bool(mBayGroups[i].inUse); | |||
wr.Int32(mBayGroups[i].bayIDs.size()); | |||
for (Uint32 j=0; j<mBayGroups[i].bayIDs.size(); j++) { | |||
wr.Int32(mBayGroups[i].bayIDs[j]); | |||
wr.Int32(mBayGroups[i].bayIDs[j].first); | |||
wr.String(mBayGroups[i].bayIDs[j].second); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This requires s_saveVersion
to be bumped, which currently does not happen.
When trying to understanding the code, I get totally confused about what is a port. In the locator there is a port field which gets set to However, a group is a group of bays as far as I understand (i.e. group and bays is 1:N). On the other hand there is that |
Yes the Group:Port:Bay stuff is massively confusing I'll try and tidy that up a bit. |
…PortPaths or Bays to reduce confusion.
…nto better_docking Conflicts: src/SpaceStation.cpp
Ok I've tried to clarify the naming. What was called a The old |
…ocking locator. Do a ray-plane intersection to find the place nearest to the pad locator. The ray comes from the furthest approach point, through the centre line of the station. The plane is defined by the location of the pad and the normalised axes of it's transform.
I've copied the contents of #3149 into this branch/PR now so it has a working Completely reworked the intermediate docking locator generation and it's now far more reliable and works for |
Nice. I gave it a try. Landed "manually" if we now can call it that. But works as it used to. |
@impaktor and @johnbartholomew ok I plan on merging this along with the other Are there any objections? |
No objection from me, but I haven't tried to test it. |
👍 |
Easier to model docking - Part 1
I'm getting a lot of warnings from
Non en_US locale for compiler error is kind of stupid, I know, I've changed my LC_MESSAGES permanently now. Let's see if it works next reboot. |
What is it complaining about? The |
|
Description:
The current way of defining how ships dock with a space station is a lot of work, especially when you get more than a handful of docking bays in a station.
This is because you must manually place each locator for the docking and leaving stages for each and every bay. They must be uniquely named, oriented and the whole process is quite painful, error prone and time consuming. The fact that it's actually better than the old-old system is great but not good enough.
This PR changes things so that there is a single entrance locator placed for a group of bays, and then each bay gets a single locator which defines the location and orientation of a docked ship. Almost everything else is then generated by the code to replicate, internally, the existing docking process.
This is considered
Part 1
because it keeps most of the existing docking systems in place. The system is automatic once the player/AI has crossed the entrance threshold.There will be a
Part 2
which changes the system so that the player can manually fly the ship into their bay, but this is beyond the scope of this PR.Current state:
Usable/testable with rough edges and the existing hoop_spacestation is broken.
Newer tags:
There are only 3 tags for a station now:
entrance_port01
loc_A001_p01_s0_500_b01
exit_port01
There are some important parts like if you've named your entrance
entrance_port01
then there must be some pad locators withp01
in the name to use it, i.e: the01
parts must match.To keep things simple I would try and use a naming convention starting at
01
and going up for as many ports as you have with a minimum of 1 pad per port.The pad locator only looks scary so taking
loc_A001_p01_s0_500_b01
apart we have:loc_
this is common keep the start the same always.A001_
this a pad name, 4 characters long soJohn_
,#AA#_
, etc are also valid.p01_
the port number as mentioned above.s0_500_
the ship size range in this case from0
to500
.b01
the bay number - keep them sequential, from 1 to 240.All the other tags that used to be created by hand are now generated internally.
ToDo / WIP:
There are a couple of things still to do.
optional tag/locator defined for an alternative exit allowing ships to enter one way but leave via another,I might need to solve the hoop_spacestation problem but ideally it would be solved by remodelling it,Andy