← Back to team overview

widelands-dev team mailing list archive

Re: [Merge] lp:~widelands-dev/widelands/bug-1810062-territorial-calculations into lp:widelands

 

This revision should also fix Galcier Lake and other maps.

Here is the idea: Fields that can have a small, medium, or big building on it will automatically be added. Big includes ports. Also fields that currently have immovables on it, like stones & trees are added as well, since they might cover fields that have one of the aforementioned building spaces.

For all other walkable fields, this includes fields with flags and mines, we evaluate whether they can be reached by certain types of buildings. If reachable within 6 fields by small, medium & big it is added since it can be reached at least by the smallest military building.

If within 8 field a medium and big building is buildable then it will be added as well. Also if within 12 fields a big building is buildable.

The calculation is done in x y, x -y, -x y & -x -y direction. On minor issue is that if we reach 0 on the xy-axes or the xy maximum the evaluation stops. Instead of starting by at the coordinate 1 or counting backwards from xy-max.

Here are the 100% that are calculated for different implementations on the Galcier Lake map, with the implementation in the merge request the size is reduced by ~30%.

6713: current implementation 
4718: when counting up 12 fields from the field in question
4715: when counting up 8 fields from the field in question
4702: when counting up 6 fields from the field in question

For Oasis Triangle the size it reduced by 75%:
36064: current implementation 
12646: when counting up 12 fields from the field in question
12612: when counting up 8 fields from the field in question
12490: when counting up 6 fields from the field in question

With the current merge request, up to 12 fields are checked. The other cases can be tested by commenting the elseifs out. As I said the before: there might be some shortcomings, but they are be negligible in my opinion.

Glacier Lake & Oasis Triangle seems playable when looking at the numbers. I also run a quick simulation with AIs and it seems to be fine. So please test as thoroughly as possible.

We could also only check for 6 fields to be on the safe side. But by looking at the numbers it is just a small difference between the 12 and 6 fields calculation (1.3% on Oasis Triangle & 0.3% on Glacier Lake) so it should be find to test for the whole 12 fields.



-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1810062-territorial-calculations/+merge/361366
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1810062-territorial-calculations into lp:widelands.


References