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

Spread out the signal reads so we're not updating all signals every X ticks #3

Open
narc0tiq opened this issue May 15, 2017 · 1 comment
Assignees

Comments

@narc0tiq
Copy link
Owner

Easy option: remember the tick when the monitor entity got placed and use placed_tick % sample_frequency_ticks as the key (spreads things semi-randomly, but probably sufficiently).

Trickier option: keep a bunch of buckets and divide round-robin into those buckets -- but they'll get uneven when removing monitor entities. Maybe load-emptiest-first? They still get uneven, but they get better when you add more.

Better yet: we're keeping a list of combis anyway -- just iterate that over multiple ticks, like the YARM ore reader (retaining the iterator between ticks). Possible difficulties:

  • when fewer than signal_update_frequency monitors, we need to skip everything that's been updated more recently
  • when more than signal_update_frequency monitors, we need to update more than one monitor at a time

(possible simplification opportunity: always iterate 4 combis every tick and don't allow the player to place more than 1200 combis)
(in fact, setting a maximum number of combis may be a good idea regardless, since both reading signals and storing them gets nontrivial as you add more and more)

@narc0tiq narc0tiq self-assigned this May 15, 2017
@narc0tiq narc0tiq removed this from the v0.1 - Minimum Viable Product milestone May 23, 2018
@narc0tiq
Copy link
Owner Author

Not actually required for MVP.

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

No branches or pull requests

1 participant