PFQNiet / Satisfactorio

Factorio mod that brings Satisfactory mechanics
GNU General Public License v3.0
11 stars 2 forks source link

Radiation improvements #71

Closed PFQNiet closed 3 years ago

PFQNiet commented 3 years ago

Radiation is by far the most UPS-costly feature, and mostly because of the cost of checking conveyor belts for radioactive items.

One way of improving this would be do decrease the frequency of updates. Stationary entities don't change much, if at all, and even transport belts moving items around don't change all that often - either they're carrying radioactive stuff or they're not, and the amount is usually fairly fixed. Vehicles, however, may travel long distances in short times, carrying radioactive materials with them. Vehicles tend to be much fewer in number, compared to belts that can easily be in the tens to hundreds of thousands.

It might be a good idea to rework radiation to track stationary entities and vehicles separately, updating the radiation in a chunk whenever a vehicle crosses boundaries. It's worth noting that with player interaction, vehicle contents can "teleport" across chunk borders if the player transfers items into/out of the vehicle from over the border. So a naive solution won't necessarily work here.

Instead, tracked vehicles would need to keep track of their current radiation levels. Then when the chunk updates (or when the vehicle crosses a border) then its value is added to the background radiation total.

PFQNiet commented 3 years ago

Only container entities are considered now for background radiation. Resources and simple-entities have fixed emissions, and the character is now responsible for checking nearby entities for radiation.