Change the way Refinery works

Guilherme Silva de Souza shared this feedback 2 years ago

As a programmer, I've always wondered about why refinery is so aggressive in its design and code. It consumes larges amount of processing and resources from the server.

It works aggressively, making constant calculations / operations per second, and over time I saw the increase in lag on the servers as more refineries were up and running. This has improved with game updates, but still needs a better design.

The operations I see happen are:

1. Look for ore in the ship's storage.

2. Find % refinement of the ore and calculate quantity to be reduced.

3. Remove amount of ore from storage.

4. Look for refined ingot stack in storage.

5. Add quantity.

These basic operations are indispensable to have a system of refinement in the game, however, I believe that the optimization would come with a game design change of the refinery.

1. It has to process huge amounts of minerals at once and take longer to deliver these materials. Something similar to what the assembler does showing the progression of construction.

2. We could have one module to increase the amount of material processed at a time.

3. Given this new design, we could select which materials the refinery would use and it could process alternately.

For example:

1. Player choose Iron Ore to be processed.

2. Refinery picks up 1000kg of Iron Ore (or what the storage have).

3. Refinary starts processing 1000kg of iron ore. [Sleep for 10 seconds (processing time for 1000kg )].

4. Refinary wake up after 10 seconds.

5. Search for the storage to deliver the Ore Ingot.

The goal is to keep the refinery idle for longer times, avoiding item search / removal / addition operations per second that is currently happening.

Comments (6)


This is exactly how I was expecting processing blocks to work and also, how they should instead. It doesn't make sense to constantly update the inenr values, when processing amounts and times are known (exept for random events, that could just trigger calculations in between).

Thx for writing down this suggestion!



I don't think the refinery is very heavy for performance. It's just number manipulation with simple math operations. The only thing I can see being heavy for performance is searching for ore to process, but as far as I can see, this is done in chunks and only once in a while.

I know that Keen have done a lot of profiling on their code to see where performance could be improved and if Refineries were a problem, they would have spotted it.


This may be correct in singleplayer or with low numbers of players, but definitely not in a multiplayer enviroment of crowded servers, where refineries (and other processing units) still work, while players are already offline.

What may be true (most likely) is, the searching for materials and/or empty destination slots in inventories is the real burden - but when only checked "now and then" (which means based on some ticks count) it is still a heavy load for a server and could be reduced drastically.


As I understand your suggested solution, the same could be achieved by increasing the interval of when the refinery searches for ore?

The actual processing of ore that os already in a refinery negligible.


Totally agree. Make refinery like survival kit working now.


Same Wondering. Refinery can be way more optimized than current design. i agree with your vision (design).


I don't propose to know anything about how computers work, but i'd do anything to make space less lonely.



Personally, I think that it should be a toggle. That way you can turn off its auto detect if you are not processing large ammounts of ores, but can have it basically auto process all ores in the grid, like it does now, when toggled on (most likely for use after lare miming operations, tgat way you dont have to spend 5 mins spmming prouction buttons on the refineries)