Ticket #918 (closed defect: fixed)

Opened 22 months ago

Last modified 16 months ago

Fix rendering of territories with holes

Reported by: Philip Owned by: vts
Priority: Should Have Milestone: Alpha 9
Component: Core engine Keywords:
Cc:

Description

Consider territory assignments like:

00000000
01111110
01012130
01111110
00000000

where 0 is neutral. CCmpTerritoryManager::ComputeBoundaries will find the outer edge of the 1s, but not the inner edge around the 0 hole or the 2 hole. (The 3 isn't a hole since the outer edge already surrounds it.)

Might need to add a 'already processed' flag to tiles instead of setting them to 0, and then add a 'already has territory boundary at the +j edge of this tile' flag which is set when walking the boundary, then if we find a tile with different owner to its -j neighbour and that neighbour isn't neutral and doesn't have the edge flag then start a new walk around that edge to produce the inner boundary (with inverted direction). Or something like that.

Change History

comment:1 Changed 21 months ago by k776

  • Milestone changed from Alpha 7 to Alpha 8

comment:2 Changed 17 months ago by k776

  • Milestone changed from Alpha 8 to Alpha 9

comment:3 Changed 17 months ago by vts

  • Owner set to vts
  • Status changed from new to assigned

comment:4 Changed 17 months ago by vts

Progress report: I've implemented a custom version of the algorithm to deal with inner/nested boundaries (very similar to the one described above), and it's currently passing the test case mentioned above as well as some other ones I came up with.

The boundaries for tiles that have multiple borders on their edges (e.g. the enclosed '2'-tile and semi-inclosed '3'-tile in the example above) are still being rendered directly on top of each other though; that's something I'll be working on next.

comment:5 Changed 16 months ago by vts

The overlapping rendering issue is now fixed by simply inverting the winding order for inner edges. Will commit soon.

comment:6 Changed 16 months ago by vts

  • Status changed from assigned to closed
  • Resolution set to fixed

(In [10929]) Implemented nested territory boundaries. Fixes #918. Fixed out of bounds memory access in Atlas due to always using global terrain in TerrainOverlay? Fixed wrong player ID calculation in TerritoryOverlay?

Note: See TracTickets for help on using tickets.