From 966ad4e5a4e885ef657707b2bc47c056fe64fc54 Mon Sep 17 00:00:00 2001 From: Mark Date: Mon, 8 Jan 2024 23:10:30 -0800 Subject: [PATCH] Minor edits --- TODO.md | 10 +++++ crates/galactica/src/game.rs | 57 +++++++++++++---------------- crates/gameobject/src/projectile.rs | 2 + 3 files changed, 38 insertions(+), 31 deletions(-) diff --git a/TODO.md b/TODO.md index d321a1e..f1739b6 100644 --- a/TODO.md +++ b/TODO.md @@ -17,6 +17,10 @@ - Particles when a ship is damaged (events) - Sticky radar - Clean up world and objects + - Fix gun points + - Arbitrary size resource names + - How does a player control a ship (also fix behaviors) + ---------------------------------- @@ -69,6 +73,7 @@ - where to go - etc, extra flags - Advanced particle physics (must move to cpu. Maybe both?) + - Background simulation (two modes: physics-what's visible, data-everything else) ## Faction interaction @@ -109,6 +114,10 @@ - Missions - Procedural suns - Heat and energy + - Non-removable outfits + - Space-converting outfits + - Damage struct and debuffs + - ## Camera - Shake/wobble on heavy hits? @@ -145,6 +154,7 @@ - How packer and optimizations work, and why - How big should sprite resolutions be? How about frame rate? - Naming: atlas, sprite, image, frame, texture + - Outfits may not change unless you've landed. They might not change ever for CC ships! ## Ideas diff --git a/crates/galactica/src/game.rs b/crates/galactica/src/game.rs index da9178c..292bd55 100644 --- a/crates/galactica/src/game.rs +++ b/crates/galactica/src/game.rs @@ -1,4 +1,6 @@ use cgmath::Point2; +use content::Ship; +use object::{ship::ShipPersonality, GameData}; use std::time::Instant; use winit::event::{ElementState, MouseButton, MouseScrollDelta, TouchPhase, VirtualKeyCode}; @@ -26,6 +28,8 @@ pub struct Game { shipbehaviors: Vec>, playerbehavior: behavior::Player, + gamedata: GameData, + content: content::Content, world: World, new_particles: Vec, @@ -34,6 +38,8 @@ pub struct Game { impl Game { pub fn new(ct: content::Content) -> Self { let mut physics = World::new(); + let mut gamedata = GameData::new(); + let ss = ct.get_ship(content::ShipHandle { index: 0 }); let mut o1 = object::OutfitSet::new(ss); @@ -43,49 +49,37 @@ impl Game { o1.add_gun(&ct, content::GunHandle { index: 0 }); o1.add_gun(&ct, content::GunHandle { index: 0 }); - let s = object::Ship::new( - &ct, - content::ShipHandle { index: 0 }, - content::FactionHandle { index: 0 }, - o1, - ); - - let h1 = physics.add_ship(&ct, s, Point2 { x: 0.0, y: 0.0 }); - - let s = object::Ship::new( - &ct, - content::ShipHandle { index: 0 }, - // This method of specifying factions is non-deterministic, - // but that's ok since this is for debug. - // TODO: fix - content::FactionHandle { index: 1 }, - object::OutfitSet::new(ss), - ); - let h2 = physics.add_ship(&ct, s, Point2 { x: 300.0, y: 300.0 }); - let mut o1 = object::OutfitSet::new(ss); o1.add(&ct, content::OutfitHandle { index: 0 }); o1.add_gun(&ct, content::GunHandle { index: 0 }); - let s = object::Ship::new( + gamedata.create_ship( &ct, content::ShipHandle { index: 0 }, - content::FactionHandle { index: 1 }, + content::FactionHandle { index: 0 }, + ShipPersonality::Player, o1, ); - let h3 = physics.add_ship( + gamedata.create_ship( &ct, - s, - Point2 { - x: -300.0, - y: 300.0, - }, + content::ShipHandle { index: 0 }, + content::FactionHandle { index: 1 }, + ShipPersonality::Dummy, + object::OutfitSet::new(ss), ); - let mut shipbehaviors: Vec> = Vec::new(); - shipbehaviors.push(Box::new(behavior::Dummy::new(h2))); - shipbehaviors.push(Box::new(behavior::Point::new(h3))); + gamedata.create_ship( + &ct, + content::ShipHandle { index: 0 }, + content::FactionHandle { index: 1 }, + ShipPersonality::Point, + o1, + ); + + //let mut shipbehaviors: Vec> = Vec::new(); + //shipbehaviors.push(Box::new(behavior::Dummy::new(h2))); + //shipbehaviors.push(Box::new(behavior::Point::new(h3))); Game { last_update: Instant::now(), @@ -103,6 +97,7 @@ impl Game { time_scale: 1.0, world: physics, shipbehaviors, + gamedata, content: ct, playerbehavior: behavior::Player::new(h1), new_particles: Vec::new(), diff --git a/crates/gameobject/src/projectile.rs b/crates/gameobject/src/projectile.rs index 6697295..b9d05e8 100644 --- a/crates/gameobject/src/projectile.rs +++ b/crates/gameobject/src/projectile.rs @@ -1,5 +1,7 @@ use galactica_content as content; +// TODO: remove. projectiles only exist in physics + #[derive(Debug)] pub struct Projectile { pub content: content::Projectile,