Try to pick subset of scenario start positions that are uniformly distributed
Rhue's comments in feature #688280 and the associated forum thread make me wonder if we can improve start position selection: specifically, in the case where a scenario has a non-uniform set of start positions (such as Earth maps) and is started with many fewer players, can we try to pick a subset of start positions that are more uniformly distributed (rather than concentrating players in e.g. Europe); the idea being that scenario authors don't have to take as much care to produce a balanced set of start positions.
This wouldn't apply to any games where start positions are generated at runtime (in map_fractal_generate()), as this process generates exactly as many start positions as are required, using arguably more relevant criteria (players per island, etc). (Plus, start position generation is fragile enough as it is.)First we'd need an algorithm to pick a good subset of start positions. This thread might be a good place to start, although we'd benefit from an algorithm where some of the points can optionally be pre-placed. I would expect to maximise simple map distance, rather than any more complicated metric.
- This has implications on fairness, but if you are letting some players pick nations which imply start positions, then you have probably lost fairness already (or at least put it in the hands of the scenario designer). It's probably most useful for single-player games, where the human gets to pick their start position and a suitable set of AIs is solipsistically generated. It does mean we might have to explicitly disable any of this machinery when startpos_count()==player_count(), to avoid nation-selection exploits in common cases.
- generate_players(), which picks nations to match existing start positions (but doesn't actually assign start positions currently). In the common case where a start position is for a single nation, this determines the eventual distribution.
- init_new_game(), which later actually assigns start positions to players. This starts by matching start positions to assigned nations. (Perhaps ordering targeted_list would be good enough?)
I'm not sure if this would need to be controlled by a server setting; the ability for players to select nations might give sufficient control over it.
#1 Updated by Marko Lindqvist 9 months ago
Does current code actually prefer using nations from the same continent even in case of scenarios, because they belong to the same nation group? When solving this, there's likely to be some clash between the code that prioritizes nations of the same group and the code that tries to distribute starting positions uniformly.