troelsbjerre / Bottleneck

Factorio mod that tell you which assemblers are starved of ingredients
Other
29 stars 21 forks source link

Suggestion: Use entity status and script rendering #52

Closed Bilka2 closed 4 years ago

Bilka2 commented 5 years ago

With 0.17, you can use https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.status to get the entity status in a performant way.

Furthermore, you can use the script rendering for per player visibility.

troelsbjerre commented 5 years ago

Thank you for the reminder. I've been looking forward to these changes, but haven't had much time to develop the idea. I've added a first attempt at it in the feat-0.17api branch, which looks promissing, but I haven't had time to test it.

Roang-zero1 commented 5 years ago

I would like to take a shot at the rendering engine to replace the spotlight entities. Would you be interested in me helping out with developing this?

troelsbjerre commented 5 years ago

@Roang-zero1 I'll try to help out, but I cannot promiss much, since I'm a little strapped for time these days. The primary target feature is the per-player visibility. The new rendering api allows to specify a list of players for whom the graphics is shown. I suspect it might be fast enough to keep that list up to date in the mod, and then have the update function blindly destroy the old signal and draw the new signal with the up to date list of players.

Bilka2 commented 5 years ago

I suspect it might be fast enough to keep that list up to date in the mod, and then have the update function blindly destroy the old signal and draw the new signal with the up to date list of players.

Just change it on the signal for better performance. I specifically made everything writable so that you don't have to destroy + recreate.

Roang-zero1 commented 5 years ago

As mentioned in the pull request (#53) there is still an issue with performance of the rendering engine call, this preventive of merging the changes. I've opened a request on the forums to address this: https://forums.factorio.com/viewtopic.php?f=28&t=69230

Roang-zero1 commented 5 years ago

As per forum thread it will not be possible to use the new rendering engine for Bottleneck due to low performance on the number of renderings needed. So I will look into optimising the existing code with the new entity stati,

Roang-zero1 commented 5 years ago

Just a quick update was busy with work so no time to work on this, but I will continue work in the upcoming week.

raiguard commented 5 years ago

It's a shame that a functionality which almost seems specifically tailor-made for this exact kind of usecase isn't actually the best option. :(

Roang-zero1 commented 4 years ago

Finally had the time to complete the modification, so the part of the 0.17 API (entity status) that can be used is now included. See #62 .