Home

Awesome

<div align="center"> <h1>RecWars</h1> <i>Recreational Warfare .rs</i> <br /> A multiplayer top-down tank shooter - a FOSS port of an old Windows game called RecWar to Rust/WASM. </div> <br />

GitHub License (AGPLv3) CI Audit Dependency status Discord

<!-- These keep getting broken and then they show 0 which looks bad, comment out when that happens. -->

Total lines Lines of comments

<!-- Note to my future OCD: The ideal image width for a github readme is ~838~ 830 pixels. Inspect in firefox and look at Box Model on the Layout tab (value confirmed in gimp). The recommended size for the social preview is higher, likely best to use a different image. --> <!-- Check https://github.com/topics/multiplayer-browser-game to make sure it doesnẗ look blurry. -->

Gameplay

Play in the Browser | Play splitscreen in the Browser | Join our Discord

RecWars is a free and open source clone of RecWar, a singleplayer and multiplayer tank shooter. You control a tank, hovercraft or hummer and fight other vehicles in one of three game modes using an arsenal of eight distinct weapons. You can play against bots, in splitscreen and over the network.

RecWars aims to have gameplay similar, but not identical, to RecWar. RecWar was balanced for playing against bots and might result in annoying strats being the most effective when people start playing to win, RecWars will make changes where needed to provide a more enjoyable multiplayer experience. However, almost everything in RecWars is configurable and you can switch to the original RecWar balance to compare.

Currently this is very much a work-in-progress: the driving physics don't feel right, there are no collisions between vehicles, bots move randomly ...

RecWars is developed in lockstep with RustCycles. Even though they are very different, built on different engines, they share the general architecture. Ideas are tested in one game, then ported to the other.

The ultimate goal is to create a fully moddable multiplayer game playable in the browser and natively on Linux, Windows and macOS. RecWars is built in the spirit of everlasting games.

Features

See Todo.md for details.

How to Play

The browser version is hosted here.

Splitscreen is hosted here.

Compiling and Running Locally

Build Dependencies

Install Macroquad's dependencies.

Native version

You can set cvars on the command line - e.g.:

Browser version

Contributing

You can always find me on the Rusty Games Discord server if you have any questions or suggestions or if you just wanna see a game slowly develop from a small prototype to being playable and enjoyable by real people.

Issues and Pull Requests are welcome, I will try to look at them as soon as possible.

I want to make RecWars highly configurable with many different gamemodes and balance settings votable by players and anybody will be able to host their own server. RecWars aims to blur the line between a game and a genre-specific game engine. Vehicles, weapons, AI, game modes, etc. will be completely configurable. If you have a gameplay idea and don't suffer from the NIH syndrome, I'd be very happy to work together and test it in RecWars.

Tips (Optional)

Enable extra checks before every commit: copy/symlink pre-commit-example to pre-commit and run git config core.hooksPath git-hooks. It gets checked on CI anyway, this just catches issues faster.

Enable fast builds - see .cargo/config-example.toml for details.

Architecture Overview

Most of the code is commented to be understandable by anyone with a basic understanding of how a game works (there's a main loop, gamelogic and rendering run is steps called frames). If it's not clear why a particular piece of code exists or why it needs to be written the way it is, I consider that a bug which should be fixed by either rewriting the code more clearly or adding comments explaining it.

Currently, most game state is managed by generational arenas from the thunderdome crate to make the code type-safe and readable. Previously, RecWars used the legion ECS. However it was cumbersome to use and WASM didn't get any benefits from parallelism. The only reason I was using ECS was so I could have references between entities and for this I was paying by having all entities dynamicly typed which lead to bugs. It's a Rust tradition to start writing a game and end up writing a game engine or ECS so I am considering creating an ECS crate that would satisfy my standards of clean API and static typing. For now arenas seem to be close enough.

The code is currently all in a single crate. It used to be split into a lib (gamelogic) and bin (rendering) but this builds faster.

Cvars

Cvars are console variables - configuration settings which control everything in the game like physics, weapon behavior, AI, HUD layout, etc.

They use the cvars crate - an alternative to inline_tweak & friends. There's a built-in console from the cvars-console-macroquad crate.

Changing cvars

The desktop version also accepts them on the command line. Some cvars like g_map or d_seed currently only take effect this way because they need to be set before match start.

The entire list of cvars is in src/cvars.rs.

The Original Game

RecWar by Willem Janssen:

The original RecWar only contains a Windows .exe but runs ok-ish under wine on Linux (sometimes freezes on map load). It includes a map editor. The binaries in both archive.org links are identical to what I got on an old CD so should be safe.

RecWars vs RecWar differences

RecWar would probably be impossible to replicate exactly without decompiling the binary (which doesn't even contain debug symbols), though if a fan of the original finds this project, I am not gonna stop them from trying.

Additionally, when playing against people instead of bots, I suspect RecWar's original balance would lead to annoying and boring strats like making the cow inaccessible with mines or just simple camping. For example, experience from poorly designed games shows large areas will be dominated by instant-hit weapons (in RecWar the railgun) and there might simply be no way to get across the map alive. Therefore I made the railgun a very fast projectile in RecWars. I might make more balance changes based on how the online gameplay evolves.

For those reasons, RecWars will have a slightly different balance than RecWar. I will try to keep them as similar as possible but some things like physics will never be exact and I will make changes where I see fit to make the gameplay more interesting.

Intentional differences (can be toggled by switching the balance):

Unintentional differences - I will make best effort here but some things won't be exact:

Maps

Currently the map is picked randomly by default, however, in the desktop version you can choose it manually on the command line.

Lessons Learned

Read this to learn from other people's mistakes and save yourself some time.

License

<!-- If updating this, also update LICENSE and Cargo.toml -->

All code is available under AGPL-v3 or newer.

All assets (maps, textures, sounds, etc.) are taken from the original RecWar by Willem Janssen which is freely available online.