Page 1 of 1

[16.30] Rail Planner direction fixed after first ghost placement

Posted: Sat Mar 17, 2018 2:33 am
by wizard07ksu
This might actually be two bugs, but I'm putting them both into one report since they both deal with the rail planner.

The first issue, which is new to 0.16.30 (experimental), is that after placing a set of ghosts using the rail planner, the orientation of the next rail piece gets set to "up".

Expected behavior based on previous version is that when you first SHIFT+CLICK to start rail planning, the orientation of the track entering the square the cursor is over will be chosen by the system. The game will figure out the best way to get from origin to cursor, and will orient the track appropriately. The system will STOP choosing the orientation of the final track piece after the player rotates the track. All of that still works.

My broken expectation is that after placing a section of ghost track, the game will remember the orientation of the final rail piece. E.g., if I wanted to turn some track, I would rotate the track for the direction I want to go and place it. Then, the next track ghost will still be facing the same direction. But what is actually happening is that the new rail planner orientation will be due north/up. Pics are attached (Planner Orientation*).

Further, after placing a section of ghost track with the rail planner, the system will no longer change the orientation of the final track piece. Its as though I rotated the track to point up. I have to manually reorient.

The other bug is related to a weird collision box issue with curves. See attached pics (Collision Box*) for an example. My expectation here is that this should either be a collision for all cases or none. Either that radar is in the way of the rail (should not have been able to place the curved segment), or it shouldn't be in the way of either the curved segment nor the diagonal segment. Right now, the inconsistent behavior is really annoying.

Re: [16.30] Rail Planner direction fixed after first ghost placement

Posted: Sat Mar 17, 2018 11:48 pm
by Rseding91
Thanks for the report. I fixed the first issue for the next version of 0.16.

The 2nd issue is not currently fixable. Curved rails use 2 different rectangular bounding boxes so if an entity would collide at the intersection of those 2 bounding boxes where they don't overlap it doesn't collide due to missing both bounding boxes. When you try to build the diagonal rail it's a single rotated rectangular bounding box and it does overlap that little corner where the curved rail missed and isn't buildable.

Curved rail bounding boxes can't be adjusted without braking multiple other rail related setups and we aren't going to add support for non-rectangular bounding boxes so we're stuck with what we have now.

Re: [16.30] Rail Planner direction fixed after first ghost placement

Posted: Sun Mar 18, 2018 6:30 pm
by wizard07ksu
Good to hear about the ghost fix! And thank you for the explanation on why you can't fix the 2nd one. I don't think that will matter a great deal - I've played the game for over a year and haven't seen this until now. It likely won't come up very often.

Re: [16.30] Rail Planner direction fixed after first ghost placement

Posted: Sun Mar 18, 2018 7:32 pm
by Jap2.0
Rseding91 wrote:Curved rails use 2 different rectangular bounding boxes so if an entity would collide at the intersection of those 2 bounding boxes where they don't overlap it doesn't collide due to missing both bounding boxes. When you try to build the diagonal rail it's a single rotated rectangular bounding box and it does overlap that little corner where the curved rail missed and isn't buildable.

Curved rail bounding boxes can't be adjusted without breaking multiple other rail related setups and we aren't going to add support for non-rectangular bounding boxes so we're stuck with what we have now.
A few things:
1. What negetive effects would enlarging curved rail bounding boxes a couple pixels really have? It wouldn't break anything that's there currently (c.f. turret and boiler size changes). Are there any very common rail setups that make use of things very close to a curved rail, and even if so, isn't it part of the game to build around other stuff (at least with belts, and to some extent bots, although I don't want to start that debate here) and changes like this (expecially considering that we're still in alpha)?
2. I keep hearing about how curved rails have two bounding boxes. Would it help performance any if you internally split curved rails into two (or even more) entites? I though I heard once that having to check if everything has two bounding boxes hurt performance for everything, but I can't seem to find that now and it easily could've been optimized since.

Re: [16.30] Rail Planner direction fixed after first ghost placement

Posted: Sun Mar 18, 2018 7:57 pm
by Rseding91
Jap2.0 wrote:1. What negetive effects would enlarging curved rail bounding boxes a couple pixels really have? It wouldn't break anything that's there currently (c.f. turret and boiler size changes). Are there any very common rail setups that make use of things very close to a curved rail, and even if so, isn't it part of the game to build around other stuff (at least with belts, and to some extent bots, although I don't want to start that debate here) and changes like this (expecially considering that we're still in alpha)?
I changed them once and it was around 3 weeks of bug reports and new tests to fix all of the things it broke with the end result being I fully reverted the bounding box size changes. You can run the test suite that ships with the game after making changes yourself locally to see if you broke any of the things we currently have tests for. Most likely you will :)
Jap2.0 wrote:2. I keep hearing about how curved rails have two bounding boxes. Would it help performance any if you internally split curved rails into two (or even more) entites? I though I heard once that having to check if everything has two bounding boxes hurt performance for everything, but I can't seem to find that now and it easily could've been optimized since.
That's something we've talked about doing as well. We just haven't gotten around to it yet because the current system mostly "works".

Re: [16.30] Rail Planner direction fixed after first ghost placement

Posted: Sun Mar 18, 2018 9:42 pm
by Dune
I just posted this 58813 bug as well, and created a video to go alone with it that I'll share here. https://www.youtube.com/watch?v=g8qslm1ftRI

Sorry, didn't see this in search when I posted mine. Thx for fixing it!

Re: [16.30] Rail Planner direction fixed after first ghost placement

Posted: Mon Mar 19, 2018 1:11 am
by Jap2.0
Rseding91 wrote:
Jap2.0 wrote:1. What negetive effects would enlarging curved rail bounding boxes a couple pixels really have? It wouldn't break anything that's there currently (c.f. turret and boiler size changes). Are there any very common rail setups that make use of things very close to a curved rail, and even if so, isn't it part of the game to build around other stuff (at least with belts, and to some extent bots, although I don't want to start that debate here) and changes like this (expecially considering that we're still in alpha)?
I changed them once and it was around 3 weeks of bug reports and new tests to fix all of the things it broke with the end result being I fully reverted the bounding box size changes. You can run the test suite that ships with the game after making changes yourself locally to see if you broke any of the things we currently have tests for. Most likely you will :)
How do I run the test suite (or where is it found)?
Rseding91 wrote:
Jap2.0 wrote:2. I keep hearing about how curved rails have two bounding boxes. Would it help performance any if you internally split curved rails into two (or even more) entites? I though I heard once that having to check if everything has two bounding boxes hurt performance for everything, but I can't seem to find that now and it easily could've been optimized since.
That's something we've talked about doing as well. We just haven't gotten around to it yet because the current system mostly "works".
[/quote]

Ah, okay. Are multiple bounding boxes only used for the curved rails, or can it be used by mods (that it would break, although seperating curved rails would presumable do that to some extent already)?

Re: [16.30] Rail Planner direction fixed after first ghost placement

Posted: Mon Mar 19, 2018 3:23 am
by Rseding91
In the game folder under "tests" there's a .bat file - just run that.

Re: [16.30] Rail Planner direction fixed after first ghost placement

Posted: Wed Mar 21, 2018 1:11 am
by Jap2.0
Okay, thanks.