Page 1 of 1
[Rseding91] [2.0.73] Selection area problem under medium/low UPS conditions with mouse movement.
Posted: Mon Feb 02, 2026 4:26 pm
by reduke
Running around 30 UPS I am noticing a really annoying bug with copying.
When selecting an area to copy (say from x=0,y=0 to x=100,y=100), upon releasing the mouse cursor at x=100,y=100, the copying process itself will induce some lag, especially if more than a few items are selected.
If the mouse is moved during that specific selection induced lag (ie from x=100,y=100 to x=105,y=95), the selection process will copy the items under the area x=0,y=0 to x=105,y=95, rather than the area x=0,y=0 to x=100,y=100.
I suspect that this can be resolved if the selection area co-ordinates can be recorded as the first operation during the selection process, but I am not a programmer...
Re: [2.0.73] Selection area problem under medium/low UPS conditions with mouse movement.
Posted: Mon Feb 02, 2026 9:49 pm
by Rseding91
Thanks for the report however that's already how it works. The "iterate and collect entities in the area" is done as soon as the game detects the mouse-up event *and is finished processing inputs for the current frame*.
All of the select-area related tools/functions in Factorio work by polling at the end of each frame "has the key been released" and when yes, it uses the current mouse location. What I think happens is you release the mouse button, then move the mouse somewhere else. The game gets all of those events in that order however since selection related events aren't triggered by specific key-up inputs - the mouse movement events happen between the key-up event and the selection logic running.
I'm not sure if it's viable to change this behavior since key-up events don't specifically trigger the select-area tools
Re: [Rseding91] [2.0.73] Selection area problem under medium/low UPS conditions with mouse movement.
Posted: Tue Feb 03, 2026 11:00 am
by reduke
Would it be feasible for a key-up event to temporarily store the location it was recorded at for use further down the line?
Re: [Rseding91] [2.0.73] Selection area problem under medium/low UPS conditions with mouse movement.
Posted: Tue Feb 03, 2026 1:03 pm
by sushi_eater
Factorio uses SDL and the library does provide mouse coordinates with mouse button events. So there is no technical reason, why it can't properly align mouse button events with mouse coordinates. Why would polling be used in the first place?
It's very possible that there is a substantial amount of technical debt and fixing things would require a lot of effort.
Re: [Rseding91] [2.0.73] Selection area problem under medium/low UPS conditions with mouse movement.
Posted: Tue Feb 03, 2026 3:34 pm
by Rseding91
reduke wrote: Tue Feb 03, 2026 11:00 am
Would it be feasible for a key-up event to temporarily store the location it was recorded at for use further down the line?
That's what I was testing yesterday and it seems to work. If no issues are found the fix will be in 2.1.
Re: [Rseding91] [2.0.73] Selection area problem under medium/low UPS conditions with mouse movement.
Posted: Tue Feb 03, 2026 3:36 pm
by Rseding91
sushi_eater wrote: Tue Feb 03, 2026 1:03 pm
... Why would polling be used in the first place?
The current input handling Factorio uses does not support binding controls to fire on "key up" so the way those are processed is to check after each set of input events are processed to check "is the control no longer active". Theoretically this could be reworked to do these checks after each event is processed but that's not the way it was written over the years.
Re: [Rseding91] [2.0.73] Selection area problem under medium/low UPS conditions with mouse movement.
Posted: Tue Feb 03, 2026 3:48 pm
by reduke
Rseding91 wrote: Tue Feb 03, 2026 3:34 pm
reduke wrote: Tue Feb 03, 2026 11:00 am
Would it be feasible for a key-up event to temporarily store the location it was recorded at for use further down the line?
That's what I was testing yesterday and it seems to work. If no issues are found the fix will be in 2.1.
That's great to hear, thanks!