Opened 5 years ago

Last modified 3 years ago

#5566 new enhancement

Refactor Terrain - reduce coupling with simulation components and actual graphical rendering.

Reported by: wraitii Owned by:
Priority: Must Have Milestone: Backlog
Component: Core engine Keywords:
Cc: Patch:

Description

This is a high-level task.

Terrain is very tightly coupled with the simulation in a variety of ways:

  • TERRAIN_TILE_SIZE is used in many, many places. It has a value of 4 meters. The corresponding NAVCELL_PER_TILE constant is used to convert that back to meters, usually.
  • Terrain height map and passability are very tightly coupled.
  • LOS is coupled with terrain.
  • Several components expect a height map (least of all the map generator and atlas).
  • Terrain rendering is tile-based and detail cannot be added for now, and this is an increasing graphics issue.
  • Terrain is strictly 2D.
  • Textures are very coupled with our terrain specs (which makes some sense, but also limits our abilities).
  • Overlays are coupled with terrain.
  • Water rendering is coupled with terrain rendering
  • We only support a single terrain implementation, simulation-wise and graphics-wise.

+ ... Possibly unidentified other ways ...

A variety of these issues can be fixed somewhat easily and will decrease coupling. Some will be harder, and some require some foresight (do we _need_ several terrain implementations?).

I intend to work on this on and off. Priority will be fixing simulation-terrain coupling, then seeing what can be done for the graphics and texture aspect of it, then seeing how that can be handled in Atlas and such.

Change History (2)

comment:1 by Silier, 3 years ago

Milestone: Work In ProgressBacklog

comment:2 by wraitii, 3 years ago

In 24980:

Decouple LOS resolution from terrain resolution

Introduce a LOS_TILE_SIZE, to replace usage of TERRITORY_TILE_SIZE in the LOS code.
This makes it possible to change the resolution of LOS/Terrain without affecting the other component.

Additional refactoring:

  • LosTile has been renamed LosRegion (it's more comparable to the hierarchical pathfinder regions/spatial subdivisions)
  • LosState explicitly refers to "los vertices" instead of terrain vertices.

Refs #5566

Differential Revision: https://code.wildfiregames.com/D3076

Note: See TracTickets for help on using tickets.