Adjustments for container deployment

This commit is contained in:
vandomej 2025-09-10 22:32:54 -07:00
parent 41288b6693
commit 58cf33d6af
4 changed files with 44 additions and 29 deletions

2
.gitignore vendored
View file

@ -3,7 +3,7 @@
# will have compiled files and executables # will have compiled files and executables
debug/ debug/
target/ target/
ai_fighter/Package/ /Packages/
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html

View file

@ -1,11 +1,26 @@
fn main() { fn main() {
// Replace this with the path to the directory containing `fann.lib` // Determine the target platform
let lib_dir = "F://vandomej/Downloads/vcpkg/packages/fann_x64-windows/lib"; let target = std::env::var("TARGET").unwrap_or_default();
println!("cargo:rustc-link-search=native={}", lib_dir); if target.contains("windows") {
println!("cargo:rustc-link-lib=static=fann"); // Windows-specific linking
// Use `dylib=fann` instead of `static=fann` if you're linking dynamically let lib_dir = "F://vandomej/Downloads/vcpkg/packages/fann_x64-windows/lib";
println!("cargo:rustc-link-search=native={}", lib_dir);
println!("cargo:rustc-link-lib=static=fann");
} else if target.contains("linux") {
// Linux-specific linking
// OR if you have a custom location for Linux libs
let lib_dir = "/mnt/f/vandomej/Projects/evolved-npcs/ai_fighter/AI_Fight_Sim/Plugins/NeuralNetworkAIController/Source/NeuralNetworkAIController/ThirdParty/FANN/lib/linux/x86_64-unknown-linux-gnu/";
let lib_path = std::path::Path::new(&lib_dir).join("libfann.a");
if lib_path.exists() {
println!("cargo:rustc-link-search=native={}", lib_dir);
println!("cargo:rustc-link-lib=static=fann");
println!("cargo:warning=Found libfann.a at: {:?}", lib_path);
} else {
println!("cargo:warning=libfann.a not found at: {:?}", lib_path);
panic!("libfann.a not found in specified directory");
}
}
// If there are any additional directories where the compiler can find header files, you can specify them like this: // Add other target platforms as needed
// println!("cargo:include={}", path_to_include_directory);
} }

View file

@ -4,7 +4,7 @@ use serde::ser::SerializeTuple;
use serde::{Deserialize, Deserializer, Serialize, Serializer}; use serde::{Deserialize, Deserializer, Serialize, Serializer};
use tokio::sync::Semaphore; use tokio::sync::Semaphore;
const SHARED_SEMAPHORE_CONCURRENCY_LIMIT: usize = 50; const SHARED_SEMAPHORE_CONCURRENCY_LIMIT: usize = 5;
const VISIBLE_SIMULATIONS_CONCURRENCY_LIMIT: usize = 1; const VISIBLE_SIMULATIONS_CONCURRENCY_LIMIT: usize = 1;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]

View file

@ -28,7 +28,7 @@ use uuid::Uuid;
use self::neural_network_utility::{crossbreed, major_mutation}; use self::neural_network_utility::{crossbreed, major_mutation};
const BASE_DIR: &str = "F:\\\\vandomej\\Projects\\dootcamp-AI-Simulation\\Simulations"; const BASE_DIR: &str = "..\\Simulations";
const POPULATION: usize = 200; const POPULATION: usize = 200;
const NEURAL_NETWORK_INPUTS: usize = 22; const NEURAL_NETWORK_INPUTS: usize = 22;
@ -57,7 +57,7 @@ const SIMULATION_ROUNDS: usize = 5;
const SURVIVAL_RATE_MIN: f32 = 0.1; const SURVIVAL_RATE_MIN: f32 = 0.1;
const SURVIVAL_RATE_MAX: f32 = 0.9; const SURVIVAL_RATE_MAX: f32 = 0.9;
const GAME_EXECUTABLE_PATH: &str = const GAME_EXECUTABLE_PATH: &str =
"F:\\\\vandomej\\Projects\\dootcamp-AI-Simulation\\Package\\Windows\\AI_Fight_Sim.exe"; "..\\Linux_Static_Library\\AI_Fight_Sim\\Binaries\\Linux\\AI_Fight_Sim";
// Here is the folder structure for the FighterNN: // Here is the folder structure for the FighterNN:
// base_dir/fighter_nn_{fighter_id}/{generation}/{fighter_id}_fighter_nn_{nn_id}.net // base_dir/fighter_nn_{fighter_id}/{generation}/{fighter_id}_fighter_nn_{nn_id}.net
@ -846,22 +846,22 @@ async fn run_1v1_simulation(
trace!("Running simulation for {} vs {}", nn_1_id, nn_2_id); trace!("Running simulation for {} vs {}", nn_1_id, nn_2_id);
let _output = if display_simulation { // let _output = if display_simulation {
Command::new(GAME_EXECUTABLE_PATH) // Command::new(GAME_EXECUTABLE_PATH)
.arg(&config1_arg) // .arg(&config1_arg)
.arg(&config2_arg) // .arg(&config2_arg)
.output() // .output()
.await // .await
.expect("Failed to execute game") // .expect("Failed to execute game")
} else { // } else {
Command::new(GAME_EXECUTABLE_PATH) Command::new(GAME_EXECUTABLE_PATH)
.arg(&config1_arg) .arg(&config1_arg)
.arg(&config2_arg) .arg(&config2_arg)
.arg(&disable_unreal_rendering_arg) .arg(&disable_unreal_rendering_arg)
.output() .output()
.await .await
.expect("Failed to execute game") .expect("Failed to execute game");
}; // };
trace!( trace!(
"Simulation completed for {} vs {}: {}", "Simulation completed for {} vs {}: {}",