Minor edits

master
Mark 2024-01-08 23:10:30 -08:00
parent 1b9e1f2877
commit 966ad4e5a4
Signed by: Mark
GPG Key ID: C6D63995FE72FD80
3 changed files with 38 additions and 31 deletions

10
TODO.md
View File

@ -17,6 +17,10 @@
- Particles when a ship is damaged (events) - Particles when a ship is damaged (events)
- Sticky radar - Sticky radar
- Clean up world and objects - 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 - where to go
- etc, extra flags - etc, extra flags
- Advanced particle physics (must move to cpu. Maybe both?) - Advanced particle physics (must move to cpu. Maybe both?)
- Background simulation (two modes: physics-what's visible, data-everything else)
## Faction interaction ## Faction interaction
@ -109,6 +114,10 @@
- Missions - Missions
- Procedural suns - Procedural suns
- Heat and energy - Heat and energy
- Non-removable outfits
- Space-converting outfits
- Damage struct and debuffs
-
## Camera ## Camera
- Shake/wobble on heavy hits? - Shake/wobble on heavy hits?
@ -145,6 +154,7 @@
- How packer and optimizations work, and why - How packer and optimizations work, and why
- How big should sprite resolutions be? How about frame rate? - How big should sprite resolutions be? How about frame rate?
- Naming: atlas, sprite, image, frame, texture - Naming: atlas, sprite, image, frame, texture
- Outfits may not change unless you've landed. They might not change ever for CC ships!
## Ideas ## Ideas

View File

@ -1,4 +1,6 @@
use cgmath::Point2; use cgmath::Point2;
use content::Ship;
use object::{ship::ShipPersonality, GameData};
use std::time::Instant; use std::time::Instant;
use winit::event::{ElementState, MouseButton, MouseScrollDelta, TouchPhase, VirtualKeyCode}; use winit::event::{ElementState, MouseButton, MouseScrollDelta, TouchPhase, VirtualKeyCode};
@ -26,6 +28,8 @@ pub struct Game {
shipbehaviors: Vec<Box<dyn ShipBehavior>>, shipbehaviors: Vec<Box<dyn ShipBehavior>>,
playerbehavior: behavior::Player, playerbehavior: behavior::Player,
gamedata: GameData,
content: content::Content, content: content::Content,
world: World, world: World,
new_particles: Vec<ParticleBuilder>, new_particles: Vec<ParticleBuilder>,
@ -34,6 +38,8 @@ pub struct Game {
impl Game { impl Game {
pub fn new(ct: content::Content) -> Self { pub fn new(ct: content::Content) -> Self {
let mut physics = World::new(); let mut physics = World::new();
let mut gamedata = GameData::new();
let ss = ct.get_ship(content::ShipHandle { index: 0 }); let ss = ct.get_ship(content::ShipHandle { index: 0 });
let mut o1 = object::OutfitSet::new(ss); 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 });
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); let mut o1 = object::OutfitSet::new(ss);
o1.add(&ct, content::OutfitHandle { index: 0 }); o1.add(&ct, content::OutfitHandle { index: 0 });
o1.add_gun(&ct, content::GunHandle { index: 0 }); o1.add_gun(&ct, content::GunHandle { index: 0 });
let s = object::Ship::new( gamedata.create_ship(
&ct, &ct,
content::ShipHandle { index: 0 }, content::ShipHandle { index: 0 },
content::FactionHandle { index: 1 }, content::FactionHandle { index: 0 },
ShipPersonality::Player,
o1, o1,
); );
let h3 = physics.add_ship( gamedata.create_ship(
&ct, &ct,
s, content::ShipHandle { index: 0 },
Point2 { content::FactionHandle { index: 1 },
x: -300.0, ShipPersonality::Dummy,
y: 300.0, object::OutfitSet::new(ss),
},
); );
let mut shipbehaviors: Vec<Box<dyn ShipBehavior>> = Vec::new(); gamedata.create_ship(
shipbehaviors.push(Box::new(behavior::Dummy::new(h2))); &ct,
shipbehaviors.push(Box::new(behavior::Point::new(h3))); content::ShipHandle { index: 0 },
content::FactionHandle { index: 1 },
ShipPersonality::Point,
o1,
);
//let mut shipbehaviors: Vec<Box<dyn ShipBehavior>> = Vec::new();
//shipbehaviors.push(Box::new(behavior::Dummy::new(h2)));
//shipbehaviors.push(Box::new(behavior::Point::new(h3)));
Game { Game {
last_update: Instant::now(), last_update: Instant::now(),
@ -103,6 +97,7 @@ impl Game {
time_scale: 1.0, time_scale: 1.0,
world: physics, world: physics,
shipbehaviors, shipbehaviors,
gamedata,
content: ct, content: ct,
playerbehavior: behavior::Player::new(h1), playerbehavior: behavior::Player::new(h1),
new_particles: Vec::new(), new_particles: Vec::new(),

View File

@ -1,5 +1,7 @@
use galactica_content as content; use galactica_content as content;
// TODO: remove. projectiles only exist in physics
#[derive(Debug)] #[derive(Debug)]
pub struct Projectile { pub struct Projectile {
pub content: content::Projectile, pub content: content::Projectile,