1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//! The server for the game. Listents to TCP and UDP connections, both on on the
//! port 7812. The TCP server is encrypted using TLS, and provides data needed
//! to communicate with the gameplay server behind the UDP socket, which is
//! encrypted using the ad-hoc protocol defined in [common::protocol].

use stderrlog::{LogLevelNum, Timestamp};

mod game_loop;
mod gameplay_socket;
mod login_server;
mod map_loader;
mod secure_rand;

/// Initializes the logger and the secure random number generator, and runs
/// [game_loop::run].
fn main() -> anyhow::Result<()> {
    stderrlog::new()
        .timestamp(Timestamp::Millisecond)
        .verbosity(LogLevelNum::Debug)
        .init()?;
    secure_rand::gen_bytes(&mut [0]); // Make sure the system random is initialized.
    game_loop::run()
}