aboutsummaryrefslogtreecommitdiff
path: root/server/src/benchmark.rs
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/benchmark.rs')
-rw-r--r--server/src/benchmark.rs18
1 files changed, 16 insertions, 2 deletions
diff --git a/server/src/benchmark.rs b/server/src/benchmark.rs
index 7d73d66e..6e9e4eb7 100644
--- a/server/src/benchmark.rs
+++ b/server/src/benchmark.rs
@@ -16,10 +16,15 @@
*/
-use crate::server::{Server, ServerConfig};
+use crate::{
+ entity::bot::BotDriver,
+ server::{Server, ServerConfig},
+};
use anyhow::Result;
+use hurrycurry_bot::algos::Simple;
use hurrycurry_data::build_data;
-use hurrycurry_protocol::PacketC;
+use hurrycurry_protocol::{Character, PacketC, PlayerClass};
+use log::debug;
use std::{path::PathBuf, time::Instant};
use tokio::sync::broadcast;
@@ -34,6 +39,13 @@ pub fn benchmark(data_path: PathBuf) -> Result<()> {
server.load(build_data(&server.config.data_path, "junior", true)?, None);
+ server.entities.push(Box::new(BotDriver::new(
+ "player".to_string(),
+ Character::default(),
+ PlayerClass::Chef,
+ |p| Box::new(Simple::new(p)),
+ )));
+
let start = Instant::now();
let mut packets = 0;
let mut packets_movement = 0;
@@ -48,6 +60,8 @@ pub fn benchmark(data_path: PathBuf) -> Result<()> {
}
}
}
+
+ debug!("points: {}", server.game.score.points);
println!("simulation took {:?}", start.elapsed());
println!(
"packets broadcast: {packets} ({packets_movement} movement, {} other)",