Skip to content

Commit

Permalink
feat: combat, stats, levelling, and inventory (#76)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
pbellchambers authored Jul 25, 2022
1 parent 59ced75 commit ad79e78
Show file tree
Hide file tree
Showing 85 changed files with 3,576 additions and 1,291 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,7 @@ out/
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
Thumbs.db

# Local startup script
start.bat
114 changes: 114 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [v0.3.0]
The combat, stats, levelling, and inventory update!
### 🚀 Features and Improvements
- PvE combat with monsters
- PvP combat with players
- player stats now actually used:
- str increases damage
- dex increases accuracy
- con increases health and regen rate
- player sidebar now displays and updates values in realtime
- death and respawning for players and monsters
- exp gain, levelling up, and stat gains
- inventory system
- picking up items
- dropping items
- default weapons and armour (used in combat calculations)
- system messages and combat notifications displayed in bottom of client window
- look command changed to L key
- client window can now be dynamically resized
- a slightly larger default map with more variety

### 🐛 Bug Fixes
- gracefully logout without causing server errors (only if you use ctrl-q)
- look command now displays monster name correctly
- look command now shows underneath items in all situations
- no longer crashes when player enters top row of map

### 🧰 Maintenance
- clippy::cargo and clippy::pedantic warnings resolved
- network code efficiency improved (no more MaxPacketSize issues)
- CHANGELOG.md added
- dependencies updated
- link time optimisations enabled for release build
- a lot of code refactoring and tidying

## [v0.2.2] - 2022-07-13
### 🚀 Features and Improvements
- enable large map data

### 🧰 Maintenance
- updated dependencies
- refactoring and tidying of messaging code

## [v0.2.1] - 2021-11-21
### 🧰 Maintenance
- updated dependencies
- updated rust edition to 2021

## [v0.2.0] - 2021-02-27
The monsters update!
### 🚀 Features and Improvements
- initial implementation of monsters
- ability to load monsters and spawns from .json assets
- player and monster stats
- stat window and map location display
- implemented look command

### 🐛 Bug Fixes
- fixed bug with logged out player being collidable

### 🧰 Maintenance
- updated dependencies
- updated logo

## [v0.1.1] - 2021-02-17
### 🚀 Features and Improvements
- support multiple players
- connectivity improvements
- added --debug logging switch
- implement player rejoin & check if player exists
- bind to 0.0.0.0 by default for simplicity
- implemented collisions between player entities
- added DisplayDetails to entity updates

### 🧰 Maintenance
- better exception handling
- updated some dependencies
- refactored method locations into appropriate modules
- limited pub methods to pub(crate)

## [v0.1.0] - 2021-02-12
### 🚀 Features and Improvements
- implemented client/server

## [v0.1.0-alpha.3] - 2021-02-07
### 🚀 Features and Improvements
- use release-drafter.yml

## [v0.1.0-alpha.2] - 2021-02-05
### 🚀 Features and Improvements
- ability to load a map from a file

## [v0.1.0-alpha.1] - 2021-02-03
### 🚀 Features and Improvements
- first version of working code

[Unreleased]: https://github.com/pbellchambers/rustyhack-mmo/compare/v0.3.0...HEAD
[v0.3.0]: https://github.com/pbellchambers/rustyhack-mmo/compare/v0.2.2...v0.3.0
[v0.2.2]: https://github.com/pbellchambers/rustyhack-mmo/compare/v0.2.1...v0.2.2
[v0.2.1]: https://github.com/pbellchambers/rustyhack-mmo/compare/v0.2.0...v0.2.1
[v0.2.0]: https://github.com/pbellchambers/rustyhack-mmo/compare/v0.1.1...v0.2.0
[v0.1.1]: https://github.com/pbellchambers/rustyhack-mmo/compare/v0.1.0...v0.1.1
[v0.1.0]: https://github.com/pbellchambers/rustyhack-mmo/compare/v0.1.0-alpha.3...v0.1.0
[v0.1.0-alpha.3]: https://github.com/pbellchambers/rustyhack-mmo/compare/v0.1.0-alpha.2...v0.1.0-alpha.3
[v0.1.0-alpha.2]: https://github.com/pbellchambers/rustyhack-mmo/compare/v0.1.0-alpha.1...v0.1.0-alpha.2
[v0.1.0-alpha.1]: https://github.com/pbellchambers/rustyhack-mmo/releases/tag/v0.1.0-alpha.1
48 changes: 25 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@ members = [
"rustyhack_client",
"rustyhack_lib",
"rustyhack_server",
]
]

[profile.release]
lto = true
20 changes: 17 additions & 3 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.
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.

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

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

## Components
- **rustyhack_client** - contains all the client code
- **rustyhack_server** - contains all the server code
- **rustyhack_lib** - contains modules that are shared between both client and server
- **assets** - assets required for the server to run, note: assets directory must be in the same location as `rustyhack_server`

## Assets
Currently the following functionality is defined entirely by text or json files located in the `assets` directory:
- **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.
- **monsters** - *.json* - Types of monsters, their stats and inventory etc.
- **spawns** - *.json* - Spawn locations of monsters. There should be one spawn file per map.
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: 5 additions & 1 deletion assets/maps/Cave.map → assets/maps/Crypt.map
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
##########################
# v#
# #
#----- ^ -----#
# #
# ^ #
#----- -----#
# #
#----- -----#
# #
##########################%
55 changes: 31 additions & 24 deletions assets/maps/Home.map
Original file line number Diff line number Diff line change
@@ -1,30 +1,37 @@
#####################################################################################################
# |--------| |--------| | #
#* | , | | | | #
#############################
########### |------------------| ################
##### | | ###############
## | | ########
## |--| |--/------------/--| | ####
## |v / * | ##
# |--| ##
# | |-------| #
# |--------| |--------| * | | #
#* | , | | | | |---+---| #
# | | | | | #
# |---/----| |------/-| | #
# | #
# |--/-----| * | #
# | | | #
# #
# |--/-----| * #
# | | #
# | | ----#
# |--------| #
# * #
# #
# * |-------| #
# | | #
# |---+---| #
# #
# #
# #
# * #
# #
# #
# #
# #
############################################ #########################
# * * * #
# #
# #
# * |-/--| * #
# | v| #
# #
# * #
# * #
# #
#-------------------------| #
# * * * * *| ##
# |--| * * *| #
# |--| |------| | ##
# |* / #
# |--| |------| #
# v|--| * * *| ####
# * * * * *| ###
########################### #
## ###
## * #
### ##
#### #
##### ##
##########################%
Loading

0 comments on commit ad79e78

Please sign in to comment.