For human player, units are "activated" in a random order. Next unit should be the nearest on the same continent
answer to myself , it would be good enough to have :
select active_human_units order by continent, x, y; or simply (for including sea or air units) , ordered by x,y
Reply To alain_bkr
but i need some clue for starting point
Quick grep & source reading shows find_best_focus_candidate() as a potential starting point. ( http://files.freeciv.org/doxygen/master/html/control_8c.html#aede9b43c8abba0d490d1539c97658e01 )
Thanks for the function and the link.
1/ it seems to be done like what i asked for, in two rounds : a first one for idle units, then for waiting units.
2/ I still believe there are cases where focus jumps to another place, and come back later to the first tile.
I am searching around units on boats (who auto-sentry on loading) , workers just finishing some activity, unit waiting (a noticed a difference when pressing key-w : we don't have a question-mark near the unit as what happens in gtk clicking on wait in action-popup (attack , wait ...) )
Reply To alain_bkr
(a noticed a difference when pressing key-w : we don't have a question-mark near the unit as what happens in gtk clicking on wait in action-popup (attack , wait ...) )
Intentional. A unit that has stopped next to an eneemy city to wait for you to select the action can be killed by enemy units in that city. This is also why units with an action selection dialog has a higher priority in the focus queue.
I have observed (100 % sure) a case, where i unload an ingeneer, then the focus goes far away, and in the end come back to unload a marine troop.
I believe that focus should be geographically ordered, and nothing else. Maybe show the soldiers first, but before moving elsewhere we should move other units from the same tile (o decide to make them wait until the end of the turn)
Ingeneers, explorers, diplomats and boats are part of the attack , the soldiers are only the tip of the iceberg.
Also i noticed that something autocenter on the last moving unit (like boat Going somewhere) , and the focus stay there, but the first active unit is not this one. So i need to press C to center the map on the active unit. This happens during the very weird time interval when the player thinks he can do some things, but it is not the case, because AI have not yet finished their turn. This add to confusion
What is the order *within* the preference queue? I don't think it would be that bad if there was a one big jump per turn when switching from preference queue to other units, but it might be that focus jumps all over the place while going through the preference queue.
Reply To alain_bkr
When it is my turn (as a human with gtk3.22 client) , active units show up in seemingly random order. On big maps with many units this is very confusing and frustrating, and the map moving all around with autocenter nearly makes me sick :)
For this and other reasons I have autocenter on focused units off. My main reason is that after sending a discoverer to un-fog some landscape, I want to think and act on the stuff if has un-fogged immediately, rather than leaping to the other side of the world. Then, if there is something to act upon, I'll do it by awakening some units, or building a new something. If there is nothing to react to, I press 'c' to center on the focused unit.
With the frustration of autocenter off, you'll see that the seemingly random order is not so random - like a transport and it's escort will always be called together (though sadly, the escort first rather than the transport, but that is easy to rectify with a quick mouse maneuver).
An other observation about focus movements :
When a settler build a city the city-control-box opens, but meanwhile the focus moves away to the next military unit, even if we have other non military units near the brand new city (workers ...)
Reply To alain_bkr
When a settler build a city the city-control-box opens, but meanwhile the focus moves away to the next military unit, even if we have other non military units near the brand new city (workers ...)
Ja, but if you have autocenter-on-focused-units off, when you close the city dialog, you are still viewing the map around the city and can choose to select workers ...
1/ i did unselect autofocus on units , this solves the problem with cities.
2/ Units are still selected on a very weird order
3/ i have other examples, a heavy soldier, then go away, then come back to an alpine troop just near the first one.
I believe there is something broken.
Even worst : I have a pile of tank + spy for an attack . They are not sentry, i wanted to see them each turn until i have enough units on the tile.
I send the spy, then 2 tanks , then the focus goes away, even if there are other ready tanks on the tile.
Reply To cazfi
What is the order *within* the preference queue? I don't think it would be that bad if there was a one big jump per turn when switching from preference queue to other units, but it might be that focus jumps all over the place while going through the preference queue.
Nobody answered this, but the problems reported sound like they could be that within the preference queue the geographical distance does not matter.
I must say, in my current test-game, the order of the units becoming focused, is really bad. I've never really noticed a problem before. I wonder if I'm only noticing now, or whether things have gotten worse lately.
Oh! I didn't answer your question, 'cos I don't know.
it may be linked to #42288 (gtk3.22 : press 'c' to center focus is sometimes wrong)
in both cases, tiles are hexagonal
(close duplicate #47565) 3.0.6 with gtk3.22 client
i reformulate :
The expected logic is geographical :
Additionally, when a turns begins one unit is already selected.
If the user choose another unit (due to map move and select a unit, or read messages, double click -> unit selected or whatever) , the focus should stay there instead of keeping the initial program's choice (i don't know if it is client or server or both) .
When it is my turn (as a human with gtk3.22 client) , active units show up in seemingly random order. On big maps with many units this is very confusing and frustrating, and the map moving all around with autocenter nearly makes me sick :)
We have time as it is during human turn, so we could check for the nearest unit on the same continent, then pick next continent ? (it may cost several milliseconds !)
I don't know if it is on client or server side. I can try to fix this , but i need some clue for starting point