RBattle: a simple networked game in Rust


#1

I wrote a simple multiplayer networked real-time strategy game in Rust for my presentation at OSCON this year. The game is called RBattle, and it looks like this:

It requires Rust 1.17, and the sources are on GitHub. Please give it a try!

From README.md:

RBattle

RBattle is a resurrection of the '90s-era X Windows game XBattle, written in Rust.
It uses the Glium OpenGL bindings for graphics, and Tokio for some of its networking.

To play, make sure the players’ computers can connect to each other via TCP/IP.
(Many wifi networks don’t permit associated hosts to communicate with each other
directly, only with the outside world.)

On one computer, run the command:

$ cargo run server 0.0.0.0:12345

where 0.0.0.0:12345 give the IP address and TCP port the server should listen
for client connections on. Then, on up to three other computers, run:

$ cargo run client ADDR:PORT

where ADDR is the IP address of the computer running the server, and PORT is
the same port number given to the server. The clients simply join the game in
progress, with each incoming client assigned to a different color.

When the game is started, each player owns a goop source. Click within squares
to toggle outflow pumps. Equal amounts of goop of different colors cancel each
other when they come in contact. Win by destroying all of your opponents’ goop.

RBattle was written in haste. There are many, many improvements possible, and
the code is not great in some parts. There are surely plenty of bugs as well.
Pull requests are welcome!

License

RBattle is copyright 2017, the RBattle developers. RBattle is distributed under
the terms of both the MIT license and the Apache License (Version 2.0), with
portions covered by various BSD-like licenses.

See LICENSE-APACHE and LICENSE-MIT.


#2

Hi Jim,

I’m using this game to experiment with a peer-to-peer solution.

Should I be seeing the goop fill up an empty square in the direction chosen?
I see the action being logged but no goop.


#3

Yes. The user interface is terrible, but when you click within a square but close to its N, S, E, or W side, it toggles a pump sending stuff in that direction. But you should only be able to control your own color, and there’s no indication of which one is yours, so you have to try all of them. But it seems like you were able to create a pipe, so I’m not sure why it isn’t flowing for you.

I tried a recent build, and it’s crashing in xcb trying to open the display. So I can’t try to reproduce this…


#4

Thanks Jim! I just wasn’t clicking around enough.
I don’t think the UI is terrible.
Thank you for creating it.


#5

Oh, great!

What sort of peer-to-peer stuff are you doing with it?


#6

BTW, I just updated to the latest versions of all the dependencies and pushed the fixed version. The prior version was crashing on startup in libxcb when I rebuilt it today.


#7

Reading quite a bit about BFT consensus and gossip protocols and wondering if there is some load that could be taken off of game servers, still using them but perhaps serving a greater number of players or for the same number but just a smoother experience.

I’ve been trying to play in Star Citizen’s persistent universe but the server lag is unbearable.

I’m starting simple just to learn how to implement in a game then I want to test the upper bounds of achieving consensus among peers on game state containing a very high number of dynamic polygons.