Page MenuHomeWildfire Games

Selecting non military units (traders, women, relicts, ...) hotkey
ClosedPublic

Authored by ffffffff on Nov 23 2017, 1:15 AM.

Details

Summary

Im not sure about this but i come very often now about this situation.

I got rushed and need to secure not military workers (women, traders, so on) in one direction away from the away enemy and military units into the direction of the enemy. sometimes the bell doenst work for women or they all go to one house where they not fit all in. so i need to select only not military workers to bring them to a save place and therefore having a selection hotkey would be wise.

so i added this diff.

please discuss

Test Plan

discuss

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

ffffffff created this revision.Nov 23 2017, 1:15 AM
ffffffff added a reviewer: elexis.
ffffffff removed a subscriber: elexis.
ffffffff updated this revision to Diff 4329.Nov 23 2017, 1:21 AM

I got rushed and need to secure not military workers (women, traders, so on) in one direction away from the away enemy and military units into the direction of the enemy. sometimes the bell doenst work for women or they all go to one house where they not fit all in. so i need to select only not military workers to bring them to a save place and therefore having a selection hotkey would be wise.

I have patches at D681 and D937 to help with the town bell, in particular women won't all try to garrison in the same house anymore but also fixing bugs where women become unresponsive.

Usually what I do is select all the units then click the woman icon to select only them. You can also double click to select all of them on the screen. So I'm not sure there's enough uses to justify this.

(By the way, I'm annoyed that the idle worker hotkey doesn't select all idle units. I have to use the military hotkey to get dogs and champions, but then that misses women. Instead I'd like one hotkey for all idle units.)

There might be problems using shift in the hotkey combination, since that usually adds units to the selection.

In D1056#41748, @temple wrote:

I got rushed and need to secure not military workers (women, traders, so on) in one direction away from the away enemy and military units into the direction of the enemy. sometimes the bell doenst work for women or they all go to one house where they not fit all in. so i need to select only not military workers to bring them to a save place and therefore having a selection hotkey would be wise.

I have patches at D681 and D937 to help with the town bell, in particular women won't all try to garrison in the same house anymore but also fixing bugs where women become unresponsive.

Nice

Usually what I do is select all the units then click the woman icon to select only them. You can also double click to select all of them on the screen. So I'm not sure there's enough uses to justify this.

What about traders and fishboats (sheeps/goats ;)) ah btw i think relict needs also to be selected in this group as its not military too. Actualy the workers term is misleading here. Non military is what i wanted to have to select them to make them secure.

