-
Notifications
You must be signed in to change notification settings - Fork 6
/
lib.rs
165 lines (162 loc) · 5.79 KB
/
lib.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
//! [![crates.io](https://img.shields.io/crates/v/rlbot.svg)](https://crates.io/crates/rlbot)
//! [![docs](https://docs.rs/rlbot/badge.svg)](https://docs.rs/rlbot/)
//! [![Build Status](https://travis-ci.org/whatisaphone/rlbot-rust.svg?branch=master)](https://travis-ci.org/whatisaphone/rlbot-rust)
//!
//! <img src="https://github.com/whatisaphone/rlbot-rust/raw/master/assets/logo.png" height="128" style="float:left;margin:0 16px 0 0" />
//!
//! [RLBot] is a framework for creating offline Rocket League bots. This crate
//! lets you write bots using a simple, safe interface that should feel
//! comfortable to Rust developers.
//!
//! [RLBot]: https://github.com/RLBot/RLBot
//!
//! Most types in this crate are exported directly from RLBot, so for anything
//! not documented here, you'll need to use RLBot's docs as the authoritative
//! reference.
//!
//! There are two ways to use this crate:
//!
//! 1. [`run_bot`] and [`Bot`] – This is the **high-level** interface. It plays
//! a single match from start to finish. It expects the app to have been
//! launched by the RLBot framework, and runs its own game loop under
//! framework control.
//! 2. [`init`](init()) and [`RLBot`] – This is the **low-level** interface. You
//! can use this to directly access the innards of RLBot for scripting,
//! integration tests, or any other custom use-case.
//!
//! ## Examples
//!
//! This crate comes with plenty examples to get you started. All the examples
//! can be run directly from the repo. Follow these steps to run an example:
//!
//! 1. Run Rocket League with the `-rlbot` flag. The flag causes Rocket League
//! to start a local UDP server that lets RLBot control the game. It also
//! disables the online features of the game.
//!
//! ```sh
//! Steam.exe -applaunch 252950 -rlbot
//! ```
//!
//! 1. Run `RLBot.exe`, which is included as part of the Python `rlbot` package.
//! This is a service process that helps bots communicate with the game.
//!
//! 1. Run the example (here we run the example called `simple`):
//!
//! ```sh
//! cargo run --example simple
//! ```
//!
//! ### examples/simple ([Source][`examples/simple`])
//!
//! This is a simple ATBA, or **A**lways **T**owards **B**all **A**gent.
//!
//! Key APIs:
//!
//! * [`init`](init())
//! * [`RLBot::start_match`]
//! * [`Packeteer::next`]
//! * [`RLBot::update_player_input`]
//!
//! ### examples/simple_flatbuffer ([Source][`examples/simple_flatbuffer`])
//!
//! Another ATBA, but using the lower-level flatbuffer functions. All of the
//! low-level functions in RLBot's interface make use of flatbuffers.
//!
//! Key APIs:
//!
//! * [`Packeteer::next_flatbuffer`]
//! * [`RLBot::update_player_input_flatbuffer`]
//!
//! ### examples/rendering ([Source][`examples/rendering`])
//!
//! This example shows how to draw simple shapes to the game window. If you
//! don't see anything, try pressing PageUp, which is RLBot's shortcut for
//! turning on rendering.
//!
//! Key APIs:
//!
//! * [`RLBot::begin_render_group`]
//! * [`RenderGroup::render`]
//!
//! ### examples/gravity ([Source][`examples/gravity`])
//!
//! A fun example showing how to set game state.
//!
//! Key APIs:
//!
//! * [`RLBot::set_game_state_struct`]
//!
//! ### examples/gravity_flatbuffer ([Source][`examples/gravity_flatbuffer`])
//!
//! This works exactly the same as the previous example, except it uses the
//! low-level flatbuffer interface.
//!
//! Key APIs:
//!
//! * [`RLBot::set_game_state`]
//!
//! ### examples/bot ([Source][`examples/bot`])
//!
//! I saved the best for last. This is a full-fledged RLBot bot that can run
//! within the RLBot framework. It's different than the other examples, in that
//! it requires a working RLBot Python setup. Follow the instructions in
//! [RLBotPythonExample] to make sure you have all the necessary dependencies
//! installed. Once you have that working, you are ready to roll.
//!
//! Do not run Rocket League or RLBot.exe—the framework will take care of that
//! automatically. Just run this command:
//!
//! ```sh
//! cargo build --example bot && python -c "from rlbot import runner; runner.main()"
//! ```
//!
//! Key APIs:
//!
//! * [`run_bot`]
//!
//! [`examples/bot`]: https://github.com/whatisaphone/rlbot-rust/blob/master/examples/bot/main.rs
//! [`examples/simple`]: https://github.com/whatisaphone/rlbot-rust/blob/master/examples/simple.rs
//! [`examples/simple_flatbuffer`]: https://github.com/whatisaphone/rlbot-rust/blob/master/examples/simple_flatbuffer.rs
//! [`examples/rendering`]: https://github.com/whatisaphone/rlbot-rust/blob/master/examples/rendering.rs
//! [`examples/gravity`]: https://github.com/whatisaphone/rlbot-rust/blob/master/examples/gravity.rs
//! [`examples/gravity_flatbuffer`]: https://github.com/whatisaphone/rlbot-rust/blob/master/examples/gravity_flatbuffer.rs
//! [RLBotPythonExample]: https://github.com/RLBot/RLBotPythonExample
#![warn(future_incompatible, rust_2018_compatibility, rust_2018_idioms, unused)]
#![cfg_attr(feature = "strict", deny(warnings))]
#![warn(missing_docs, clippy::all)]
#![allow(intra_doc_link_resolution_failure)]
pub use crate::{
framework::{parse_framework_args, run_bot, Bot, FrameworkArgs},
game::*,
hive::{parse_hive_framework_args, run_hive, Hivemind, HiveFrameworkArgs},
init::{init, init_with_options, InitOptions},
match_settings::*,
packeteer::Packeteer,
physicist::Physicist,
render::{Color, RenderGroup},
rlbot::RLBot,
rlbot_generated::rlbot::flat,
state::*,
};
mod dll;
mod error;
pub mod ffi;
mod ffi_impls;
mod framework;
mod game;
mod game_deserialize;
mod hive;
mod init;
mod interface;
mod match_settings;
mod packeteer;
mod physicist;
mod render;
mod rlbot;
#[allow(non_camel_case_types, non_snake_case, missing_docs, clippy::all)]
mod rlbot_generated;
mod state;
mod state_convert;
#[cfg(feature = "nalgebra")]
mod state_nalgebra;
mod utils;