Skip to content

Commit

Permalink
Merge pull request #87 from Stars-Beyond/Smaple-updates
Browse files Browse the repository at this point in the history
Updated sample subsystem and docker compose file
  • Loading branch information
tristanpoland authored Jul 19, 2024
2 parents c72f34f + d4452b5 commit 50e45ff
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 26 deletions.
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
docker build -t Astroverse-Studios/horizon .
docker build -t Far-Beyond/horizon .
31 changes: 26 additions & 5 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
version: '3'
services:
horizon-game-server:
build:
context: .
dockerfile: Dockerfile.rust
ports:
- 3000:3000
- 3001:3001
- "3000:3000"
- "3001:3001"
environment:
- RUST_LOG=info
networks:
- horizon-network

horizon-memory-db:
build:
Expand All @@ -16,7 +19,14 @@ services:
depends_on:
- horizon-game-server
ports:
- 3003:3003
- "3003:3003"
environment:
- DB_USER=admin
- DB_PASSWORD=secret
volumes:
- memory-db-data:/var/lib/horizon-memory-db
networks:
- horizon-network

horizon-physics-engine:
build:
Expand All @@ -26,4 +36,15 @@ services:
depends_on:
- horizon-memory-db
ports:
- 3002:3002
- "3002:3002"
environment:
- PYTHONUNBUFFERED=1
networks:
- horizon-network

volumes:
memory-db-data:

networks:
horizon-network:
driver: bridge
8 changes: 3 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,13 @@ fn on_connect(socket: SocketRef, Data(data): Data<Value>, players: Arc<Mutex<Vec
/////////////////////////////////////////////////////////

//subsystems::actors::main::main();

// subsystems::core::chat::init(socket.clone());
// subsystems::core::leaderboard::init();
// subsystems::player_data::init(socket.clone());
subsystems::core::game_logic::init();
subsystems::core::chat::init(socket.clone());
subsystems::core::leaderboard::init();
subsystems::core::level_data::init();
subsystems::core::logging::init();
subsystems::core::notifications::init();

// subsystems::player_data::init(socket.clone());

////////////////////////////////////////////////////////
// Register some additional custom events with our //
Expand Down
3 changes: 2 additions & 1 deletion src/subsystems/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@

// pub mod auth; Auth is not yet being used as it needs to be a more flexible
//pub mod actors;
pub mod core;
pub mod core;
pub mod sample_sybsystem;
14 changes: 0 additions & 14 deletions src/subsystems/sample-subsystem/src/lib.rs

This file was deleted.

File renamed without changes.
5 changes: 5 additions & 0 deletions src/subsystems/sample_sybsystem/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Register Custom Events

// pub mod auth; Auth is not yet being used as it needs to be a more flexible
// pub mod actors;
pub mod src;
25 changes: 25 additions & 0 deletions src/subsystems/sample_sybsystem/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
use socketioxide::extract::{SocketRef, Data};

pub fn init(socket: SocketRef) {
println!("A new client with ID {} has joined the game!", socket.id.to_string());
}


////////////////////////////////////////////
// BELOW THIS IS THE DEFAULT EXAMPLE CODE //
////////////////////////////////////////////

pub fn add(left: usize, right: usize) -> usize {
left + right
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}
1 change: 1 addition & 0 deletions src/subsystems/sample_sybsystem/src/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod lib;

0 comments on commit 50e45ff

Please sign in to comment.