SECTORS
- rectangular area of the map
- contains _all_ cells in that area.
- the cells in the sector are continuous
- are disjoint. a cell in sector A is _never_ in sector B (with A != B)
- the sizes of the sectors can be different, e.g. sector A can be 10x10 cells, whereas sector B can have 20x40 cells. Unfortunately it won't be possible to restrict the sizes to 2^n x 2^m
- all cells must be in exactly one sector.
required operations:
- fogged status of the sector (in percent)
-
- -> e.g. AI could use this for exploration of the map
-
- -> pathfinding might be able to use this to speed things up (would require O(1) then)
-
- -> maybe O(n) with n being number of cells sufficient?
-
- -> O(1) should be very easy, since every Cell is in exactly one sector.
- list of items in the sector
-
- -> required for collision detection
-
- -> should be O(1) if possible. O(n) might be sufficient, but we should use a dirty bit then. but most probably setting a dirty bit is nearly as slow as actually adding an item
- check whether there are any units (not items!) in the sector
-> We could use this for collision detection. If there is no unit in the sector, we don't even need to look closer at it.
-
- -> Should be O(1).
-
- -> optional feature.
- unit lists separated by their owner()
-
- -> _very_ handy for collision detection.
-
- -> O(1) would be extremely useful and could speed a lot of things up greatly.
-
- -> Since we are talking about sectors we don't need to keep memory usage in mind, sou we can easily maintain an array of lists, making all this very fast.
REGIONS
- part of sectors
- contain _only_ cells of the sector they are in
- cells in a region are continuous
- cells in a region are usually not describable by an "easy" mathematical function. in particular they are usually not rectangular
- a unit can go from every cell in a region to every other cell in the region. i.e. there is a path from every cell to every other cell in the region (without leaving the region).
- are disjoint, i.e. cell is in region A means it is not in region B.
- there can be cells in a sector that are NOT in a region, e.g. unpassable cells.
required operations:
- Cost of sector (how?) - sum of costs of all cells in sector?
- Fogged status of sector (HOW?) - maybe use percent of unfogged cells in sector?