(By the way, I'm annoyed that the idle worker hotkey doesn't select all idle units. I have to use the military hotkey to get dogs and champions, but then that misses women. Instead I'd like one hotkey for all idle units.)

There might be problems using shift in the hotkey combination, since that usually adds units to the selection.

This problem i didnt encounter. (Works good)

lol D937 market bell so i still need to go cc hit bell or find market and hit bell instead of fastly selecting non military units to backup. also when military units already fighting just bring non military units out of the fighting (like in wood rush) i still need selecting non military units. also i may not want to bring all workers into garison maybe only the ones in danger just out of the way.

Imarok added a subscriber: Imarok.EditedNov 23 2017, 11:37 AM
In D1056#41748, @temple wrote:

(By the way, I'm annoyed that the idle worker hotkey doesn't select all idle units. I have to use the military hotkey to get dogs and champions, but then that misses women. Instead I'd like one hotkey for all idle units.)

Alt + .?
(https://trac.wildfiregames.com/wiki/HotKeys)

lol D937 market bell so i still need to go cc hit bell or find market and hit bell instead of fastly selecting non military units to backup. also when military units already fighting just bring non military units out of the fighting (like in wood rush) i still need selecting non military units. also i may not want to bring all workers into garison maybe only the ones in danger just out of the way.

As I said, I usually select all then click the women icon, but your way would be faster.

In D1056#41776, @Imarok wrote:
In D1056#41748, @temple wrote:

(By the way, I'm annoyed that the idle worker hotkey doesn't select all idle units. I have to use the military hotkey to get dogs and champions, but then that misses women. Instead I'd like one hotkey for all idle units.)

Alt + .?
(https://trac.wildfiregames.com/wiki/HotKeys)

I was talking about the difference between idle worker (.) and idle warrior (/), how I'd like them to be combined to one idle unit hotkey. Actually, let me try making a patch to add a third hotkey for idle units.

ffffffff updated this revision to Diff 4535.Dec 4 2017, 6:30 PM
ffffffff retitled this revision from Selecting not military workers hotkey to Selecting non military units (trader, women, relict, ...) hotkey.

Update to non military units.

ffffffff updated this revision to Diff 4537.Dec 4 2017, 6:31 PM
temple requested changes to this revision.Dec 6 2017, 3:03 PM

I agree about the usefulness now.
I'd remove relics since they can't take damage so aren't vulnerable to raids. That just seems out of place to me.
This misses the worker elephant and healer, so they should be added. But instead of that I think it would be better to just use the Support class since that covers those cases too, and I'd use "support" rather than "non-military" in the descriptions and variable names. You'll still have to add fishing boats and merchants (Trader) separately since we can't add the Support class to those ships (since Support is used for some garrison classes).

This revision now requires changes to proceed.Dec 6 2017, 3:03 PM
In D1056#44570, @temple wrote:

I agree about the usefulness now.
I'd remove relics since they can't take damage so aren't vulnerable to raids. That just seems out of place to me.
This misses the worker elephant and healer, so they should be added. But instead of that I think it would be better to just use the Support class since that covers those cases too, and I'd use "support" rather than "non-military" in the descriptions and variable names. You'll still have to add fishing boats and merchants (Trader) separately since we can't add the Support class to those ships (since Support is used for some garrison classes).

relicts are vulnerable. and worth. and cant attack. and do not harm to be secured too. so keep non-military? (as they units that cant attack)

ffffffff updated this revision to Diff 4603.Dec 6 2017, 3:38 PM

adding support to non military class

temple added a comment.Dec 6 2017, 4:11 PM

relicts are vulnerable. and worth. and cant attack. and do not harm to be secured too. so keep non-military? (as they units that cant attack)

It's hard to capture a relic so I don't consider them too vulnerable, but I don't care very much so it's okay to leave them in.

I would still rewrite everything as support rather than non-military, I think it's a better description. (Positive is better than negative, plus women can attack.)

ok why is women support or fishboat or trader?

temple added a comment.Dec 6 2017, 4:56 PM

ok why is women support or fishboat or trader?

I don't understand the question?

ffffffff updated this revision to Diff 4607.Dec 6 2017, 5:21 PM
ffffffff retitled this revision from Selecting non military units (trader, women, relict, ...) hotkey to Selecting support units (non military) (trader, women, relict, ...) hotkey.
temple requested changes to this revision.Dec 6 2017, 6:16 PM

Looks good, except the choice of hotkey. Currently if we have some units selected and wanted to add more to them we'd hold shift, and if we only wanted to add military units then we'd also hold alt. But with this patch shift + alt selects support units instead. So either find a different hotkey or set it to be unused.

This revision now requires changes to proceed.Dec 6 2017, 6:16 PM
ffffffff updated this revision to Diff 4622.Dec 7 2017, 12:02 AM

hotkey to alt + s
silhouette toggle to ctrl + alt + s (if even needing hotkey)
upcoming summary hotkey may go to ctrl + shift + s

temple accepted this revision.Dec 7 2017, 12:38 AM

Not my favorite choice of hotkey but I guess there's not many alternatives.

This revision is now accepted and ready to land.Dec 7 2017, 12:38 AM

Why does SupportTypes include non-Support types?

In D1056#44740, @elexis wrote:

Why does SupportTypes include non-Support types?

temple feelin fine with term. nonmilitary better?

In D1056#44740, @elexis wrote:

Why does SupportTypes include non-Support types?

temple feelin fine with term. nonmilitary better?

Giving names exactly one meaning is an incredible benefit to the reader. If he reads g_SupportTypes in some other place of the code, he will inevitably think its the units that have the Support class and misinterpret the code unless reading so much that he finds out that all his assumptions were wrong.
(Same problem in the first iterations of D754 where PlayerColor sometimes meant DiplomacyColor and DiplomacyColor sometimes meant PlayerColor). (Ideally the reader should be able to find out everything that is relevant in one line by only reading that one line.)
(Thus allowing people with as few time, foreknowledge and attention as possible to apply changes in as few time as possible).

Mostly I wonder what the use case of this hotkey is to begin with?
If its to select workers, why not use g_WorkerTypes?

The use case is when you're in a military conflict, want to move all fighters to the frontline and evacuate everything that isnt a fighter?

So perhaps we could do a negated search for g_MilitaryTypes if we truly want the non-military units?

ffffffff updated this revision to Diff 4624.Dec 7 2017, 1:49 PM

Alt+Y non-military units selection hotkey
refactor and code to invert military units type in filter

as i have seen now alt+s collidates with many more hotkeys we have i will mention now i put hotkey to Alt+Y cause its easy to grab and many Alt+ and Ctrl+ and Alt+Ctrl+ key combinations (combined with s are already mapped) maybe also possible something like Alt+N (for non military) but its bit harder to grab possibly. Further like to have hotkey combined with something with alt as its already use for selection modifying and maybe later we want to have selection a building from build menu by pressing single letter when a build unit is selected.

the upcoming two hotkey are the biggest problem for hotkey Alt+S, cause we cannot deselect non military units from selection with ctrl modifier key, when having these two:
scroll.speed.increase = "Ctrl+Shift+S" ; Increase scroll speed
scroll.speed.decrease = "Ctrl+Alt+S" ; Decrease scroll speed

So Alt+Y is now my choice :)

ffffffff added inline comments.Dec 7 2017, 1:56 PM
binaries/data/mods/public/gui/session/input.js
380 ↗(On Diff #4624)

i needed unit state here or else it also selects buildings lol :D

elexis added a comment.Dec 7 2017, 1:56 PM

That patch would be ok for me. Perhaps one can simplify something using MatchClasses, though I wouldn't be surprised if that won't work out.
(And remember, it |doesn't really matter which virtual keys you assign by default.)

binaries/data/config/default.cfg
241 ↗(On Diff #4624)

perhaps we can rename to military, nonmilitary and idle sometime, since nonmilonly sounds a bit weird (two negative qualifications. I assume this is why temple wanted a different name too).
(only is self-evident with selection filters)

ffffffff updated this revision to Diff 4625.Dec 7 2017, 2:16 PM

hotkey rename to military, nonmilitary, idle. seems to work fine

temple added a comment.Dec 7 2017, 3:35 PM
In D1056#44757, @elexis wrote:
In D1056#44740, @elexis wrote:

Why does SupportTypes include non-Support types?

temple feelin fine with term. nonmilitary better?

Giving names exactly one meaning is an incredible benefit to the reader. If he reads g_SupportTypes in some other place of the code, he will inevitably think its the units that have the Support class and misinterpret the code unless reading so much that he finds out that all his assumptions were wrong.

Well, in spirit it's true and technically it's almost true. But it's not important enough to argue about so I won't.

So perhaps we could do a negated search for g_MilitaryTypes if we truly want the non-military units?

Sure, but it'd select non-units as fpre found out, and it would also select sheep which we probably don't want to include either.

lol troll sheep

ok as it is as countrary part to military selection hotkey thought, lets name it it nonmilitary and keep sheeps with it as they are nonmilitary too. no fault. :)

ffffffff updated this revision to Diff 4647.Dec 8 2017, 2:14 PM

switch

g_MilitaryTypes.every(c => !hasClass(entState, c))

to

!g_MilitaryTypes.some(c => hasClass(entState, c));

as performance might trickly better

i tested more. also possible Shift + Alt as it inverse military modifier alt for selecting. maybe best solution? seems not interfering

temple added a comment.Dec 9 2017, 5:28 AM

Set unused, problem solved.

shift+alt not good then i cannot add more non military units to selecting lol :(

ok lets take alt+y as along as this hotkey is not used for now and to have a hotkey for this feature.

Then we can close this.

Tx

switch

g_MilitaryTypes.every(c => !hasClass(entState, c))

to

!g_MilitaryTypes.some(c => hasClass(entState, c));

as performance might trickly better

Why would there be a performance difference? (It's a rhetoric question, rtfm)
Why not Prenex normal form, i.e. no logical operators before the quantors where possible?

In D1056#44802, @temple wrote:

Sure, but it'd select non-units as fpre found out, and it would also select sheep which we probably don't want to include either.

By the hotkey definition it should only select units, so indeed the explicit unit check is still mandatory.
So if domestic animals break our definition then we should change the definition too. If we don't care about the definition, then we can hardcode a Domestic check here as well.
(Unfortunately human isn't the opposite of domestic animals, since we have non-domestic animals like dogs or war elephants (though the latter is arguable a human too, otherwise cavalry would count as an animal as well))

In D1056#44802, @temple wrote:

(Support is also a VisibleClass, so it's seen in the tooltips, hence it's not only the coder but also the player who might notice the difference and might want to address that observation. There might be some tech saying you need N support units)

Just for the usability I would certainly agree to exclude domesticated animals.
For the clarity of the definition, perhaps someone finds a non-awkward description.
(In fact dogs are Human too, but I don't think we should expose that awkwardness any further.)
(Also perhaps we want a "select domesticated animals" hotkey? Then the definition might be less awkward since the awkwardness is present in two definitions :P )

makes no difference as

g_MilitaryTypes.every(c => !hasClass(entState, c))

inverts hasClass before and the other just inverts some after.
and some and every command both stops immediately search when some condition positively resp. negatively found .

temple added a comment.Dec 9 2017, 2:56 PM
In D1056#45234, @elexis wrote:

(Unfortunately human isn't the opposite of domestic animals, since we have non-domestic animals like dogs or war elephants (though the latter is arguable a human too, otherwise cavalry would count as an animal as well))
(In fact dogs are Human too, but I don't think we should expose that awkwardness any further.)

Dogs and war elephants are Human and not Animal, as far as 0AD classes go.

ffffffff retitled this revision from Selecting support units (non military) (trader, women, relict, ...) hotkey to Selecting non military units (traders, women, relicts, ...) hotkey.Dec 23 2017, 2:10 AM
This revision was automatically updated to reflect the committed changes.
Owners added a subscriber: Restricted Owners Package.Dec 30 2017, 7:20 PM