rename GraphicsState to InputGenerator
This commit is contained in:
@@ -26,7 +26,7 @@ impl SimulateSubcommand {
|
|||||||
|
|
||||||
use burn::prelude::*;
|
use burn::prelude::*;
|
||||||
|
|
||||||
use crate::inputs::GraphicsState;
|
use crate::inputs::InputGenerator;
|
||||||
use crate::net::{INPUT, InferenceBackend, Net};
|
use crate::net::{INPUT, InferenceBackend, Net};
|
||||||
|
|
||||||
use strafesnet_common::instruction::TimedInstruction;
|
use strafesnet_common::instruction::TimedInstruction;
|
||||||
@@ -113,7 +113,7 @@ fn inference(gpu_id: usize, model_path: std::path::PathBuf) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// setup graphics
|
// setup graphics
|
||||||
let mut g = GraphicsState::new(&map);
|
let mut g = InputGenerator::new(&map);
|
||||||
|
|
||||||
// setup simulation
|
// setup simulation
|
||||||
let mut session = Session {
|
let mut session = Session {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ use crate::net::{POSITION_HISTORY, SIZE};
|
|||||||
// bytes_per_row needs to be a multiple of 256.
|
// bytes_per_row needs to be a multiple of 256.
|
||||||
const STRIDE_SIZE: u32 = (SIZE.x * size_of::<f32>() as u32).next_multiple_of(256);
|
const STRIDE_SIZE: u32 = (SIZE.x * size_of::<f32>() as u32).next_multiple_of(256);
|
||||||
|
|
||||||
pub struct GraphicsState {
|
pub struct InputGenerator {
|
||||||
device: wgpu::Device,
|
device: wgpu::Device,
|
||||||
queue: wgpu::Queue,
|
queue: wgpu::Queue,
|
||||||
graphics: strafesnet_roblox_bot_player::graphics::Graphics,
|
graphics: strafesnet_roblox_bot_player::graphics::Graphics,
|
||||||
@@ -16,7 +16,7 @@ pub struct GraphicsState {
|
|||||||
texture_data: Vec<u8>,
|
texture_data: Vec<u8>,
|
||||||
position_history: Vec<glam::Vec3>,
|
position_history: Vec<glam::Vec3>,
|
||||||
}
|
}
|
||||||
impl GraphicsState {
|
impl InputGenerator {
|
||||||
pub fn new(map: &strafesnet_common::map::CompleteMap) -> Self {
|
pub fn new(map: &strafesnet_common::map::CompleteMap) -> Self {
|
||||||
let desc = wgpu::InstanceDescriptor::new_without_display_handle_from_env();
|
let desc = wgpu::InstanceDescriptor::new_without_display_handle_from_env();
|
||||||
let instance = wgpu::Instance::new(desc);
|
let instance = wgpu::Instance::new(desc);
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ use burn::nn::loss::{MseLoss, Reduction};
|
|||||||
use burn::optim::{AdamConfig, GradientsParams, Optimizer};
|
use burn::optim::{AdamConfig, GradientsParams, Optimizer};
|
||||||
use burn::prelude::*;
|
use burn::prelude::*;
|
||||||
|
|
||||||
use crate::inputs::GraphicsState;
|
use crate::inputs::InputGenerator;
|
||||||
use crate::net::{INPUT, Net, OUTPUT, TrainingBackend};
|
use crate::net::{INPUT, Net, OUTPUT, TrainingBackend};
|
||||||
|
|
||||||
use strafesnet_roblox_bot_file::v0;
|
use strafesnet_roblox_bot_file::v0;
|
||||||
@@ -61,7 +61,7 @@ fn training(gpu_id: usize, epochs: usize, learning_rate: f64) {
|
|||||||
// run progressively longer segments of the map, starting very close to the end of the run and working the starting time backwards until the ai can run the whole map
|
// run progressively longer segments of the map, starting very close to the end of the run and working the starting time backwards until the ai can run the whole map
|
||||||
|
|
||||||
// set up graphics
|
// set up graphics
|
||||||
let mut g = GraphicsState::new(&map);
|
let mut g = InputGenerator::new(&map);
|
||||||
|
|
||||||
// training data
|
// training data
|
||||||
let training_samples = timelines.input_events.len() - 1;
|
let training_samples = timelines.input_events.len() - 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user