OpenRA icon indicating copy to clipboard operation
OpenRA copied to clipboard

Add mouse control style to match other, non-C&C, RTS games

Open dvr333 opened this issue 2 months ago • 25 comments

As title. Addresses #16669, but without breaking expectations from 3rd-gen C&C players.

dvr333 avatar Oct 28 '25 07:10 dvr333

I'm not sure why the ftl files have every line changed, I'm guessing a line ending difference between how my editor is set up and what was there before, but I have no idea why they would be overridden

dvr333 avatar Oct 28 '25 07:10 dvr333

I'm not sure why the ftl files have every line changed, I'm guessing a line ending difference between how my editor is set up and what was there before, but I have no idea why they would be overridden

Your editor is not respecting newline format. You are doing CRLF, changing it from LF. Literally adding a CR character to every line break

PunkPun avatar Oct 28 '25 07:10 PunkPun

Fixed the line endings, wish I knew how to reliably squash commits without having to force push

dvr333 avatar Oct 28 '25 08:10 dvr333

Fixed the line endings, wish I knew how to reliably squash commits without having to force push

Force push is the thing you do with the rebase workflow

PunkPun avatar Oct 31 '25 11:10 PunkPun

This seems to just create more inconsistencies. All unit orders remain on RMB, but just attack move is special to be moved to LMB?

PunkPun avatar Oct 31 '25 11:10 PunkPun

This seems to just create more inconsistencies. All unit orders remain on RMB, but just attack move is special to be moved to LMB?

A more general solution would be to have a TargetedUnitOrderGenerator that can be on left-click regardless of which button sends orders to units, and have the AttackMoveOrderGenerator inherit from that. Currently Attack Move is the only order that is targeted, as mods don't really have targeted unit abilities, but the convention in RTS games as a genre is to treat attack move as a targeted unit ability.

dvr333 avatar Oct 31 '25 16:10 dvr333

What about Guard and other "abilities"?

PunkPun avatar Oct 31 '25 17:10 PunkPun

Good point, Guard is also a targeted order, and I rarely use it exactly because it being on right click is awkward for me. I'll set up the generalized TargetedUnitOrderGenerator when I get the chance, likely tomorrow (busy with work and Hallowe'en stuff today)

dvr333 avatar Oct 31 '25 17:10 dvr333

Both left and right mouse buttons now activate attack move with no method of cancelling. Also please run out tests suite before pushing out a PR

https://github.com/OpenRA/OpenRA/wiki/Contributing

make check for code style, and make test for unit tests

PunkPun avatar Nov 04 '25 13:11 PunkPun

Right, sorry, I'm doing the tests now.

Can reproduce the cancel bug, fixed in next commit

dvr333 avatar Nov 04 '25 15:11 dvr333

Does it seem correct that basically all the commands in the command bar still get cancelled by left click orders?

Ah, yeah, fixed that, and the chronotank teleport. Did a sweep for everything that inherits from OrderGenerator and UnitOrderGenerator to make sure I didn't miss any others

Not sure if the setting should be a check box or part of the dropdown. I feel like the dropdown would make more sense, but I'm not sure if I'm the only one

dvr333 avatar Nov 10 '25 20:11 dvr333

After some thought I've realized that the way I'm doing it, where order generators being "targeted orders" is opt-in rather than opt-out (or just no options besides the user-side ones), is over-engineered and already causing massive headaches, let alone when other mods with their own orders/traits with orders update and have to track down every order type that involves a 2-step order selection and targeting process. I'm re-designing it from bleed to go the other way, where there'll be a mode where Action is on left button, but the default UnitOrderGenerator.Order(function) and it's attendant support functions uses the right button, since that just works as expected without having to fiddle with every UnitOrderGenerator derived class

dvr333 avatar Nov 11 '25 05:11 dvr333

For guard both mous buttons activate it

Maybe minimap should also use left click?

Fixed the Guard bug too,

I thought minimap was handling things properly (maybe it was before the redesign), will take a look at that tomorrow

dvr333 avatar Nov 17 '25 02:11 dvr333

Minimap behaviour fixed, including some spurious selection cursors in Modern mode that was pre-existing (it was consistent with how RA3 works with right-click orders, but a bug in both cases)

dvr333 avatar Nov 17 '25 17:11 dvr333

