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

Feat 0.17api - Rendering and entity.status #53

Merged
merged 51 commits into from Apr 8, 2019

Conversation

Roang-zero1
Copy link
Contributor

@Roang-zero1 Roang-zero1 commented Apr 7, 2019

As mentioned in #52 I've updated the code to use the new 0.17 rendering engine.

I've also rebased the branch on master to include the latest fixes, just fyi.

Troels Bjerre Lund and others added 30 commits April 5, 2019 23:02
Add new sprite graphic and definition.
Add invisible sprite on build and remove later.
This is more dynamic and allows for tint control via settings.
The position is now infered from the entity, if anyone moves it the sprite
will follow.
Removed move detection code.
Make the sprites invisible to enemies
We now only update the sprite if the status changed
As the sprites are now linked to the entities at creation, this is handled
by the game itself.
@Roang-zero1
Copy link
Contributor Author

I will clean up the code some more, but the features are there and can be tested!

@Roang-zero1
Copy link
Contributor Author

Ok I've found out there is still a performance problem with large bases, so I would hold of on releasing this branch until this is released.

@troelsbjerre troelsbjerre merged commit a526989 into troelsbjerre:master Apr 8, 2019
@troelsbjerre
Copy link
Owner

Awesome work! I accidentally merged it to master, but now moved it back to the feature branch. I haven't had time for a proper test of it yet :(

About the big bases issue: One possible (major) change to the update logic is that we let go of the global dict of machines and their signals. Instead, updates would only happen around each player that want the signals shown (by re-scanning regularly). It would still be possible to cap the global number of updates per tick, and when its time for a new scan around a player, that scan would be the only computation that tick, so it might be fast enough.

Pro:

  • Refresh-rate of signals does not depend on size of base (!)
  • No need for event hooks for creation/deletion of signal-worthy entities

Con:

  • Update logic will be more complicated
  • Might be hard/infeasible to get it to work for far-views like train/radar view
  • Double calculation for nearby players
  • Performance depends on how many players have it enabled. Even though it is now an independent computation per player, it still has to be done everywhere, due to the lock-step requirement.

@Roang-zero1
Copy link
Contributor Author

Sorry I did not elaborate enough it was just a quick message to make sure you do not release the version yet.
The problem is not with the mod update logic but the game functions for updating sprites. When there is a large number of sprites (>200k) changing a sprite or tint may take up to 11ms.
So changing it to be only around players would unfortunately not fix this if the player is in the newer parts of the base (higher rendering id).
I will file a bug report in the evening and link it here.

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.

None yet

2 participants