Skip to content
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

Diagonal road investigations #603

Open
wants to merge 4 commits into
base: jgrpp
Choose a base branch
from

Conversation

reldred
Copy link
Contributor

@reldred reldred commented Oct 5, 2023

Motivation / Problem

Diagonal roads/tram lines in the manner of which Simcity up til about SC3000 did them, simply two adjoining tiles with their own 45 degree straight angle

Description

extends table/roadveh_movement.h with additional movements for corners that just take a straight 45degree line to the next tile edge rather than the gradual cornering that vanilla takes. added checks to roadveh_cmd.cpp to allow using these movement sets if the parameter is set.

Limitations

At present it's either/or, you either pick the new movement method or you stick to the old one.

Requires appropriate .grf's for road sprites. I'm hoping to have some sprites to demonstrate this feature with soon.

Reveals a lot of inconsistencies with the | and -- views of road vehicle newgrf's as a lot use weird sprite offsets and not the vanilla ones. So-far Vanilla and Road Hog work well, HEQS fails due to oversized road vehicles. Ikarus bus set shows promise with its smaller scale but their | and -- orientations still require better offsets.

I have one outstanding crash; the disconnected road vehicles exception that occurs with articulated road vehicles. For some reason, articulated road vehicles 'tear' in half when performing these turns and produce the exception, however articulated trams are immune to this problem except in the below case of changing the setting during gameplay. At this point I cannot fathom why articulated road vehicles would behave any differently to articulated trams, as they're both using the exact same movement tables (it's just their U turn movement tables that differ).

I've also checked the edge case of turning the setting on and off during play and it doesn't appear to create any ill effect, except for producing the disconnecting road vehicle exception with Trams. This would be reasonable to block from changing once a game is in progress much like drive on road side setting but I'm not sure off the top of my head how to do that despite copying much of the settings and flags from the road side settings switch.

Road building tool needs a diagonal drag option. Not sure how to do this.

I haven't touched save/loading of settings yet.

Checklist for review

@reldred
Copy link
Contributor Author

reldred commented Oct 6, 2023

It appears as though the disconnecting vehicle crash only happens during overtaking with articulated vehicles and diagonals, which explains why it didn't affect trams.

Edit: Confirmed, disabling overtaking for articulated vehicles prevents the disconnect crash happening.

Edit2: Exception still pops up extremely rarely, I managed to reproduce it with the above conditions after approximately 20yrs on fast forward.

Edit3: Scrap all of that. I can't find any rhyme or reason to the crash, at first it was just RV's and not trams, now it's trams too, then I thought it was just long vehicles (spanning multiple tiles with following vehicles? now it's affecting super short vehicles too. Only consistent bit is it's articulated vehicles that seem to cause it.

Edit4: Super short articulated vehicles seem to be the exception, only thing I can think of is it's when an articulated trailer enters the tile when the leading vehicle is already entering the new one. Now that's nothing unusual for vehicles normally, but because I'm not leaving the initial tile in the same direction the next tile is expecting it seems to trigger the crash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant