R-Type
Networked shoot'em up built on Aegis2D
Loading...
Searching...
No Matches
rtype::RandomInputs Class Reference

Random actions held for random times, like a player mashing the keys. More...

#include </__w/project-rtype/project-rtype/tools/bot/include/rtype/bot.hpp>

Public Types

using Clock = std::chrono::steady_clock
 Clock of the holds.
 

Public Member Functions

 RandomInputs (std::uint32_t seed)
 Creates the generator.
 
aegis2d::ecs::PlayerInput update (Clock::time_point now)
 The input to hold now: a new one once the last has been held long enough.
 
std::uint64_t picks () const noexcept
 Number of inputs picked.
 

Static Public Attributes

static constexpr std::chrono::milliseconds shortest_hold {150}
 Shortest time an input is held.
 
static constexpr std::chrono::milliseconds longest_hold {900}
 Longest time an input is held.
 

Detailed Description

Random actions held for random times, like a player mashing the keys.

Each pick holds a direction (or none) on each axis, and Fire most of the time, for a time drawn between the shortest and longest hold. The same seed gives the same inputs at the same times.

Member Typedef Documentation

◆ Clock

using rtype::RandomInputs::Clock = std::chrono::steady_clock

Clock of the holds.

Constructor & Destructor Documentation

◆ RandomInputs()

rtype::RandomInputs::RandomInputs ( std::uint32_t  seed)
explicit

Creates the generator.

Parameters
seedSeed of the draws.

Member Function Documentation

◆ picks()

std::uint64_t rtype::RandomInputs::picks ( ) const
noexcept

Number of inputs picked.

Returns
The count since the generator was created.

◆ update()

aegis2d::ecs::PlayerInput rtype::RandomInputs::update ( Clock::time_point  now)

The input to hold now: a new one once the last has been held long enough.

Parameters
nowCurrent time; the first call picks the first input.
Returns
The held actions.

Member Data Documentation

◆ longest_hold

constexpr std::chrono::milliseconds rtype::RandomInputs::longest_hold {900}
staticconstexpr

Longest time an input is held.

◆ shortest_hold

constexpr std::chrono::milliseconds rtype::RandomInputs::shortest_hold {150}
staticconstexpr

Shortest time an input is held.


The documentation for this class was generated from the following file: