package game World :: struct { economy: Economy, combat: Combat, base_health: int, world_map: Map, events: [dynamic]Event, phase: Game_Phase, wave: Wave, selected_tower: Tower_Kind, } Map :: struct { current_map: World_Map, path: [dynamic]Vec2, } Economy :: struct { gold: int, } Combat :: struct { enemies: [MAX_ENEMIES]Enemy, towers: [dynamic]Tower, projectiles: [MAX_PROJECTILES]Projectile, } Wave :: struct { current_wave: int, spawner: Wave_Spawner, } init_world :: proc() -> World { economy := Economy { gold = 100, } world := World { economy = economy, base_health = 20, phase = .Build, selected_tower = .Archer, } init_map(&world.world_map.current_map) build_path(&world.world_map.current_map, &world.world_map.path) return world } // update world, never draw update_world :: proc(world: ^World, dt: f32) { if world.phase == .Game_Over || world.phase == .Victory do return cmd := gather_commands(world) execute_command(world, cmd) update_wave(world, dt) update_enemies(world, dt) update_projectiles(world, dt) update_towers(world, dt) update_phase(world) process_events(world) check_end(world) }