/terraria-server

Run dedicated game servers on NodeJS

Primary LanguageTypeScriptMozilla Public License 2.0MPL-2.0

✨ (DEPRECATED) Terraria Dedicated Server On NodeJS

(DEPRECATED) The purpose of this project was to run a game server on platforms like Heroku, but I did not think about the system features of these platforms. The project is currently running smoothly on a device that meets the minimum system requirements, but Heroku does not meet these requirements. You can still run the project on a powerful NodeJS hosting without any problem. However, as this is out of our purpose, I stop developing the project. ~barbarbar338

  • Run Terraria servers (or any other game servers) on NodeJS ⚽
  • Get your NGROK key 🔑
  • Set up your config file and start the server 💡

❓ Idea

We can't run ".exe" files on sites like Heroku or Glitch. But we can do anything with child_process, a nice thing that NodeJS gives us. Here I give an example of "Terraria", a game I play frequently, but you can set up a server for any game you want. The working logic of the system is as follows: First, we download the server files with the "request" module and build these files with the necessary commands. (You can use child_process for this operation too.) I call this phase "build". When the "build" phase is over, we spawn the ".exe" extension server file we downloaded with child_process. And I call this phase "start". At this phase, your server is now up and running.

🔑 About NGROK Auth Key

NGROK makes the servers in our localhost open to the world under its own domain. We can only host a site in Heroku using the port Heroku opens. Also (as far as I know) we cannot connect to this port via TCP connection. We start our server on the Heroku computer at port 7777 in localhost and perform a TCP Forward operation via NGROK under the NGROK domain. And ta-da! 🎉🎊 Our terraria (or any game) server is hosted on Heroku.

💥 Restrictions

I don't know how things work on Glitch, but Heroku offers us 512MB of storage space and RAM support. It is very difficult to run a game server with such a low system. Don't try to push the limits of Heroku 😄

📦 Build and Running

  • Run yarn build or npm run build to build and configure server files. Make sure you use this command only once. Because every time you use this command, your old server files are deleted. 🏗️
  • Run yarn start or npm run start to start server 🎬

🔗 Contributing

Feel free to use GitHub's feautres. ✨