FreeCol / freecol

FreeCol: FreeCol is a turn-based strategy game based on the old game Colonization, and similar to Civilization. The objective of the game is to create an independent nation.
GNU General Public License v2.0
585 stars 170 forks source link

Order of focus changes #83

Open paulvi opened 3 years ago

paulvi commented 3 years ago

Freecol is turn based game. And in every turn one should move units (that are not town population).

However when number of units grows, I find that the order of focus changes (please give me better word) is not logical and seems random.

Let me give you an example: suppose there are 2 colonies or clusters in different part of the (new) world with ships, wagons and units. Now when I have moved some unit, and would want to move other unit visible on the screen, instead the focus jumps to other location 2, where similar there may be 2-3-4-5 and more units that needs some of coordinated movement. But instead after (spending some time to reassess and) moving one unit, the focus jumps back to location 1 or worse to location 2 etc...

I would like that the game would bring first focus to next unit visible on the screen (preferably first from those close to each other in the screen center). That would give workflow for each turn, when starting from say north part of east cost, then moving slowly along the cost to south, then some remoter locations. (The observation, that in all games the most and largest colonies happen on east cost)

The problem and the solution proposed are for game in later stage. The problem significant in a way, that I find uninteresting to open previous games as with larger number of units it become more boring experience with every turn. For me it is usually 20+ colonies, 100 units in say 1560 with military still far from enough for independence war and trade with Europe being still profitable.

Please point to the related source file.

mpope042 commented 3 years ago

However when number of units grows, I find that the order of focus changes (please give me better word) is not logical and seems random.

This is an area where FreeCol certainly could be improved. IIRC the current algorithm ultimately defaults to traversing the map from left to right + top to bottom, so some jumping is almost guaranteed. However beware, this is an area where whatever you do, someone will not like it.

Please point to the related source file.

Good luck with that! Focus control is well distributed. What you need to know about is the "currently active unit" logic. The low level part of that is in .../freecol/client/gui/..., the trigger to switch is probably mostly in .../freecol/client/control/InGameController.java, and the general ordering mechanism is in .../freecol/common/model/Unit.java.

paulvi commented 3 years ago

So improving "currently active unit" logic is actually current words for what this issue describes.

mpope042 commented 3 years ago

More or less. Many things freecol user actions implicitly use the currently active unit, and when the action completes we have to decide whether to select a new active unit or not. So there are a lot of cases.