Mod threading for increased performance

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

User avatar
cpy
Filter Inserter
Filter Inserter
Posts: 840
Joined: Thu Jul 31, 2014 5:34 am
Contact:

Mod threading for increased performance

Post by cpy »

What if you could define mod to use threading? Some mod that just calculate remaining ore or just monitor something and display text output to GUI don't need to fight for precious update time they could run independently right?

Also factorissimo mod, it runs lot of independent worlds that just transfer resources to main world, but inside of a factory can run in separate thread and do its thing.
How it would work?

Main loop Update ->
Factory 1 thread -> Sync inputs and outputs to finalize -> next cycle
Factory 2 thread ->

Or as you would thread minecraft overworld nether and end you can run main loop independently then just wait for all updates to finish and sync transfers between them.

You could even include big warning like: You are using mods that use threading: mod 1 mod 2 mod 3, continue on your own risk!
orzelek
Smart Inserter
Smart Inserter
Posts: 3924
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: Mod threading for increased performance

Post by orzelek »

Tbh for this to work there is a need to have dev's created entities to transfer items, fluids and power between surfaces. Potentially also pollution.
After that it should be possible to run each surface sim on separate thread and then sync resource transfers in the end.

That would quickly lead to a mod where you would build factory on few concurrent surfaces to build much bigger factory :)
Patashu
Fast Inserter
Fast Inserter
Posts: 130
Joined: Mon May 08, 2017 11:57 pm
Contact:

Re: Mod threading for increased performance

Post by Patashu »

I don't think any mod with gameplay effects can use threading and also be multiplayer compatible, since Factorio multiplayer uses lockstep simulation (= all players must calculate gameplay the same way, and agree on the same sequence of events, or desync occurs).
User avatar
cpy
Filter Inserter
Filter Inserter
Posts: 840
Joined: Thu Jul 31, 2014 5:34 am
Contact:

Re: Mod threading for increased performance

Post by cpy »

As i was saying those will be 2 different worlds running 2 and more locksteps side by side and just swap power/items/fluid/entities at main thread so other worlds can be threaded.
Post Reply

Return to “Ideas and Suggestions”