A client without window nor sound: a ClientSession whose inputs are RandomInputs, or ScriptedInputs when its settings have a script.
More...
#include </__w/project-rtype/project-rtype/tools/bot/include/rtype/bot.hpp>
|
| using | Clock = std::chrono::steady_clock |
| | Clock of the session and the inputs.
|
| |
|
| | Bot (aegis2d::net::NetworkContext &context, const BotSettings &settings) |
| | Creates a bot, not started.
|
| |
| void | start () |
| | Connects to the server and logs in.
|
| |
| void | update (Clock::time_point now) |
| | Runs the session's timers and, in game, picks the inputs; a script starts at the first update in game.
|
| |
| void | leave () |
| | Leaves the server: sends Logout; keep running the context a little for it to leave.
|
| |
| const ClientSession & | session () const noexcept |
| | The session with the server: its state, error, traffic and world.
|
| |
| aegis2d::ecs::PlayerInput | input () const noexcept |
| | The actions held now.
|
| |
| std::uint64_t | picks () const noexcept |
| | Number of inputs picked: random holds, or steps of the script.
|
| |
A client without window nor sound: a ClientSession whose inputs are RandomInputs, or ScriptedInputs when its settings have a script.
start() joins the server as any client does (TCP login, then UDP binding); once in game, update() sends its inputs, one Input per server tick, which also keep the session alive. leave() says goodbye with Logout. Same threading rules as ClientSession: use it on the thread running the context.
◆ Clock
Clock of the session and the inputs.
◆ Bot()
| rtype::Bot::Bot |
( |
aegis2d::net::NetworkContext & |
context, |
|
|
const BotSettings & |
settings |
|
) |
| |
Creates a bot, not started.
- Parameters
-
| context | Context that runs its sockets; it must outlive this object. |
| settings | Server, name and seed. |
◆ input()
| aegis2d::ecs::PlayerInput rtype::Bot::input |
( |
| ) |
const |
|
noexcept |
The actions held now.
- Returns
- The last input given to the session.
◆ leave()
| void rtype::Bot::leave |
( |
| ) |
|
Leaves the server: sends Logout; keep running the context a little for it to leave.
◆ picks()
| std::uint64_t rtype::Bot::picks |
( |
| ) |
const |
|
noexcept |
Number of inputs picked: random holds, or steps of the script.
- Returns
- The count since the game started.
◆ session()
The session with the server: its state, error, traffic and world.
- Returns
- The session.
◆ start()
| void rtype::Bot::start |
( |
| ) |
|
Connects to the server and logs in.
◆ update()
| void rtype::Bot::update |
( |
Clock::time_point |
now | ) |
|
Runs the session's timers and, in game, picks the inputs; a script starts at the first update in game.
- Parameters
-
The documentation for this class was generated from the following file:
- /__w/project-rtype/project-rtype/tools/bot/include/rtype/bot.hpp