#rogue-like #gamedev #recursion #grid #visibility #observer #shadowcasting

shadowcaster

Recursive shadowcasting for grid based video games

4 releases

0.3.4 Jan 25, 2025
0.3.3 Jan 21, 2025
0.3.1 Jan 20, 2025
0.1.0 Dec 14, 2024

#1152 in Game dev

Download history 131/week @ 2024-12-10 14/week @ 2024-12-17 4/week @ 2025-01-07 44/week @ 2025-01-14 255/week @ 2025-01-21 10/week @ 2025-01-28 6/week @ 2025-02-04 37/week @ 2025-02-11

351 downloads per month

MIT license

18KB
404 lines

Shadowcaster

This is an implementation of recursive shadowcasting for use in grid based video games.

Example Usage

Bevy

/// Bevy requires any static data to implement Resource, so you can easily use that across the app
#[derive(Resource)]
pub struct VisContainer {
  pub visibility: shadowcaster::Visibility,
}

/// update the observer as the player moves
pub fn player_transform_system(
  mut commands: Commands,
  player_query: Query<&Transform, With<Player>>,
) {
    if player_query.get_single().is_err() {
        return;
    }
    let player_transform = player_query.single();
    vis_container.visibility.observer = player_grid_pos;
}

Dependencies

~4MB
~125K SLoC