This is a clone of agar.io. In this project we aim to acheive the following.
- Hack main_out.js and make the variables and function names readable. Now most of the variable and function name should make sense.
- Add uploading custom skins features (Done)
- Add in-game chat feature. (Done)
- Add mobile device support (Done)
- Support multi-server feature (Done in Cigar)
##Setup
Copy all files to a server with PHP support (e.g. LEMP/LAMP). To check whether your server supports PHP, please read this tutorial. Once everything is set up, open index.html in your browser. If everything is working well, go to the next section to use your own Ogar server.
Replace the CONNECTION_URL with your own ip and port in main_out.js
The upload module does two things. The first is to upload a skin onto skins folder. The second is that the client request the server to run checkdir.php every 15 seconds to check what skins are uploaded and add them into knownNameDict. Then the skins can be loaded.
To make this feature work, you need to give upload.php priviliage to read skins folder.
chmod 777 skins
will make it work.
This client has been tested on LEMP stack on OS X 10.10 and Ubuntu 14.04 with server side Ogar.
It is known that some of the variables and function names still make no sense, we are working on that.
No, agar-clone is not intended to be used with the official server. You will have to use it with Ogar or Cigar.
Currently, only Cigar supports the chat protocol. If you know of another server supporting the extended protocol, feel free to let us know.
As the server has to tell whether the client supports protocol extensions, the values of package 254 and 255 have been adjusted. Package 255 now contains "Ogar" in ASCII (1332175218) while package 254 contains the version number. When modifying the protocol, only new features can be implemented. Also, the client must remain compatible with older versions of the server.
Original protocol can be found here. Changes to the protocol have to be documented.
Pull Request are welcome.
Note that the aim of this repo is to study agar.io client, understand the mechanism and find potential improvements. It is worth pointing out that hosting a third-party agar client is against the Terms of Agario and not recommended by the owner of this repo. Please think twice before hosting the client and do it at your own risk. :)