Coder Social home page Coder Social logo

barbarbar338 / terraria-server Goto Github PK

View Code? Open in Web Editor NEW
18.0 5.0 6.0 18.99 MB

Run dedicated game servers on NodeJS

License: Mozilla Public License 2.0

TypeScript 100.00%
terraria dedicated dedicated-server server terraria-server nodejs game terraria-servers game-servers ts

terraria-server's Introduction

✨ (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. ✨

terraria-server's People

Contributors

barbarbar338 avatar bjorngrylls avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

terraria-server's Issues

Zip is invalid format

Trying to host on Heroku and Glitch I get this error
Heroku:
image

Glitch:
image

It seems to be the zip from Mediafire that is corrupt.

Heroku/Glitch error

I get the following errors when trying to build the server on Heroku
image
Both run "ts-node src --build" which apparently is not found. I have run "npm install" before that

Glitch also fails on the same command.

Infinite connecting loop

2021-01-07T13:52:48.098661+00:00 app[web.1]: 100.0% - Finalizing world - 0.0%
2021-01-07T13:52:50.971907+00:00 app[web.1]: Terraria Server v1.4.1.2
2021-01-07T13:52:50.971978+00:00 app[web.1]:
2021-01-07T13:52:50.974250+00:00 app[web.1]: Listening on port 7777
2021-01-07T13:52:50.977677+00:00 app[web.1]: Type 'help' for a list of commands.
2021-01-07T13:52:50.977844+00:00 app[web.1]:
2021-01-07T13:52:51.225250+00:00 app[web.1]: : ================
2021-01-07T13:52:51.225290+00:00 app[web.1]: 01/07/2021 13:52:51: Unhandled Exception
2021-01-07T13:52:51.225290+00:00 app[web.1]: Thread: 7 [Server Input Thread]
2021-01-07T13:52:51.225291+00:00 app[web.1]: Culture:
2021-01-07T13:52:51.225292+00:00 app[web.1]: Exception: System.NullReferenceException: Object reference not set to an instance of an object
2021-01-07T13:52:51.225293+00:00 app[web.1]: at Terraria.Main.startDedInputCallBack () [0x00017] in :0
2021-01-07T13:52:51.225296+00:00 app[web.1]: at System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) [0x00014] in :0
2021-01-07T13:52:51.225298+00:00 app[web.1]: at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in :0
2021-01-07T13:52:51.225298+00:00 app[web.1]: at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in :0
2021-01-07T13:52:51.225300+00:00 app[web.1]: at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) [0x0002b] in :0
2021-01-07T13:52:51.225301+00:00 app[web.1]: at System.Threading.ThreadHelper.ThreadStart () [0x00008] in :0
2021-01-07T13:52:51.225301+00:00 app[web.1]: ================
2021-01-07T13:52:51.225843+00:00 app[web.1]: [ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object
2021-01-07T13:52:51.225844+00:00 app[web.1]: at Terraria.Main.startDedInputCallBack () [0x00017] in :0
2021-01-07T13:52:51.225845+00:00 app[web.1]: at System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) [0x00014] in :0
2021-01-07T13:52:51.225845+00:00 app[web.1]: at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in :0
2021-01-07T13:52:51.225846+00:00 app[web.1]: at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in :0
2021-01-07T13:52:51.225846+00:00 app[web.1]: at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) [0x0002b] in :0
2021-01-07T13:52:51.225847+00:00 app[web.1]: at System.Threading.ThreadHelper.ThreadStart () [0x00008] in :0

Can't start on Heroku or Glitch

I was so happy Sunday morning when I saw you had comitted a fix for the previous issues. Unfortunately it still doesn't work on Heroku nor Glitch.
I have made some changes in my fork so it can be run on Linux too, like the chmod -R 777 server/ (should probably be changed to chmod -R -x server/ or something). After spending the last couple days both now get stuck at this error:

image

I've tried using the Heroku container (https://github.com/BjornGrylls/docker.terraria-server-vanilla) and had the same problem then. The fix at that time was to change the line endings in the script file from CRLF (Windows) to LF (Linux). This is hovever not possible with the TerrariaServer.exe since I don't have access to the source code. The strange part is that the same TerrariaServer.exe worked in the Heroku container. The container only supports http, which means I can't connect to the server, so I'm back at trying to get the NodeJS working.

I've run out of ideas and hope you can help with this.

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.