[Rseding91] [2.0.73] Selection area problem under medium/low UPS conditions with mouse movement.

reduke
Long Handed Inserter
Long Handed Inserter
Posts: 70
Joined: Tue May 22, 2018 5:37 pm
Contact:

[Rseding91] [2.0.73] Selection area problem under medium/low UPS conditions with mouse movement.

Post 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...
Rseding91
Factorio Staff
Factorio Staff
Posts: 16541
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [2.0.73] Selection area problem under medium/low UPS conditions with mouse movement.

Post 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
If you want to get ahold of me I'm almost always on Discord.
reduke
Long Handed Inserter
Long Handed Inserter
Posts: 70
Joined: Tue May 22, 2018 5:37 pm
Contact:

Re: [Rseding91] [2.0.73] Selection area problem under medium/low UPS conditions with mouse movement.

Post 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?
sushi_eater
Inserter
Inserter
Posts: 47
Joined: Thu Feb 13, 2020 2:22 pm
Contact:

Re: [Rseding91] [2.0.73] Selection area problem under medium/low UPS conditions with mouse movement.

Post 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.
Rseding91
Factorio Staff
Factorio Staff
Posts: 16541
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [Rseding91] [2.0.73] Selection area problem under medium/low UPS conditions with mouse movement.

Post 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.
If you want to get ahold of me I'm almost always on Discord.
Rseding91
Factorio Staff
Factorio Staff
Posts: 16541
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [Rseding91] [2.0.73] Selection area problem under medium/low UPS conditions with mouse movement.

Post 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.
If you want to get ahold of me I'm almost always on Discord.
reduke
Long Handed Inserter
Long Handed Inserter
Posts: 70
Joined: Tue May 22, 2018 5:37 pm
Contact:

Re: [Rseding91] [2.0.73] Selection area problem under medium/low UPS conditions with mouse movement.

Post 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!
Post Reply

Return to “Fixed for 2.1”