#gamedev #game #api-bindings #grpc-api

auto-traffic-control

A video game for programmers about air traffic control

4 releases

0.3.2 May 19, 2022
0.3.1 May 16, 2022
0.3.0 Apr 23, 2022
0.2.0 Apr 16, 2022

#1915 in Game dev

MIT/Apache

6KB

🛬 Auto Traffic Control

GitHub Workflow Status Version License

Homepage | Documentation | Community

Auto Traffic Control is a video game played by programming. The player's task is to create a program that can safely manage the airspace above two airports.

The game is designed to provide an open-ended sandbox that players can use to freely practice programming. The game provides a language-agnostic gRPC API, giving players free choice of programming language or paradigm.

This crate contains the auto-generated Rust SDK for the game's gRPC API.

Usage

First, add auto-traffic-control as a new dependency to your Cargo.toml.

[dependencies]
auto-traffic-control = "0.3.2"

You also need to add tonic, the Rust implementation of gRPC, and tokio, the async runtime, as a dependency.

Then, create a service client and send a request. Check out the documentation to learn about the different services and their endpoints.

The following example queries the version of the game through the AtcService.

use auto_traffic_control::v1::atc_service_client::AtcServiceClient;
use auto_traffic_control::v1::GetVersionRequest;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut atc_service = AtcServiceClient::connect("http://localhost:4747").await?;

    let response = atc_service.get_version(GetVersionRequest {}).await?;
    let version_field = response.into_inner().version;

    if let Some(version) = version_field {
        let mut version_string = format!("{}.{}.{}", version.major, version.minor, version.patch);

        if !version.pre.is_empty() {
            version_string.push('-');
            version_string.push_str(&version.pre);
        }

        println!("Auto Traffic Control is running version '{version_string}'");
    } else {
        println!("Requesting the version returned an empty response.");
    }

    Ok(())
}

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~8MB
~145K SLoC