Skip to content

Commit ad79e78

Browse files
feat: combat, stats, levelling, and inventory (#76)
* feat: basic skeleton groundwork for combat * feat: gracefully logout without causing server errors * fix: display correct monster name on look command * feat: initial working combat systems * fix: enable and fix clippy::cargo warnings * refactor: simplify position and velocity into single struct * refactor: make client naming convention distinct from server * fix: crash when player enters top row * refactor: first pass at clippy pedantic warnings for integer casts * refactor: first pass at clippy pedantic warnings for client and lib * refactor: first pass at clippy pedantic warnings for server * refactor: second pass at clippy pedantic warnings * refactor: third pass at clippy pedantic warnings * refactor: resolve final clippy pedantic warnings * feat: make player HP updates visible to player after combat * feat: add uuid to player_details * refactor: use f32 stats more accurate combat calculations * fix: revert incorrect player str default * refactor: split systems into separate modules * feat: implement player death mechanics * refactor: remove the need for player_position_updates resource * chore: remove todo comments * feat: implement monster deaths * feat: implement sending combat system messages to players * feat: implement sending combat system messages to players * docs: update readme to reflect combat feature * feat: implement monsters attacking players * feat: implement monster respawn mechanics * fix: skip combat checks if either attacker/defender already dead * feat: implement health regen every second server tick * feat: make player attacks only happen on server tick * refactor: change look command to l key * docs: clarify controls * chore: clarify attack miss message * refactor: move exp and lvl to stats * feat: implement exp gain on killing enemy * fix: only give exp on monster deaths, not players * feat: implement levelling up and stat gains * chore: change clippy lint checks * fix: new max hp should be rounded * feat: implement inventory system structs * feat: implement inventory system * fix: make resizing the client window more robust * feat: dynamically resize viewport based on window resize * docs: clarified comment * feat: gain gold from killing monsters * refactor: tweak side status bar layout * refactor: create network message system * refactor: tweak side status bar text * fix: gain gold from multiple monsters * feat: added trinket item type * refactor: move entity update messages to broadcast system * fix: player walking on item * refactor: minimise broadcast size to minimum required * fix: remove dead monsters from player display * fix: send entity broadcasts individually so max packet size is not exceeded * feat: add item ids * fix: look underneath now works * docs: added CHANGELOG.md * docs: add more details to README.md * chore: update dependencies * feat: implement pickup command with some bugs * docs: updated CHANGELOG.md * fix: duplicate items being added to world * fix: item disappears correctly from client viewport when picked up * chore: add local startup script to .gitignore * feat: new default maps and spawns * feat: add drop item functionality * docs: clarified description * docs: clarified description * docs: clarified description * docs: clarified description
1 parent 59ced75 commit ad79e78

Some content is hidden

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

85 files changed

+3576
-1291
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,7 @@ out/
2222
.Spotlight-V100
2323
.Trashes
2424
ehthumbs.db
25-
Thumbs.db
25+
Thumbs.db
26+
27+
# Local startup script
28+
start.bat

CHANGELOG.md

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# Changelog
2+
All notable changes to this project will be documented in this file.
3+
4+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6+
7+
## [Unreleased]
8+
9+
## [v0.3.0]
10+
The combat, stats, levelling, and inventory update!
11+
### 🚀 Features and Improvements
12+
- PvE combat with monsters
13+
- PvP combat with players
14+
- player stats now actually used:
15+
- str increases damage
16+
- dex increases accuracy
17+
- con increases health and regen rate
18+
- player sidebar now displays and updates values in realtime
19+
- death and respawning for players and monsters
20+
- exp gain, levelling up, and stat gains
21+
- inventory system
22+
- picking up items
23+
- dropping items
24+
- default weapons and armour (used in combat calculations)
25+
- system messages and combat notifications displayed in bottom of client window
26+
- look command changed to L key
27+
- client window can now be dynamically resized
28+
- a slightly larger default map with more variety
29+
30+
### 🐛 Bug Fixes
31+
- gracefully logout without causing server errors (only if you use ctrl-q)
32+
- look command now displays monster name correctly
33+
- look command now shows underneath items in all situations
34+
- no longer crashes when player enters top row of map
35+
36+
### 🧰 Maintenance
37+
- clippy::cargo and clippy::pedantic warnings resolved
38+
- network code efficiency improved (no more MaxPacketSize issues)
39+
- CHANGELOG.md added
40+
- dependencies updated
41+
- link time optimisations enabled for release build
42+
- a lot of code refactoring and tidying
43+
44+
## [v0.2.2] - 2022-07-13
45+
### 🚀 Features and Improvements
46+
- enable large map data
47+
48+
### 🧰 Maintenance
49+
- updated dependencies
50+
- refactoring and tidying of messaging code
51+
52+
## [v0.2.1] - 2021-11-21
53+
### 🧰 Maintenance
54+
- updated dependencies
55+
- updated rust edition to 2021
56+
57+
## [v0.2.0] - 2021-02-27
58+
The monsters update!
59+
### 🚀 Features and Improvements
60+
- initial implementation of monsters
61+
- ability to load monsters and spawns from .json assets
62+
- player and monster stats
63+
- stat window and map location display
64+
- implemented look command
65+
66+
### 🐛 Bug Fixes
67+
- fixed bug with logged out player being collidable
68+
69+
### 🧰 Maintenance
70+
- updated dependencies
71+
- updated logo
72+
73+
## [v0.1.1] - 2021-02-17
74+
### 🚀 Features and Improvements
75+
- support multiple players
76+
- connectivity improvements
77+
- added --debug logging switch
78+
- implement player rejoin & check if player exists
79+
- bind to 0.0.0.0 by default for simplicity
80+
- implemented collisions between player entities
81+
- added DisplayDetails to entity updates
82+
83+
### 🧰 Maintenance
84+
- better exception handling
85+
- updated some dependencies
86+
- refactored method locations into appropriate modules
87+
- limited pub methods to pub(crate)
88+
89+
## [v0.1.0] - 2021-02-12
90+
### 🚀 Features and Improvements
91+
- implemented client/server
92+
93+
## [v0.1.0-alpha.3] - 2021-02-07
94+
### 🚀 Features and Improvements
95+
- use release-drafter.yml
96+
97+
## [v0.1.0-alpha.2] - 2021-02-05
98+
### 🚀 Features and Improvements
99+
- ability to load a map from a file
100+
101+
## [v0.1.0-alpha.1] - 2021-02-03
102+
### 🚀 Features and Improvements
103+
- first version of working code
104+
105+
[Unreleased]: https://github.com/pbellchambers/rustyhack-mmo/compare/v0.3.0...HEAD
106+
[v0.3.0]: https://github.com/pbellchambers/rustyhack-mmo/compare/v0.2.2...v0.3.0
107+
[v0.2.2]: https://github.com/pbellchambers/rustyhack-mmo/compare/v0.2.1...v0.2.2
108+
[v0.2.1]: https://github.com/pbellchambers/rustyhack-mmo/compare/v0.2.0...v0.2.1
109+
[v0.2.0]: https://github.com/pbellchambers/rustyhack-mmo/compare/v0.1.1...v0.2.0
110+
[v0.1.1]: https://github.com/pbellchambers/rustyhack-mmo/compare/v0.1.0...v0.1.1
111+
[v0.1.0]: https://github.com/pbellchambers/rustyhack-mmo/compare/v0.1.0-alpha.3...v0.1.0
112+
[v0.1.0-alpha.3]: https://github.com/pbellchambers/rustyhack-mmo/compare/v0.1.0-alpha.2...v0.1.0-alpha.3
113+
[v0.1.0-alpha.2]: https://github.com/pbellchambers/rustyhack-mmo/compare/v0.1.0-alpha.1...v0.1.0-alpha.2
114+
[v0.1.0-alpha.1]: https://github.com/pbellchambers/rustyhack-mmo/releases/tag/v0.1.0-alpha.1

Cargo.lock

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

Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,7 @@ members = [
33
"rustyhack_client",
44
"rustyhack_lib",
55
"rustyhack_server",
6-
]
6+
]
7+
8+
[profile.release]
9+
lto = true

