Skip to content

Migrate GLR to metarules - #558

Open
memo33 wants to merge 4 commits into
NAMTeam:stagingfrom
memo33:meta-glr
Open

Migrate GLR to metarules#558
memo33 wants to merge 4 commits into
NAMTeam:stagingfrom
memo33:meta-glr

Conversation

@memo33

@memo33 memo33 commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

'tis a beaut.

This replaces the old draggable GLR code by a rock-solid purely metarules-based implementation.

This PR depends on #557.

The old handwritten GLR code had some flaws:

  • The orthogonal piece often switched orientation in the direction the network was dragged, which can lead to instability.
  • The GLR code hadn't been kept in sync with changes to the Lightrail rules (such as the removal of the traffic circle from a four-way intersection).

Ideas for future extensions:

  • add IDs for end stubs
  • add support for Lightrail × GLR

These would require some work on textures/paths/models.

@jflann

jflann commented Aug 26, 2026

Copy link
Copy Markdown
Member
image

I don't recall if this worked under the old implementation. Is this something that should be handled by dll-based adjacency?

@memo33

memo33 commented Aug 27, 2026 via email

Copy link
Copy Markdown
Collaborator Author

@jflann

jflann commented Aug 27, 2026

Copy link
Copy Markdown
Member

Yes, this used to work. So far, the Lightrail stubs were overridden by plain straight GLR pieces. Back in the day, this made sense for compatibility with stations for non-draggable PP-based GLR. The DLL-adjacencies don't cover this currently, mainly as a safe-guard against unintended stuff like recursion. The cleanest solution would be to introduce unique proper end stubs for GLR. Then the DLL would cover it. In any case, the stubs are more for a nice feel than they are practically relevant.

Okay, thanks for the explanation. I agree, the best way to resolve is to implement the end stub. I can look into that. It's definitely fine as is though.

add(0x0a001500, Groundhighway~EW); add(0x0a002200, Groundhighway~ES); add(0x0a002100, Groundhighway~SharedDiagRight)

add(0x5d300000, Str ~NS); add(0x5d500100, Str ~ES)
builder.addOne(Glr1~NS, IdTile(0x5f880000, R0F0, mappedRepr = _.flatMap(rf => Set(rf, rf * R2F0)))) // temporary bandaid: extra rotations for better compatibility with old handwritten GLR code

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still required? AFAICT, there is no longer any handwritten GLR code.

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.

2 participants