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

Improve and Optimize train detection code #1

Open
Emojigit opened this issue Mar 26, 2024 · 2 comments
Open

Improve and Optimize train detection code #1

Emojigit opened this issue Mar 26, 2024 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@Emojigit
Copy link
Member

Current solution

Find train entities around the platform door; Problems:

  1. Longer trains may not be detected by doors far away
  2. excess ABM calls

Advtrains Occupation System (attempt-occ)

Get the train occupying the track behind the door; Problems:

  1. Relatively slow; running complex table lookup for every loaded platform doors
  2. excess ABM calls

Let the trains handle the doors (I don't know if it is possible)

Hook a callback into the train's door state change code, find all platform doors next to the occupied tracks, and change their state according to the train's state. An ABM with increased interval and decreased chance will still exist (using the OCC method) to fix malfunction doors with lower time cost.

@Emojigit Emojigit added enhancement New feature or request help wanted Extra attention is needed labels Mar 26, 2024
@Emojigit
Copy link
Member Author

Emojigit commented Mar 27, 2024

... so much fun. the performance of occ-cached is even worse than occ.

In terms of long train compatibility, attempt-occ > attempt-occ-cached > master.

Entity iteration (master)

圖片

OCC without cache (attempt-occ)

圖片

OCC with cache (attempt-occ-cached)

圖片

Train and wagon iteration using door_entry (attempt-door)

螢幕截圖_20240830_074707

@Emojigit
Copy link
Member Author

Should probably wait for Advtra__ to implement door API

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant