This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use futures::{Stream, StreamExt}; | |
use std::time::Duration; | |
use std::{collections::VecDeque, pin::Pin}; | |
// Why do the spawned tasks that generate the streams in the code below | |
// not run in parallel with at most 2 tasks running at once? | |
static mut START: std::mem::MaybeUninit<std::time::Instant> = std::mem::MaybeUninit::uninit(); | |
macro_rules! log { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
unique_lock lock(mutex); // takes the lock | |
convar.wait(mutex) // wait | |
// do stuff with the lock | |
} | |
// the lock is no longer held |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Replay = { | |
when: Date, | |
resolve: () => void, | |
}; | |
// jobs that are waiting for a virtual timeout (for us to skip more time) | |
// this could be a btree set for more effieciency | |
let replay_buffer: Replay[] = []; | |
// current replay time. starts at the point the game was closed last time and ends when we have caught up to real-time. | |
let replay_time: Date | null = null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// # Cargo.toml | |
// [dependencies] | |
// memmap = "0.7.0" | |
// rayon = "1.5.3" | |
use std::{ | |
fmt::{Display, Write}, | |
path::Path, | |
time::Instant, | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/composer.json b/composer.json | |
index 25595571f..23b274391 100644 | |
--- a/composer.json | |
+++ b/composer.json | |
@@ -44,6 +44,7 @@ | |
"prologue/alerts": "~1.1.0", | |
"psr/cache": "~3.0.0", | |
"s1lentium/iptools": "~1.2.0", | |
+ "spatie/ignition": "~1.12.0", | |
"spatie/laravel-fractal": "~6.0.3", |