Code Monkey home page Code Monkey logo

archipelago's Introduction

Archipelago

A web-based multiplayer clone of the android game with the same name.

Screenshot Archipelago

CircleCI Codeclimate Maintainability

The game can be played at https://playarchipelago.com.

The Archipelago game

The game is about controlling islands by sending airplanes. Each players starts controlling a single island. In addition, there are multiple islands, controlled by neither player. Each island has an army, that for player-controlled islands increases over time. A player may at anytime choose to send an airplane from an island that the player controls to any other island. The airplane is created with half the army strength of the island, subtracted from the island.

As an airplane reaches its destination different things happen:

  1. If the owner of the airplane is the same as the owner of the island, then the island strength is increased by the strength of the army on the airplane.
  2. If the owner is not the same, then the army size of the island is subtracted by the army size of the airplane. This in turn can have additional effects:
    1. If the resulting island army size is <0, then the player controlling the airplane gets control of the island and the army size of the island is set to the absolute value.
    2. If the resulting island army size is == 0, then control of the island is given to the neutral player.

The game is over when there is only a single player controlling any islands or airplanes.

Project Overview

The project has two parts; A backend server written in go, and a frontend created in JavaScript. Communication between the backend and frontend is done over binary WebSockets messages, serialized using protocol buffers defined in the proto directory.

Frontend

The frontend project is found in the web directory. It is based on Pixi.js for WebGL/canvas rendering. The frontend is written in ES6, and is transpiled to ES5 via Babel. Yarn is used to manage dependencies, and Webpack4 is used to bundle the frontend application (including js, css and images).

Backend

The backend is written in go and uses standard go modules for managing dependencies. The backend relies primarily on the go standard library, but uses Gorilla/WebSocket for WebSocket handling, Logrus for logging, and pkg/errors for better error handling.

The backend code is found in the lib directory.

Running the Project

To run and build the project, make sure to have the following installed:

Then clone the project:

$ git clone [email protected]:verath/archipelago.git

This will include all dependencies required for the backend code. However, the client side dependencies are not included in the repo and have to be fetched via yarn, and then built/bundled:

$ cd web
$ yarn install
$ yarn run build:prod

Now run the project as a go project, e.g. using go run from the root directory:

$ go run main.go -debug -serveStatic -skipWSOriginCheck

This should start the server, and make it available at http://localhost:8080 by default.

Developing

Protocol Buffers (protobuf)

To regenerate the protobuf files it is necessary to install the protobuf compiler (protoc) and the go proto compiler plugin (protoc-gen-go), see the protoc-gen-go project for instructions. dcodeIO/protobuf.js is also required but should already be installed via yarn.

With these tools installed and available on the path, use the proto/build.ps1 PowerShell script to build both the server (.pb.go) and the client (.js, .d.ts) files.

archipelago's People

Contributors

verath avatar

Stargazers

Dimitris Platis avatar  Lin Jian avatar André Philip avatar Emil Hermansson avatar  avatar Jakob Csörgei Gustavsson avatar Simon Bengtsson avatar

Watchers

 avatar André Philip avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.