README.md

Lines changed: 17 additions & 3 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+
A barebones cross between an ASCII "roguelike" and MMORPG / MUD written in Rust. Lacking a lot of basic features. Currently has a client & server console program that allows a player to be created, move around, fight other players/monsters, pick up and drop things, look at things, and level up.
55

66
[![Build status](https://img.shields.io/github/workflow/status/pbellchambers/rustyhack-mmo/CI/main)](https://github.com/pbellchambers/rustyhack-mmo/actions)
77
[![Downloads](https://img.shields.io/github/downloads/pbellchambers/rustyhack-mmo/total)](https://github.com/pbellchambers/rustyhack-mmo/releases)
@@ -13,11 +13,25 @@ Partly a sandbox for me learning rust, partly an ASCII "roguelike" MMORPG. Lacki
1313
2. Unzip
1414
3. Run `rustyhack_server` from the command line
1515
4. Run `rustyhack_client` from the command line
16-
5. Connect client to server
16+
5. Connect client to server *(note: if you're running both locally, just accept the default address/ports and it will auto-configure)*
1717

18-
Use arrow keys to move around, spacebar to look, ctrl-q to quit.
18+
## Controls
19+
- Movement: ← ↑ → ↓ Arrow keys
20+
- Combat: Move into enemy
21+
- Commands:
22+
- L - Look around you
23+
- P - Pick up item underneath you
24+
- D - Drop item
25+
- Quit: Ctrl-q
1926

2027
## Components
2128
- **rustyhack_client** - contains all the client code
2229
- **rustyhack_server** - contains all the server code
2330
- **rustyhack_lib** - contains modules that are shared between both client and server
31+
- **assets** - assets required for the server to run, note: assets directory must be in the same location as `rustyhack_server`
32+
33+
## Assets
34+
Currently the following functionality is defined entirely by text or json files located in the `assets` directory:
35+
- **maps** - *.map plain-text* - Map definitions. All maps should be enclosed by a boundary of # characters in any shape, and end with a % character on the last line. See existing examples.
36+
- **monsters** - *.json* - Types of monsters, their stats and inventory etc.
37+
- **spawns** - *.json* - Spawn locations of monsters. There should be one spawn file per map.

assets/logo/rustyhack-logo.png

9.89 KB
Loading
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
##########################
2+
# v#
23
# #
4+
#----- ^ -----#
35
# #
4-
# ^ #
6+
#----- -----#
7+
# #
8+
#----- -----#
59
# #
610
##########################%

assets/maps/Home.map

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,37 @@
1-
#####################################################################################################
2-
# |--------| |--------| | #
3-
#* | , | | | | #
1+
#############################
2+
########### |------------------| ################
3+
##### | | ###############
4+
## | | ########
5+
## |--| |--/------------/--| | ####
6+
## |v / * | ##
7+
# |--| ##
8+
# | |-------| #
9+
# |--------| |--------| * | | #
10+
#* | , | | | | |---+---| #
411
# | | | | | #
512
# |---/----| |------/-| | #
6-
# | #
7-
# |--/-----| * | #
8-
# | | | #
13+
# #
14+
# |--/-----| * #
15+
# | | #
916
# | | ----#
1017
# |--------| #
1118
# * #
12-
# #
13-
# * |-------| #
14-
# | | #
15-
# |---+---| #
16-
# #
17-
# #
18-
# #
19-
# * #
20-
# #
21-
# #
22-
# #
23-
# #
24-
############################################ #########################
25-
# * * * #
26-
# #
27-
# #
28-
# * |-/--| * #
29-
# | v| #
19+
# #
20+
# * #
21+
# * #
22+
# #
23+
#-------------------------| #
24+
# * * * * *| ##
25+
# |--| * * *| #
26+
# |--| |------| | ##
27+
# |* / #
28+
# |--| |------| #
29+
# v|--| * * *| ####
30+
# * * * * *| ###
31+
########################### #
32+
## ###
33+
## * #
34+
### ##
35+
#### #
36+
##### ##
3037
##########################%

0 commit comments

Comments
 (0)