Inexact simulation outside view

Ideas that are too old (too many things have changed since) and ones which won't be implemented for certain reasons or if there are obviously better suggestions.

Moderator: ickputzdirwech

Post Reply
ymte
Manual Inserter
Manual Inserter
Posts: 1
Joined: Tue Oct 24, 2017 9:02 am
Contact:

Inexact simulation outside view

Post by ymte »

TL;DR To replace parts of the factory simulation outside the players' view with approximate, percentage-based simulation.

Static parts of the factory that are outside the players' view do not have to be exactly simulated but can be approximated.
For parts of the factory that are isolated (only few input/output belts/trains/logistic chests with few item types), simulation could be reduced to keeping only track of percentages of units that need very little updating:
  • - Continuous parts of belts keep track of how full they are
    - Splitters divide the available capacity evenly between outputs
    - Chests keep track of how full they are
    - Assembly machines calculate output percentage based on input percentages
For example, a simple system such as

Image

could be represented as

Image

When the chest is empty, the percentages have to be updated to look something like this:

Image

Once a player walks towards such system, the simulation has to know how much time passed since the last percentage update, then recalculate all percentages and convert it to real-world items with discrete positions.

This way of simulating is very CPU-friendly since each of these systems only need to be updated once something significant happens: train arriving, player walking close, chests empty, enemy attack. Many items can be simulated this way.
However this technique is not applicable for the entire factory, as circuit components or techniques relying on individual items cannot be abstracted into the percentage system. Belts containing many types of products also do not work well.

PS. Anyone experienced with the modding API: is it possible to skip over or replace parts of the factory simulation?

sillyfly
Smart Inserter
Smart Inserter
Posts: 1099
Joined: Sun May 04, 2014 11:29 am
Contact:

Re: Inexact simulation outside view

Post by sillyfly »

AFAIK, this is pretty similar to what the UPS-Up mod does: https://mods.factorio.com/mods/AntiElite/UPS-up

It causes most entities to update less frequently, but each update does the equivalent of multiple ticks.


I'm pretty sure making the whole game work like that would be very complicated, and would eventually be more trouble than it's worth. One of the strengths of Factorio is that the simulation is deterministic and complete (in the scope it defines).

JohnyDL
Filter Inserter
Filter Inserter
Posts: 533
Joined: Fri May 16, 2014 3:44 pm
Contact:

Re: Inexact simulation outside view

Post by JohnyDL »

you add bug potential and you delete multiplayer compatibility and managing what does what when and how big those updates need to be can be complicated say your system fills a train so it's 'isolated' in terms of nothing directly connects to the user but you walk over there and because the update hasn't happened a train that would have been full hasn't moved, that'd be irritating.

Jap2.0
Smart Inserter
Smart Inserter
Posts: 2339
Joined: Tue Jun 20, 2017 12:02 am
Contact:

Re: Inexact simulation outside view

Post by Jap2.0 »

Okay, now program something that can do that for something that isn't the least complex possible setup. Use logistics bots, trains, fluids, and mods. Also implement this into a complex, completely determenistic game while making significant preformance increases.

The point is, it's a lot harder than you make it sound for a lot less benefit than you think it would be.
There are 10 types of people: those who get this joke and those who don't.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13202
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Inexact simulation outside view

Post by Rseding91 »

ymte wrote:Static parts of the factory that are outside the players' view do not have to be exactly simulated but can be approximated.
Yes they do have to be exactly simulated and no they can't be approximated. If things weren't exactly simulated it would break the circuit network, logistic network, and pretty much all game logic as you move around. It would also essentially double + the amount of code that would have to be written to make the game work with the end result it probably wouldn't be any faster but it would make the game so much worse.
If you want to get ahold of me I'm almost always on Discord.

Koub
Global Moderator
Global Moderator
Posts: 7199
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: Inexact simulation outside view

Post by Koub »

In that case ...
[Koub] Moved to "won't implement"
Koub - Please consider English is not my native language.

Post Reply

Return to “Outdated/Not implemented”