Crate rusty_sword_arena[−][src]
💡 Did You Know? You can generate your own, offline version of this document by running this command in your own clone of the repository.
cargo doc --lib --no-deps --open
Other Tutorial References
- Git repository for Rusty Sword Arena repository.
- How To Learn Rust - a handy reference.
Rusty Sword Arena - Game Design
Rusty Sword Arena is a networked, 2D, top-down, arena combat game. A server implementation and shared library is provided. Your task is to implement a game client in Rust using the provided shared library and the game design details below.
Note that while significant effort has been put into making the server robust and unlikely to crash, there has consciously been very little effort towards security, or pretty much any proper game engine architecture. In other words, this is a great way to learn Rust and have some fun at the same time, but this in no way pretends to be a substitute for a real game engine™. 😉
The basic idea of the game is you are presented with the top-down view of a person (circle) in an arena (your window) who can swing his weapon (probably a rusty sword) around a certain distance (a larger [concentric] circle than the person himself). You can face any direction you like, in fact turning is instant as far as the server is concerned. You can move in any direction (which is not instant) and attempt to attack other players with your sword which may hit or miss, or you may try to parry, which if successful greatly increases the timeout for the attacking player's next attack or parry.
You start with some health. When you are hit, you lose health. When you successfully parry a hit, you do not lose health. When the health runs out, you die. After a respawn delay, you respawn with full health. If you do not fight, you are likely to be eaten by a grue.
Preparation
First, you should follow the instructions on the readme to install some prerequisites. Then come back here and keep going.
Basics
- You need to pick a name for your client and create a Rust crate. Hint: use
cargo
- You need to list
rusty_sword_arena
as a dependency in yourCargo.toml
file.
Game Client Responsibilities
- Obtain the player's desired
name
and thehost
to connect to. - Create a ServerConnection using the
host
- Using the server connection, send a GameControlMsg to join the game and save the GameSetting you get back.
- Determine your player's id and save it
- ...
Modules
game |
Everything in the game module is shared by the server and the client |
gfx |
The graphics module that will be used by your client |
net |
The networking module that will be used by your client |
timer |
A timer module for general use |
Constants
VERSION |
The current version number. Your client should check this against the version the server sends in GameSettings |