I can cancel attack and guard by double clicking left mouse button. Hold down shift

Minimap still seems broken. You move on it with left mouse button, but left also activates support powers and orders units

I also notice a sound bug with shift+left-click, I'll look into that too.

The minimap behaviour is working as intended, or at least, working as intended given that I meant for the term "Generals" to be a shorthand for "not like C&C games" without actually saying it. Technically C&C Generals always has the left mouse button move the minimap, but you can only issue right-click orders through the minimap, and have to switch to right-click to target support powers. This is inconsistent between the map and minimap, and a downgrade for targeted orders, unlike the other two input modes. However, that's just Generals, every other RTS game I can find with a minimap will prioritize targeted orders over minimap movement if there is an order ready to be targeted, though some (like StarCraft 2) will switch right-click to moving the minimap in that case (which is easier to code than what is currently in the PR and an approach I took initially because of that)

dvr333 avatar Nov 23 '25 17:11 dvr333

I personally find ctrl+RMB makes perfect sense as the way to have that work in this context, since it's still a one-click command, just with a key held (as opposed to using the command bar). If you're talking about having a separate key for the two-step approach (like how "Attack Ground" keys work in other RTS games) then that would be left click as that would be a key press (not hold) to change mode. Since Shift is meant to queue whatever orders are given it shouldn't change the click behaviour from an unqueued order at all.

I'll look into the cursor issue, getting that to work properly has been a bit tricky

dvr333 avatar Dec 03 '25 11:12 dvr333

Maybe for description to take up less space, we could remove the light with support powers?

PunkPun avatar Dec 03 '25 11:12 PunkPun

Makes sense, it's always left click. I assume you're proposing that for every mouse control type, not just Generals?

What about merging "Select Units...", "Place Buildings..." and "Support Powers..." into a two-line thing, since they are always left click?

dvr333 avatar Dec 03 '25 11:12 dvr333

Could merge "Place Buildings..." and "Support Powers...". However selection is very different from both

PunkPun avatar Dec 03 '25 11:12 PunkPun

Is it? Every mode uses "Select units using the <Left> mouse button" line as a separate line, even Classic. Merging just "Place Buildings..." and "Support Powers..." doesn't save any lines

dvr333 avatar Dec 03 '25 11:12 dvr333

The UI now looks great.

I see there's no way to cancel waypoint mode, except for adding another order like enabling attack move. Also, the waypoint mode get's confirmed by right click?

Waypoint mode is really weird, especially since everything it does is done better by just holding shift (that is, it doesn't produce waypoints for actions independent of units selected as it does in classic C&C games). Ideally it would be able to handle any order but that doesn't even work in the other modes, so right now it just handles contextual actions (matching the functionality of the other modes), cancelled by clicking on it again (which AFAICT is the old C&C UI flow), though also by choosing another order

dvr333 avatar Dec 04 '25 18:12 dvr333

On modern you can't activate support powers on minimap

That's always been true. Did you want me to change that in this PR? If so, did you want it on right click (consistent with other minimap orders) or left click (consistent with support powers targeted on the main map, and AFAICT way easier to code, in a way that will remove the HACK in ForceModifiersOrderGenerator along with a bunch of other bodges and hacks, but does require either reflection shenanigans or making a property that should be get-only settable to otherwise work the way PR currently does. https://github.com/dvr333/OpenRA/tree/left-click-attack-move-expectedbutton if you want to check that out)?

it is weird. But as of this PR, it doesn't work like contextual and still uses right click orders. Cancelling should be done with right click no?

Fair, it is a two-step order when you click on it, so I see the logic of it using left click

dvr333 avatar Dec 05 '25 19:12 dvr333

Merged the experimental branch. It fixes all the problems listed, both the hacks and the support powers issue on Modern, and also reduces the amount of hardcoding, which seems to be a recent goal overall. I'll leave the commits unsquashed for now to allow review of the different approaches

dvr333 avatar Dec 08 '25 19:12 dvr333

Would it be possible to structure the PR with an initial commit that generalises the plumbing, and then a second commit to add the new mode and UI?

pchote avatar Dec 08 '25 21:12 pchote

Would it be possible to structure the PR with an initial commit that generalises the plumbing, and then a second commit to add the new mode and UI?

Done

dvr333 avatar Dec 08 '25 22:12 dvr333