Opened 10 years ago

Last modified 5 years ago

#2702 new enhancement

[PATCH] Improve GUI right-click action selection behavior

Reported by: wraitii Owned by:
Priority: Should Have Milestone: Backlog
Component: UI – In-game Keywords: patch design art ui
Cc: Patch:

Description

The GUI is responsible for choosing which action right-clicking will perform when a unit is selected (gather resources…). Currently, it only considers the closest unit for those behaviors.

This can lead to issues when then the cursor is over a point which intersects several entities' BoundingBox. For example, a spearman and a swordsman fighting will almost always overlap because the spear makes the BB very large (this is unrelated issue #1032), or a unit behind a CC. In the first case, the GUI might make you move to your spearman instead of attacking the swordsman, which makes no sense and is annoying. In the second, it might not offer you to return resources, but rather move to the horseman, which is bad too.

It would be better to consider all entities being intersected and pick the presumed best action.

An issue is that this can desync the "left-click" action and the "right-click" action. In the "horseman behind CC" scenario, left-clicking would select the horseman, but right-clicking deposits resources. I can see 3 ways of solving this: -Forcing them to be synched by having left-click target the same entity as right click. This might be bad however because it might make it difficult to select entities behind a CC (or, at least, you'd have to click twice) -Highlighting both entities (by showing the playercolor circle/square around). This works, but it's hard to see at a glance which is which -Highlight both differently. There are several options, such as a different color, a different pattern, of a different means of highlighting.

Another issue is that actions can change without the mouse moving, so we'd need to remember the mouse position in input.js

The attached patch changes the GUI to consider all entities, and highlights "right-click" action by making them glow slightly green. This is meant as a placeholder until we decide on what's best. It doesn't fix the "remember mouse position in input.js" issue.

It changes the behavior of SetShadingColour from multiplying to lerping but that's not really required.

Attachments (1)

GUIenhancement.patch (13.0 KB ) - added by wraitii 10 years ago.

Download all attachments as: .zip

Change History (4)

by wraitii, 10 years ago

Attachment: GUIenhancement.patch added

comment:1 by Itms, 10 years ago

Milestone: Alpha 17Alpha 18

comment:2 by leper, 9 years ago

Keywords: review removed
Milestone: Alpha 18Backlog

We switched from returning all possible entities to just returning the best some time ago (r16098), so the patch does not really apply anymore.

The highlighting might be nice to have, so I'm not closing the ticket yet.

comment:3 by Imarok, 5 years ago

Component: UI & SimulationIn-game UI

Move tickets to In-game UI as UI & Simulation got some sub components.

Note: See TracTickets for help on using tickets.