Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#3334 closed defect (fixed)

[PATCH] Big houses have too small territory radius

Reported by: elexis Owned by: elexis
Priority: Must Have Milestone: Alpha 19
Component: UI & Simulation Keywords: patch
Cc: Patch:

Description (last modified by elexis)

On a17 and a18 you could progressively expand your territorry with houses. While this still works with small houses (especially for the celtic ones), it doesn't work anymore with big houses (as of r16847), since the territorry ends somewhere inside of the house or just after the footprint. This can be a big disadvantage in comparison to celtic players. For example on maps where you can only extend with houses but not barracks, like snowflake searocks or some unknown land / unknown nomad maps (where all the wood is in the middle and CCs are surrounded by mountains).

big house in a18:

http://113.imagebam.com/download/Zygpy2Ev_Qr_Es42aXjRZA/42166/421654562/screenshot_a18_athen_house.png

big house on svn

http://113.imagebam.com/download/42XejvHlp1xu6OgzRm3V3A/42166/421654633/screenshot_svn_athen_house.png center

I'm not sure which revision has changed the territorry computation, maybe it was r16676?

An easy fix / workaround might be to slightly increase the radius for big houses.

Attachments (6)

3334.diff (5.6 KB ) - added by Stan 9 years ago.
Just Template Tweaking. I created a big house template, to make it easier in the future.
screenshot0289.png (868.3 KB ) - added by Stan 9 years ago.
Radius of 24
screenshot0290.png (869.7 KB ) - added by Stan 9 years ago.
Range of 23 as you can see it's messed up for some reason, which probably explains why little houses have less issues. So this is not likely to be a radius bug, but more a computational one.
t3334_floatingpoint_territorry_radius_v1.patch (1.0 KB ) - added by elexis 9 years ago.
Fixes the actual cause of the problem.
t3334_floatingpoint_territorry_radius_v2.patch (1.2 KB ) - added by elexis 9 years ago.
We can't use float/double in the simulation as the values might slightly differ on different platforms and thus cause out-of-sync. Thus we continue to use u32.
t3334_precise_territory_radius_v3.patch (4.0 KB ) - added by elexis 9 years ago.
Uses u16 for radius as that value should be smaller than 1000. Thus we can safely multiply it 28 without causing overflows.

Download all attachments as: .zip

Change History (15)

comment:1 by elexis, 9 years ago

Also I noticed that the territory of the houses seems to be misaligned.

Some more pictures showing the territory of unconnected houses: http://114.imagebam.com/download/1tx6K_9UUTSAppzd9m1lfg/42166/421654801/screenshot_svn_british_house.png http://113.imagebam.com/download/GJkPWuxXIzGb7PJlxH0Azg/42166/421655054/screenshot_svn_persian_house.png http://114.imagebam.com/download/JwTsZQ3qQYz26MVeaF70WQ/42166/421654911/screenshot_svn_carth_house.png http://113.imagebam.com/download/4iW9MDjb4bQy58HVKKijYw/42166/421655381/screenshot_svn_seleucid_house.png

Last edited 9 years ago by elexis (previous) (diff)

comment:2 by elexis, 9 years ago

Description: modified (diff)

comment:3 by Stan, 9 years ago

Keywords: review patch added
Owner: set to Stan
Summary: Big houses have too small territory radius[PATCH] Big houses have too small territory radius

by Stan, 9 years ago

Attachment: 3334.diff added

Just Template Tweaking. I created a big house template, to make it easier in the future.

by Stan, 9 years ago

Attachment: screenshot0289.png added

Radius of 24

by Stan, 9 years ago

Attachment: screenshot0290.png added

Range of 23 as you can see it's messed up for some reason, which probably explains why little houses have less issues. So this is not likely to be a radius bug, but more a computational one.

comment:4 by elexis, 9 years ago

Keywords: review removed

Here the images uploaded by Stan:

House with radius 23

http://trac.wildfiregames.com/raw-attachment/ticket/3334/screenshot0290.png

House with radius 24

http://trac.wildfiregames.com/raw-attachment/ticket/3334/screenshot0289.png

We must find a solution that gives less territorry than the 24 solution (although that would still be better than what we currently have).

by elexis, 9 years ago

Fixes the actual cause of the problem.

comment:5 by elexis, 9 years ago

Keywords: review added
Milestone: BacklogAlpha 19
Priority: Should HaveMust Have

Stan found out that it was caused by the change in r16751 line 425 of the CCmpTerritoryManager.cpp.

In a18, that radius value was 5, currently it is 2 in svn. By changing the radius in templates you can make it either 2 (way too small) or 3 (way too big), by typing something below 24 or bigger than 24 respectively.

If give that value a floatingpoint type, that value will become 2.5 (notice its exactly half of the previous value) and the territorry influence will be the way it was before!

by elexis, 9 years ago

We can't use float/double in the simulation as the values might slightly differ on different platforms and thus cause out-of-sync. Thus we continue to use u32.

by elexis, 9 years ago

Uses u16 for radius as that value should be smaller than 1000. Thus we can safely multiply it 28 without causing overflows.

comment:6 by Stan, 9 years ago

Owner: changed from Stan to elexis

comment:7 by sanderd17, 9 years ago

Nice find, I'll review the patch with care tomorrow.

comment:8 by sanderd17, 9 years ago

Resolution: fixed
Status: newclosed

In 17122:

Introduce less rounding errors in the falloff to allow a more precise territory calculation. Fixes #3334. Based on code by elexis.

comment:9 by sanderd17, 9 years ago

Keywords: review removed

I went for an easier solution. This also gives the falloff a better precision, while less conversions are needed. Thanks for finding the cause of the issue.

Note: See TracTickets for help on using tickets.