Syn9673 / GTBot

A Web-based Growtopia Bot.
GNU General Public License v3.0
19 stars 7 forks source link

GTBot

A Web-based Growtopia Bot.

Previews

Preview 1 Preview 2 Preview 3

How it works

Basically, a NodeJS app is created, which acts as a ENet Client and also a Websocket server. It's a proxy to make communication from the website to ENet.
It uses websockets to communicate to make it easier, and since js on web only supports tcp.

Setup

Services used:

Make sure you have the necessary tools installed, which are:

Once all the necessary tools are installed, you can now install the packages by doing:

$ npm install

Once the packages are installed, you should configure the config inside the config.json file.
The config file contains the required data to make it work.

nodes - The nodes array is what the proxy code will create and the nodes to connect to from the website. When starting up the proxy, it will create X amount of forks of the master process with each fork containing a different node instance. Then the website will also choose from those nodes on which to connect to randomly.

cors - Next up is the cors object. This is pretty much a proxy for web requests to "bypass" the no-cross origin errors. This should only be set if you are using the website. It has 2 properties, host and port.

Making it online

Proxy

To turn on the proxy, you must build the necessary native module first. By simply doing:

  $ npm run buildProxy

After that, just run the proxy by doing npm run proxy.

Website

The website uses Nextjs which is a framework over React. It makes server side rendering and routes much easier to handle. To run it there are two options, dev mode and production mode.

dev mode is for development purposes only. If you want to edit the site and see a live preview, dev mode would be the best for you. Otherwise, use production mode to use a fast version of the site that is production-ready.

To run the dev mode version of the site, do:

  $ npm run siteDev

While for the production mode, you would have to do these two simultaneously.

  $ npm run buildSite
  $ npm run site

Both modes listens to port :80 for the website.

Cors

The cors proxy is pretty much easy to run, you simply do:

  $ npm run cors

and it should be online.

TODO List:

Support

You can join the Pogtopia Development Discord and ask in the #coding channel for support about this project.

Credits

ama - Contains the modified ENet Library to work with the gt server. And string types of packet types.

Note

If you'd like to make your own client code, see PROTOCOL.md on how the proxy should work.