-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
115 changed files
with
3,779 additions
and
1,202 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
/target | ||
*/target/ | ||
**/*.rs.bk | ||
Cargo.lock | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,24 +3,10 @@ name = "westiny" | |
version = "0.1.0" | ||
authors = ["Domonkos Suranyi <[email protected]>"] | ||
edition = "2018" | ||
readme = "README.md" | ||
license-file = "LICENSE" | ||
|
||
[dependencies] | ||
amethyst = "0.15.3" | ||
amethyst_test = "0.15.3" | ||
array-init = "1.0.0" | ||
log = "0.4.11" | ||
serde = "1.0.120" | ||
bincode = "1.3.1" | ||
derive-new = "0.5.8" | ||
ron = "0.6.4" | ||
|
||
[features] | ||
default = ["vulkan", "tiles"] | ||
empty = ["amethyst/empty"] | ||
metal = ["amethyst/metal"] | ||
vulkan = ["amethyst/vulkan"] | ||
tiles = ["amethyst/tiles"] | ||
|
||
[[bin]] | ||
name = "westiny_server" | ||
path = "src/server.rs" | ||
[workspace] | ||
members = [ ".", "server", "common", "client"] | ||
# Add everything to default-members as well, e.g. cargo test will execute them as well. | ||
default-members = [ ".", "server", "common", "client"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,21 @@ | ||
 | ||
# westiny | ||
This is a top-down sandbox game. | ||
This is a topview sandbox game. | ||
The game is written fully in rust. | ||
|
||
## usage | ||
Run server: | ||
|
||
### server | ||
Run: | ||
`cargo run --release --bin westiny_server` | ||
|
||
Run client: | ||
`cargo run --release --bin westiny` | ||
### client | ||
Specify server address on client: | ||
`export WESTINY_SERVER_ADDRESS=1.2.3.4:5745` | ||
|
||
Run: | ||
`cargo run --release --bin westiny_client` | ||
|
||
Or a one-liner: | ||
`WESTINY_SERVER_ADDRESS=1.2.3.4:5745 cargo run --release --bin westiny_client` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[package] | ||
name = "westiny_client" | ||
version = "0.1.0" | ||
authors = ["Abel Suranyi"] | ||
edition = "2018" | ||
|
||
[dependencies] | ||
westiny_common = { path = "../common" } | ||
amethyst = "0.15.3" | ||
amethyst_test = "0.15.3" | ||
serde = "1.0.120" | ||
anyhow = "1.0.38" | ||
derive-new = "0.5.9" | ||
log = "0.4.14" | ||
|
||
[features] | ||
default = ["vulkan", "tiles"] | ||
empty = ["amethyst/empty"] | ||
metal = ["amethyst/metal"] | ||
vulkan = ["amethyst/vulkan"] | ||
tiles = ["amethyst/tiles"] |
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
resources/client_network.ron → client/assets/client_network.ron
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
ClientPort( | ||
4557 | ||
0 | ||
) |
File renamed without changes.
Binary file not shown.
File renamed without changes.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,6 +50,13 @@ List(( | |
y: 16, | ||
width: 16, | ||
height: 16, | ||
) | ||
), | ||
// 7: corpse | ||
( | ||
x: 33, | ||
y: 16, | ||
width: 16, | ||
height: 16, | ||
), | ||
], | ||
)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
use std::fmt; | ||
|
||
use ::serde::{Deserialize, Serialize}; | ||
use amethyst::input::BindingTypes; | ||
|
||
#[derive(Clone, Debug, Hash, PartialEq, Eq, Serialize, Deserialize)] | ||
pub enum ActionBinding { | ||
Forward, | ||
Backward, | ||
StrafeLeft, | ||
StrafeRight, | ||
Shoot, | ||
Use, | ||
} | ||
|
||
#[derive(Clone, Debug, Hash, PartialEq, Eq, Serialize, Deserialize)] | ||
pub enum AxisBinding { | ||
Zoom | ||
} | ||
|
||
impl fmt::Display for ActionBinding { | ||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | ||
write!(f, "{:?}", self) | ||
} | ||
} | ||
|
||
impl fmt::Display for AxisBinding { | ||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | ||
write!(f, "{:?}", self) | ||
} | ||
} | ||
|
||
|
||
#[derive(Debug)] | ||
pub struct MovementBindingTypes; | ||
|
||
impl BindingTypes for MovementBindingTypes { | ||
type Axis = AxisBinding; | ||
type Action = ActionBinding; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
pub use player::initialize_player; | ||
pub use tilemap::initialize_tilemap; | ||
pub use bullet::spawn_bullet; | ||
|
||
mod player; | ||
mod tilemap; | ||
mod bullet; | ||
mod tilemap; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use amethyst::core::math::Point2; | ||
use amethyst::core::Transform; | ||
use amethyst::prelude::*; | ||
use log::info; | ||
|
||
use westiny_common::components::{Input, Health, Player, NetworkId}; | ||
use crate::resources::SpriteResource; | ||
use westiny_common::resources::SpriteId; | ||
|
||
pub fn initialize_player<B: Builder>(builder: B, | ||
sprite_resource: &SpriteResource, | ||
network_id: NetworkId, | ||
start_pos: Point2<f32> | ||
) { | ||
|
||
let mut transform = Transform::default(); | ||
transform.set_translation_xyz(start_pos.x, start_pos.y, 0.0); | ||
|
||
builder | ||
.with(network_id) | ||
.with(sprite_resource.sprite_render_for(SpriteId::Player)) | ||
.with(transform) | ||
.with(Player) | ||
.with(Health(100)) | ||
.with(Input::default()) | ||
.build(); | ||
|
||
info!("Player created."); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,25 @@ | ||
|
||
use amethyst::prelude::*; | ||
use amethyst::ecs::World; | ||
use amethyst::assets::Loader; | ||
use amethyst::audio::{SourceHandle, OggFormat}; | ||
|
||
pub struct Sounds | ||
{ | ||
pub single_shot: SourceHandle | ||
} | ||
pub handles: [SourceHandle; 1], | ||
|
||
} | ||
|
||
pub fn initialize_audio(world: &mut World) | ||
{ | ||
let sounds = { | ||
let loader = world.read_resource::<Loader>(); | ||
Sounds { single_shot: loader.load("audio/shot.ogg", OggFormat, (), &world.read_resource()) } | ||
Sounds { | ||
handles: [ | ||
loader.load("audio/shot.ogg", OggFormat, (), &world.read_resource()) | ||
] | ||
} | ||
}; | ||
|
||
world.insert(sounds); | ||
} | ||
|
File renamed without changes.
Oops, something went wrong.