Git Product home page Git Product logo

tptmp's Introduction

TPTMPv2

A script for The Powder Toy which lets you and your friends create landscapes and cities together... and then blow them up!

a developer and his cousin blowing up id:121412

Client usage

Ideally, you would install this script from the Script Manager. If for some reason that is not feasible or desired, grab the file named tptmp.lua from the latest release on the Releases page and add it to your autorun sequence. How you do this is up to you.

Server usage

Prerequisites

The server is meant to be run on anything but Windows (a limitation of cqueues) using Lua 5.3 or above. It has a number of dependencies, namely:

  • lunajson
  • jnet
  • http
  • luafilesystem
  • basexx (comes with http)
  • cqueues (comes with http)
  • luaossl (comes with http)

If you have LuaRocks, you can install these with:

sudo luarocks install --lua-version=5.3 --tree=system lunajson
sudo luarocks install --lua-version=5.3 --tree=system jnet
sudo luarocks install --lua-version=5.3 --tree=system http
sudo luarocks install --lua-version=5.3 --tree=system luafilesystem

Static configuration

Static configuration is the collection of settings that only ever change when the server administrator changes them. This includes things such as which interface to listen on, how many clients are allowed to connect at once, the path to the dynamic configuration file, etc. All static configuration happens in tptmp/server/config.lua, see that file for further details on configuration options. That file is under version control, but most options in it can be offloaded to tptmp/server/secret_config.lua, which is not.

Dynamic configuration

Dynamic configuration is the collection of settings that are not part of static configuration. This includes things like room ownership, block lists, MOTDs, etc. The dynamic configuration is a JSON file, the path to which is specified by the static configuration options dynamic_config_main and dynamic_config_xchg (the latter being the path to the backup configuration in case the main one is somehow corrupted while being modified). See tptmp/server/plugins for details on how plugins use the dynamic configuration store.

Running the server

The recommended way to run the server is via your service manager of choice. A systemd service template is provided for convenience in the form of tptmp.service.template, which you will have to customize for your specific environment. The server itself is server.lua, running which is as simple as:

./server.lua

This will create the dynamic configuration store in the current directory and start listening for player connections on the port specified by the static configuration option port. Make sure to allow connections through your firewall to this port (but not rcon_port, see below).

Moderating the server

In addition to listening for player connections, the server also listens for a remote console on the port specified by the static configuration option rcon_port. Only one client may connect at once, and the server attempts no authentication of a client that connects. The remote console client is meant to connect from localhost. Never let connections to this port through your firewall.

The remote console protocol is a simple one-JSON-per-LF-terminated-line protocol over TCP. The client requests changes to be made in the server state by sending request objects, to which the server responds by sending response objects when done. The server may also send log objects. See tptmp/server/remote_console.lua and the plugins in tptmp/server/plugins for further details on these objects.

Server usage with Docker

docker build -t tptmp .
docker run \
	-p 1337:34403 \
	-v /path/to/secret_config.lua:/tptmp/tptmp/server/secret_config.lua:ro \
	-v /path/to/config/dir:/tptmp/config \
	-it tptmp

With /path/to/secret_config.lua looking something like this for testing purposes:

return {
	secure = false,
	host = "localhost:36779",
	dynamic_config_main = "/tptmp/config/config.json",
	dynamic_config_xchg = "/tptmp/config/config.json~",
}

To enable TLS, inject the relevant files and point secret_config.lua at them. To enable authentication, make sure the host option reflects the host:port pair under which your server is exposed to the world. See Dynamic configuration above.

Things to do

  • some sort of support for custom elements, maybe room-level element negotiation
  • add APIs to TPT in order to get rid of a few hideous hacks on the TPTMP side
  • smarter foul language filtering
  • mouse selection in the chat window
  • make initial syncs more resilient to problems such as the client chosen to send its simulation data disconnecting

tptmp's People

Contributors

jacob1 avatar lbphacker avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tptmp's Issues

Rename lobby to lobby instead of null

I know that null in Lua and a bunch of other languages means undefined but like I can't remember how many times I tried to return to the lobby thinking the lobby's room name is "lobby". Imagine you have just installed TPT and went into a room with someone else. But the person in the room had to leave for whatever reason and now you are stuck in a random room out of the limitless possibilities (I did the calculations and the room name is one out of infinite rooms since that name can be however long and the room name does not have to obey proper spelling.). So naturally, you type in "lobby". That should bring you to the lobby, right? Wrong. Now you're in a room and no one can join to help you out. You can rename the lobby to "lobby" or at least add a /lobby command.

New command

Command: /snames
Accepts no arguments. Shows nicknames of all users in all rooms (without telling room names)

Server&TPT

Jacob, can you update starcatcher.us to new TPT version? I can't join

New Hotkey

I would like to be able to open the chat and focus the textbox by pressing a single key. The ESC key allows you to unfocus the chat and closes the window so why not have one to do the opposite. I am thinking about the key SHIFT + ESC but your choice.

ctrl-x

Our method of deleting an area uses the mouse-box type which clears one layer of particles, bad for multi-layer stamp syncs.

Error on startup

Upon starting the game, the following error is displayed:
multiplayer.lua2006: bad argument #2 to 'unregister' (function expected, got nil)

This is a persistent issue.

temporary stamps not deleted

When using TPTMP, you get a lot of "corrupted" stamps in the stamp browser, because it creates stamps and then deletes the file without deleting the stamp.

nil - sell

/home/ancient/tpt/tptmp.lua:1337: attempt to perform arithmetic on field 'sell' (a nil value)

Adding Copy and Paste

I would appreciate it if you added the ability to copy and paste things in the TPTMP window. This is an issue because sometimes you have a long piece of text, say a link or something and you need to type it in letter by letter. And when you finish, the other person also has to type it in letter by letter. It seems like too much trouble just to share a piece of text or a link.

limitation of scale

Limited scale of mouse for preventing users to literally crush world and tptmp, may be automatically applied to lobby and setting for private servers.

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.