Skip to content

Commit fecbf3b

Browse files
feat: initial implementation of monsters and stats (#14)
*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
1 parent 17f0e12 commit fecbf3b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1350
-278
lines changed

Cargo.lock

Lines changed: 155 additions & 91 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
![Rustyhack Logo](https://github.com/pbellchambers/rustyhack-mmo/raw/main/assets/logo/rustyhack-logo.png "Rustyhack Logo")
22

33
# Rustyhack MMO
4-
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.
4+
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.
55

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

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

2020
## Components
2121
- **rustyhack_client** - contains all the client code

assets/logo/rustyhack-logo.png

4.7 KB
Loading

assets/maps/Cave.map

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
##########################
2+
# #
3+
# #
4+
# ^ #
5+
# #
6+
##########################%

assets/maps/Home.map

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#####################################################################################################
2+
# |--------| |--------| | #
3+
#* | , | | | | #
4+
# | | | | | #
5+
# |---/----| |------/-| | #
6+
# | #
7+
# |--/-----| * | #
8+
# | | | #
9+
# | | ----#
10+
# |--------| #
11+
# * #
12+
# #
13+
# * |-------| #
14+
# | | #
15+
# |---+---| #
16+
# #
17+
# #
18+
# #
19+
# * #
20+
# #
21+
# #
22+
# #
23+
# #
24+
############################################ #########################
25+
# * * * #
26+
# #
27+
# #
28+
# * |-/--| * #
29+
# | v| #
30+
##########################%

assets/maps/default.txt

Lines changed: 0 additions & 31 deletions
This file was deleted.

assets/monsters/Rat.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"monster_details": {
3+
"id": "00000000-0000-0000-0000-000000000000",
4+
"monster_type": "Rat",
5+
"spawn_position": {
6+
"x": 0,
7+
"y": 0,
8+
"map": "none"
9+
},
10+
"is_active": false,
11+
"current_target": null,
12+
"exp": 5,
13+
"gold": 1
14+
},
15+
"display_details": {
16+
"icon": "r",
17+
"colour": "Grey",
18+
"visible": true,
19+
"collidable": true
20+
},
21+
"position": {
22+
"x": 0,
23+
"y": 0,
24+
"map": "none"
25+
},
26+
"velocity": {
27+
"x": 0,
28+
"y": 0
29+
},
30+
"stats": {
31+
"current_hp": 10,
32+
"max_hp": 10,
33+
"str": 2,
34+
"dex": 20,
35+
"con": 5,
36+
"armour": 1
37+
}
38+
}

assets/monsters/Snake.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"monster_details": {
3+
"id": "00000000-0000-0000-0000-000000000000",
4+
"monster_type": "Snake",
5+
"spawn_position": {
6+
"x": 0,
7+
"y": 0,
8+
"map": "none"
9+
},
10+
"is_active": false,
11+
"current_target": null,
12+
"exp": 7,
13+
"gold": 2
14+
},
15+
"display_details": {
16+
"icon": "s",
17+
"colour": "DarkGreen",
18+
"visible": true,
19+
"collidable": true
20+
},
21+
"position": {
22+
"x": 0,
23+
"y": 0,
24+
"map": "none"
25+
},
26+
"velocity": {
27+
"x": 0,
28+
"y": 0
29+
},
30+
"stats": {
31+
"current_hp": 20,
32+
"max_hp": 20,
33+
"str": 10,
34+
"dex": 15,
35+
"con": 5,
36+
"armour": 5
37+
}
38+
}

assets/monsters/Zombie.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"monster_details": {
3+
"id": "00000000-0000-0000-0000-000000000000",
4+
"monster_type": "Zombie",
5+
"spawn_position": {
6+
"x": 0,
7+
"y": 0,
8+
"map": "none"
9+
},
10+
"is_active": false,
11+
"current_target": null,
12+
"exp": 20,
13+
"gold": 5
14+
},
15+
"display_details": {
16+
"icon": "z",
17+
"colour": "Grey",
18+
"visible": true,
19+
"collidable": true
20+
},
21+
"position": {
22+
"x": 0,
23+
"y": 0,
24+
"map": "none"
25+
},
26+
"velocity": {
27+
"x": 0,
28+
"y": 0
29+
},
30+
"stats": {
31+
"current_hp": 50,
32+
"max_hp": 50,
33+
"str": 15,
34+
"dex": 5,
35+
"con": 20,
36+
"armour": 15
37+
}
38+
}

assets/spawns/Cave.spawn.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"monsters": [
3+
{
4+
"monster_type": "Rat",
5+
"spawn_positions": [
6+
{
7+
"x": 5,
8+
"y": 2
9+
}
10+
]
11+
}
12+
]
13+
}

assets/spawns/Home.spawn.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"monsters": [
3+
{
4+
"monster_type": "Snake",
5+
"spawn_positions": [
6+
{
7+
"x": 88,
8+
"y": 3
9+
},
10+
{
11+
"x": 96,
12+
"y": 5
13+
}
14+
]
15+
},
16+
{
17+
"monster_type": "Zombie",
18+
"spawn_positions": [
19+
{
20+
"x": 50,
21+
"y": 27
22+
},
23+
{
24+
"x": 65,
25+
"y": 27
26+
}
27+
]
28+
}
29+
]
30+
}

rustyhack_client/Cargo.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rustyhack_client"
3-
version = "0.1.1"
3+
version = "0.2.0"
44
authors = ["pbellchambers <pbellchambers@users.noreply.github.com>"]
55
edition = "2018"
66
repository = "https://github.com/pbellchambers/rustyhack-mmo"
@@ -16,6 +16,7 @@ console_engine = "1.5.0"
1616
crossterm = { version = "0.19.0", features = ["serde"] }
1717
laminar = "0.4.0"
1818
crossbeam-channel = "0.4.4"
19-
serde = "1.0.123"
19+
serde = { version = "1.0.123", features = ["derive"] }
2020
bincode = "1.3.1"
21-
regex = "1.4.3"
21+
regex = "1.4.3"
22+
chrono = "0.4.19"

rustyhack_client/src/consts.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
pub(crate) const VIEWPORT_WIDTH: u32 = 41;
2-
pub(crate) const VIEWPORT_HEIGHT: u32 = 15;
1+
pub(crate) const CONSOLE_WIDTH: u32 = 71;
2+
pub(crate) const CONSOLE_HEIGHT: u32 = 31;
3+
pub(crate) const VIEWPORT_WIDTH: u32 = 51;
4+
pub(crate) const VIEWPORT_HEIGHT: u32 = 19;
35
pub(crate) const TARGET_FPS: u32 = 10;
46
pub(crate) const LOG_NAME: &str = "rustyhack_client.log";
57
pub(crate) const GAME_TITLE: &str = "Rustyhack MMO";

0 commit comments

Comments
 (0)