The AgarHub server code

Niklas Poslovski 2213022cd4 Replace Socket.IO and JSON messages with plain Websockets and MessagePack for better performance and less traffic usage 1 year ago
src 2213022cd4 Replace Socket.IO and JSON messages with plain Websockets and MessagePack for better performance and less traffic usage 1 year ago
test c4821884fa Tolerate Math.log rounding in tests 7 years ago
.dockerignore d46bfbfc50 Add Docker support 7 years ago
.editorconfig a0cd8b4fbb .editorconfig file added 9 years ago
.gitignore 37dede482a Rewrite config to YAML format and add some information, not all config options work yet, remove obsolete code for MySQL 2 years ago
.jshintignore c26ebc69b6 Added error raporting from js hint 9 years ago
.travis.yml 419173c6d2 also run test on nodejs v4/6 LTS 8 years ago
Dockerfile d46bfbfc50 Add Docker support 7 years ago
LICENSE 0938e38f31 Remove jQuery dependency, fix crash on admin login when MySQL is missing, improve the chat, change license to GNU AGPL 3 years ago
README.md 147000f4d0 Fix some links in readme 3 years ago
TODO.md 125a764dc3 Dependency cleanup, ignore default SQL config 7 years ago
app.json 8b2f8a8162 Synced up app.json 8 years ago
config.sample.yaml 37dede482a Rewrite config to YAML format and add some information, not all config options work yet, remove obsolete code for MySQL 2 years ago
docker-compose.yml d46bfbfc50 Add Docker support 7 years ago
gulpfile.js 37dede482a Rewrite config to YAML format and add some information, not all config options work yet, remove obsolete code for MySQL 2 years ago
manifest.yml 5eea110f1b Revert back to original env: ... 8 years ago
package.json 2213022cd4 Replace Socket.IO and JSON messages with plain Websockets and MessagePack for better performance and less traffic usage 1 year ago
screenshot.png eb1b55f051 Update screenshot 8 years ago
webpack.config.js 7587858b42 Update dependencys and make it work with current NodeJS 3 years ago

README.md

AgarHub Server

Based on https://github.com/huytd/agar.io-clone.
A powerful browsergame built with socket.IO and HTML5 canvas on top of NodeJS.

Image

Game Basics

  • Move your mouse around the screen to move your cell.
  • Eat food and other players in order to grow your character (food respawns every time a player eats it).
  • A player's mass is the number of food particles eaten.
  • Objective: Try to get as big as possible and eat other players.

Gameplay Rules

  • Players who haven't eaten yet cannot be eaten as a sort of "grace" period. This invincibility fades once they gain mass.
  • Everytime a player joins the game, 3 food particles will spawn.
  • Everytime a food particle is eaten by a player, 1 new food particle will respawn.
  • The more food you eat, the slower you move to make the game fairer for all.

Latest Changes

  • Game logic is handled by the server
  • The client side is for rendering of the canvas and its items only.
  • Mobile optimisation.
  • Implementation of working viruses.
  • Display player name.
  • Now supporting chat.
  • Type-ping in the chatbox to check your ping, as well as other commands!

Installation

You can install this project on your own server easily.

Requirements

To run / install this game, you'll need:

  • NodeJS with NPM installed.
  • socket.IO.
  • Express.

Downloading the dependencies

After cloning the source code from Github, you need to run the following command to download all the dependencies (socket.IO, express, etc.):

npm install

Running the Server

After downloading all the dependencies, you can run the server with the following command:

npm start

The game will then be accessible at http://localhost:3000 or the respective server installed on. The default port is 3000, however this can be changed in config. Further elaboration is available on our wiki.


FAQ

  1. What is this game?

This is a clone of the game Agar.IO. Someone said that Agar.IO is a clone of an iPad game called Osmos, but we haven't tried it yet. (Cloneception? :P)

  1. Why would you make a clone of this game?

Well, while the original game is still online, it is closed-source, and sometimes, it suffers from massive lag. That's why we want to make an open source version of it: for educational purposes, and to let the community add the features that they want, self-host it on their own servers, have fun with friends and more.

  1. Any plans on adding an online server to compete with Agar.IO or making money out of it?

No. This game belongs to the open-source community, and we have no plans on making money out of it nor competing with anything. But you can of course create your own public server, let us know if you do so and we can add it to our Live Demos list!

  1. Can I deploy this game to my own server?

Sure you can! That's what it's made for! ;)

  1. I don't like HTML5 canvas. Can I write my own game client with this server?

Of course! As long as your client supports WebSockets, you can write your game client in any language/technology, even with Unity3D if you want (there is an open source library for Unity to communicate with WebSockets)!

  1. Can I use some code of this project on my own?

Yes you can.

For Developers

  • Game Architecture to understand how the backend works.
  • If you want to start your own project, I recommend you use this template. Happy developing! -

TODOs

We have an explicit TODO list for the all the features we aim to develop in the future. Feel free to contribute, we'll be more than grateful.

License

You can check out the full license here.

This project is licensed under the terms of the GNU Affero General Public License v3.0 license.