JFLib

game/src/net/bot.rs#

Source: lib/game/src/net/bot.rs

bot -- a player without a person for tests and load: it wanders the arena, turns, strafes, runs and
jumps now and then, and (with fire) aims at the nearest other figure and shoots.  It sees what its
client sees (its predicted figure, the others interpolated) and makes the input of one tick from it;
deterministic from its seed

  BotConfig    seed, whether it shoots, how often it jumps, how fast it turns
  Bot::think   the input of a tick from the own figure's feet (None before the first snapshot) and the
               others' feet
  • struct BotConfig a bot's settings

    • seed: u64 -- its random numbers
    • fire: bool -- it shoots at others within range
    • range: f64 -- see fire (m)
    • jumps: f64 -- jumps a second on average
    • turn: f64 -- the fastest turn (rad/s)
    • half: f64 -- half the side of the arena (where it wanders)
    • rate: u32 -- ticks a second
  • struct Bot a bot (see the module header)

impl Bot

  • fn new(cfg: BotConfig) -> Bot a bot with these settings

  • fn think(&mut self, own: Option<Vec3>, others: &[(u16, Vec3)]) -> NetInput the input of one tick: own the figure's feet (None: not known yet), others the other figures' feet

  • fn remote_feet(remotes: &[super::client::Remote], out: &mut Vec<(u16, Vec3)>) the feet of the other figures of a client's view (KIND_PLAYER remotes, blended), for Bot::think

Source: docs/API.md in the JFLib repository.