Skip to content

Commit

Permalink
feat: initial implementation of monsters and stats (#14)
Browse files Browse the repository at this point in the history
*feat: initial implementation of monsters

*feat: ability to load monsters and spawns from .json assets

*feat: player and monster stats

*feat: stat window and map location display

*feat: implemented look command

*fix: fixed bug with logged out player being collidable

*chore: updated dependencies

*chore: updated logo
  • Loading branch information
pbellchambers authored Feb 27, 2021
1 parent 17f0e12 commit fecbf3b
Show file tree
Hide file tree
Showing 45 changed files with 1,350 additions and 278 deletions.
246 changes: 155 additions & 91 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
![Rustyhack Logo](https://github.com/pbellchambers/rustyhack-mmo/raw/main/assets/logo/rustyhack-logo.png "Rustyhack Logo")

# Rustyhack MMO
Partly a sandbox for me learning rust, partly an ASCII "roguelike" MMORPG. Lacking a lot of basic features. Currently produces a client & server console program that allows a player to be created and move around a map with arrow keys.
Partly a sandbox for me learning rust, partly an ASCII "roguelike" MMORPG. Lacking a lot of basic features. Currently produces a client & server console program that allows a player to be created, and move around a map with arrow keys.

[![Build status](https://img.shields.io/github/workflow/status/pbellchambers/rustybox/CI/main)](https://github.com/pbellchambers/rustybox/actions)
[![Downloads](https://img.shields.io/github/downloads/pbellchambers/rustybox/total)](https://github.com/pbellchambers/rustybox/releases)
Expand All @@ -15,7 +15,7 @@ Partly a sandbox for me learning rust, partly an ASCII "roguelike" MMORPG. Lacki
4. Run `rustyhack_client` from the command line
5. Connect client to server

Use arrow keys to move around, ctrl-q to quit.
Use arrow keys to move around, spacebar to look, ctrl-q to quit.

## Components
- **rustyhack_client** - contains all the client code
Expand Down
Binary file modified assets/logo/rustyhack-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions assets/maps/Cave.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
##########################
# #
# #
# ^ #
# #
##########################%
30 changes: 30 additions & 0 deletions assets/maps/Home.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#####################################################################################################
# |--------| |--------| | #
#* | , | | | | #
# | | | | | #
# |---/----| |------/-| | #
# | #
# |--/-----| * | #
# | | | #
# | | ----#
# |--------| #
# * #
# #
# * |-------| #
# | | #
# |---+---| #
# #
# #
# #
# * #
# #
# #
# #
# #
############################################ #########################
# * * * #
# #
# #
# * |-/--| * #
# | v| #
##########################%
31 changes: 0 additions & 31 deletions assets/maps/default.txt

This file was deleted.

38 changes: 38 additions & 0 deletions assets/monsters/Rat.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"monster_details": {
"id": "00000000-0000-0000-0000-000000000000",
"monster_type": "Rat",
"spawn_position": {
"x": 0,
"y": 0,
"map": "none"
},
"is_active": false,
"current_target": null,
"exp": 5,
"gold": 1
},
"display_details": {
"icon": "r",
"colour": "Grey",
"visible": true,
"collidable": true
},
"position": {
"x": 0,
"y": 0,
"map": "none"
},
"velocity": {
"x": 0,
"y": 0
},
"stats": {
"current_hp": 10,
"max_hp": 10,
"str": 2,
"dex": 20,
"con": 5,
"armour": 1
}
}
38 changes: 38 additions & 0 deletions assets/monsters/Snake.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"monster_details": {
"id": "00000000-0000-0000-0000-000000000000",
"monster_type": "Snake",
"spawn_position": {
"x": 0,
"y": 0,
"map": "none"
},
"is_active": false,
"current_target": null,
"exp": 7,
"gold": 2
},
"display_details": {
"icon": "s",
"colour": "DarkGreen",
"visible": true,
"collidable": true
},
"position": {
"x": 0,
"y": 0,
"map": "none"
},
"velocity": {
"x": 0,
"y": 0
},
"stats": {
"current_hp": 20,
"max_hp": 20,
"str": 10,
"dex": 15,
"con": 5,
"armour": 5
}
}
38 changes: 38 additions & 0 deletions assets/monsters/Zombie.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"monster_details": {
"id": "00000000-0000-0000-0000-000000000000",
"monster_type": "Zombie",
"spawn_position": {
"x": 0,
"y": 0,
"map": "none"
},
"is_active": false,
"current_target": null,
"exp": 20,
"gold": 5
},
"display_details": {
"icon": "z",
"colour": "Grey",
"visible": true,
"collidable": true
},
"position": {
"x": 0,
"y": 0,
"map": "none"
},
"velocity": {
"x": 0,
"y": 0
},
"stats": {
"current_hp": 50,
"max_hp": 50,
"str": 15,
"dex": 5,
"con": 20,
"armour": 15
}
}
13 changes: 13 additions & 0 deletions assets/spawns/Cave.spawn.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"monsters": [
{
"monster_type": "Rat",
"spawn_positions": [
{
"x": 5,
"y": 2
}
]
}
]
}
30 changes: 30 additions & 0 deletions assets/spawns/Home.spawn.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"monsters": [
{
"monster_type": "Snake",
"spawn_positions": [
{
"x": 88,
"y": 3
},
{
"x": 96,
"y": 5
}
]
},
{
"monster_type": "Zombie",
"spawn_positions": [
{
"x": 50,
"y": 27
},
{
"x": 65,
"y": 27
}
]
}
]
}
7 changes: 4 additions & 3 deletions rustyhack_client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rustyhack_client"
version = "0.1.1"
version = "0.2.0"
authors = ["pbellchambers <pbellchambers@users.noreply.github.com>"]
edition = "2018"
repository = "https://github.com/pbellchambers/rustyhack-mmo"
Expand All @@ -16,6 +16,7 @@ console_engine = "1.5.0"
crossterm = { version = "0.19.0", features = ["serde"] }
laminar = "0.4.0"
crossbeam-channel = "0.4.4"
serde = "1.0.123"
serde = { version = "1.0.123", features = ["derive"] }
bincode = "1.3.1"
regex = "1.4.3"
regex = "1.4.3"
chrono = "0.4.19"
6 changes: 4 additions & 2 deletions rustyhack_client/src/consts.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
pub(crate) const VIEWPORT_WIDTH: u32 = 41;
pub(crate) const VIEWPORT_HEIGHT: u32 = 15;
pub(crate) const CONSOLE_WIDTH: u32 = 71;
pub(crate) const CONSOLE_HEIGHT: u32 = 31;
pub(crate) const VIEWPORT_WIDTH: u32 = 51;
pub(crate) const VIEWPORT_HEIGHT: u32 = 19;
pub(crate) const TARGET_FPS: u32 = 10;
pub(crate) const LOG_NAME: &str = "rustyhack_client.log";
pub(crate) const GAME_TITLE: &str = "Rustyhack MMO";
Expand Down
Loading

0 comments on commit fecbf3b

Please sign in to comment.