Skip to content

🛸 (WIP) Classic Asteroids-Style Multiplayer Game from Scratch

License

Notifications You must be signed in to change notification settings

utilyre/go-asteroids

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

89 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Asteroids

Warning

This repository is a work-in-progress and is not yet production ready.

A classic Asteroids-style multiplayer game implemented using the Ebiten game engine. The networking layer is built from scratch over UDP for real-time online play.

Check out my YouTube video, "How I Implemented Multiplayer from Scratch in Golang", where I walk through the implementation details and explain my approach to synchronization using snapshot interpolation.

demo

Installation

1. Installing Ebiten Dependencies

Before running the game, you need to follow Ebiten's installation guide. If you plan to run the server on a VPS, make sure Xvfb is installed and properly configured.

On Ubuntu/Debian systems, you can install it with:

sudo apt-get update
sudo apt-get install -y xvfb

For other platforms, refer to your system's package manager.

2. Running the Server

To run the game server, use the following command:

go run ./cmd/asteroids -listen [ADDR]

Replace [ADDR] with the address and port you'd like the server to listen on. For example, to listen on all network interfaces:

go run ./cmd/asteroids -listen 0.0.0.0:3000

3. Running the Client

To run the game client, use:

go run ./cmd/asteroids -connect [ADDR]

Replace [ADDR] with the address of the server. For example, if the server is running locally:

go run ./cmd/asteroids -connect 127.0.0.1:3000

Or, if you're connecting to a VPS:

go run ./cmd/asteroids -connect ip.of.your.vps:3000

How to Play

Take control of your ship and survive the asteroid field! Here's how to navigate and fight:

Controls

  • W – Thrust forward
  • S – Thrust backward
  • A – Rotate left
  • D – Rotate right
  • Space – Fire your weapon

Objective

  • Destroy as many asteroids as you can without getting hit!
  • Stay agile and keep moving — survival depends on your reflexes and aim.

Good luck, pilot! 🚀

Resources

I used the following materials during the development of this project:

License

This project is licensed under the MIT license.