FogOfWarSystem ​
Inherits: Node3D
FogOfWarSystem manages fog of war using a CompositorEffect for rendering.
Description ​
Uses depth buffer reconstruction to apply fog based on world position. Supports configurable edge smoothing, colors, and performance settings.
Entity visibility is determined via spatial queries (RangeQueryUtil) and line-of-sight checks (LineOfSightUtility) for improved performance over viewport texture sampling.
Variables ​
PartyManager | party_manager | |
WorldContainer | world_container | |
float | radius | 50.0 |
Color | color | Color.WHITE |
Methods ​
void | initialize( map_size: Vector2, map_origin: Vector2 = Vector2.ZERO ) |
void | update_fog_colors( shroud_alpha: float, fog_alpha: float ) |
void | update_edge_smoothing( threshold: float, softness: float ) |
void | update_blur_radius( radius: float ) |
void | apply_config_settings() |
void | register_vision_source( entity: Entity ) |
void | unregister_vision_source( entity: Entity ) |
void | set_radius( new_radius: float ) |
GameplayConfig.FogState | get_fog_state_at_position( world_position: Vector3 ) |
bool | is_position_visible( world_position: Vector3 ) |
bool | is_position_explored( world_position: Vector3 ) |
Image | get_exploration_image() |
void | clear_exploration() |
void | reveal_all() |
void | cleanup() |
void | debug_save_viewport_textures() |
Signals ​
fog_initialized() ​
Emitted when the fog is ready.
entity_fog_state_changed( entity: Entity, old_state: GameplayConfig.FogState, new_state: GameplayConfig.FogState ) ​
Emitted when an entity moves between visible, explored and hidden.
exploration_changed() ​
Emitted when the explored area grows.
Variable descriptions ​
PartyManager party_manager ​
The manager of the party (the vision sources).
WorldContainer world_container ​
The container of the current world.
float radius = 50.0 ​
No description yet.
Color color = Color.WHITE ​
No description yet.
Method descriptions ​
void initialize( map_size: Vector2, map_origin: Vector2 = Vector2.ZERO ) ​
Sets the fog up for a map: its size and the position of its corner.
void update_fog_colors( shroud_alpha: float, fog_alpha: float ) ​
Update fog colors at runtime
void update_edge_smoothing( threshold: float, softness: float ) ​
Update edge smoothing at runtime
void update_blur_radius( radius: float ) ​
Update blur radius at runtime
void apply_config_settings() ​
Apply current config settings (call after changing gameplay_config)
void register_vision_source( entity: Entity ) ​
Makes an entity see (it clears the fog around it).
void unregister_vision_source( entity: Entity ) ​
Stops an entity from seeing.
void set_radius( new_radius: float ) ​
No description yet.
GameplayConfig.FogState get_fog_state_at_position( world_position: Vector3 ) ​
Is this position visible, explored or hidden?
bool is_position_visible( world_position: Vector3 ) ​
Can the party see this position now?
bool is_position_explored( world_position: Vector3 ) ​
Has the party seen this position?
Image get_exploration_image() ​
The picture of the explored area (for the map and for saves).
void clear_exploration() ​
Forgets everything the party explored.
void reveal_all() ​
Marks the whole map as explored.
void cleanup() ​
Removes the fog and frees what it holds.
void debug_save_viewport_textures() ​
Saves the textures of the fog to files, for debugging.