Git Product home page Git Product logo

jensforstmann / tmt2 Goto Github PK

View Code? Open in Web Editor NEW
21.0 6.0 6.0 1.99 MB

TMT - Tournament Match Tracker: Supervise/Manage Counter-Strike 2 matches with ease!

License: MIT License

TypeScript 98.14% Dockerfile 0.31% Shell 0.14% HTML 0.25% JavaScript 0.35% CSS 0.66% PowerShell 0.14%
csgo csgo-bot csgo-server-administration csgo-tournament counter-strike counter-strike-2 cs2 cs2-bot cs2-tournament

tmt2's Introduction

TMT2 - Tournament Match Tracker 2

Docker Pulls Docker Image Size (tag)

TMT is a tool that tracks/watches/observes a Counter-Strike 2 match.

It will keep track of matches and can interact with 3rd party applications like tournament systems, websites or others via a REST API and webhooks to send real time notifications.

FEATURES

  • Fully configure the tournament match beforehand (and edit it after it's created)
  • Play how many maps you want in a series (BO1, BO2, BO3, BO*...)
  • Configure how to ban and pick maps & sides, even knife-for-side is supported
  • Support for workshop maps
  • Automatic map changes & side switches
  • Ingame chat commands for the players (see section Ingame Chat Commands)
  • Integrated support for round backups and rollbacks
  • REST API to fully control TMT from another system
  • Webhooks to receive real time updates
  • Loop Mode (TMT starts over after the match ends, useful for public servers)
  • Web frontend
    • create new matches
    • create presets for common match configurations
    • list all matches
    • show logs
    • read and use ingame chat
    • see players & teams
    • rcon console
    • manage pool of game servers (can be used for new matches)
  • No server side plugin or mod needed

Example screenshot: Banning a map from the map pool: Ban a map (screenshot)


Table of Contents:

Getting Started

TMT2 is available on docker hub: https://hub.docker.com/r/jensforstmann/tmt2

Run it with:

docker run --name tmt2 -d -p 8080:8080 jensforstmann/tmt2

Data will be written within the container to /app/backend/storage. To keep the files with different containers you can either specify a docker volume or a path on the local system:

# docker volume
docker run --name tmt2 -d -p 8080:8080 -v dockerVolumeName:/app/backend/storage jensforstmann/tmt2

# local host directory
docker run --name tmt2 -d -p 8080:8080 -v /home/tmt2/storage:/app/backend/storage jensforstmann/tmt2

The matches which are neither finished nor stopped will be loaded on application start.

Create you first Match

After running the container you can open the web frontend: http://localhost:8080 (or at whatever ip/server your docker container runs on.)

Example screenshot: Create a new match from the web frontend (both dark and light mode available): Create a new match (screenshot)

Even without an admin token you can create and manage matches (but only your own ones). If you want to know your admin token (a random one is generated at startup) either take a look at the access_tokens.json file or take a look at the first lines of the log output (docker logs tmt2).

Ingame Chat Commands

While TMT watches a match the player ingame can use chat commands to communicate with TMT:

  • .team a or .team b - you need to choose a team before you can execute any other commands, check the response in the chat to be sure you've joined the right one, also check the scoreboard (team names are visible there) if you're on the right side (CT/T)
  • during the map election process:
    • .ban - ban a map from the map pool
    • .pick - pick a map to be played
    • .agree - agree on a map together with the opponent (alias .map)
    • .ct/.t - select CT/T as your starting side
    • .restart - restart the election process
  • during and after the knife round (if one takes place)
    • .restart - restart the knife round
    • .ct/.t - select CT/T as your starting side
    • .stay - stay on your side
    • .switch - switch the sides (alias .swap)
  • during the warmup
    • .ready - set your team as ready (alias .rdy)
    • .unready - set your team as not ready (alias .unrdy)
  • during the match
    • .pause - pause the match at the next freezetime (alias .tech)
    • .unpause - set your team as ready (alias .ready & .rdy)
    • .tac - like pause, but uses up a tactical timeout for that team (same as calling an ingame vote for a tactical timeout)

Configuration

Just use these environment variables:

# http port that tmt listens on
TMT_PORT=8080

# the address the game server must send the logs to (from the pov of the game server)
# if not set a tmtLogAddress must be for every match
TMT_LOG_ADDRESS=http://127.0.0.1:8080

# where tmt will store match data in
TMT_STORAGE_FOLDER=storage

# ingame prefix to every chat message sent by this application
TMT_SAY_PREFIX="[TMT] "

API

See backend/swagger.json. You might want to copy its content and paste it into https://editor.swagger.io/.

See also the examples folder.

Security / Authentication

There are two types of authentication:

  • global access
  • match specific access

Global access tokens have full permissions. Match specific ones can only access its own match.

Both are used in client requests in the Authorization header with a "Bearer "-prefix:

...
Authorization: Bearer 2Mgog6ATqAs495NtUQUsph
...

global access tokens

Global access tokens are persisted in the storage folder in the file access_tokens.json.

Example:

{
    "2Mgog6ATqAs495NtUQUsph": { // that's the token
        "comment": "first auto generated token" // optional comment, might be used in logging
    },

    // multiple tokens are also possible
    "knRRkV41yLBUw1eVwRD9VF": {
        "comment": "Jens"
    },
    "vZQjPZBXRAK6yhCwoboxWk": {
        "comment": "tournament system"
    }
}

If the file does not exist at startup a new one with a single auto generated global access token will be created.

match specific access tokens

Every match will have a tmtSecret property. This can be used in the same way as a global access token.


Development

After starting the dev processes you can reach the backend & frontend at:

Docker

Docker is recommended as it's easy to use and doesn't require any other software to be installed (if docker is already set up).

Note for windows user: It's recommended to have docker installed directly within WSL (not using Windows Docker from WSL) or to run a Linux VM.

Init the dev environment:

./dev-container-init.sh

Start a docker container with port forwarding and hot reloading:

./dev-container-start.sh

NodeJS

If you don't want to use docker or want to use NodeJS directly, you can do the following to setup a dev environment:

Install dependencies:

npm install
cd backend
npm install
cd ../frontend
npm install

Run backend with hot reloading:

cd backend
npm run dev

Run frontend with hot reloading:

cd frontend
npm run dev

This project is a complete rewrite of the former TMT.

tmt2's People

Contributors

dependabot[bot] avatar egosar93 avatar jensforstmann avatar ovee avatar

Stargazers

 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

tmt2's Issues

TMT2 is not working after CS2 Update 28.02.2024

with the update of February 28, 2024, the TMT no longer runs, the script no longer reacts to the entries in the chat. I think it has something to do with the point here: "Improved behavior when user input does not arrive on the server in time due to packet loss or client frame rate issues"

do not end map if paused on last round

Default setting if a map is paused is to pause in the next freezetime.

If a map is paused on the last round: What can be done to not finish the map?

Example: In the last round (14-15) multiple players got dropped. Pausing the match (after the round) at 14-16 is too late because one team already won.

In that case these actions must be performed currently (not implemened yet):

  • set matches currentMap--
  • load round backup

In that case it is also important, that the match does not finish (in case it was the last/only map). Rcon end action should not be executed, match end action should not be executed

Possible Ideas: Pause instant on !pause if nothing happened in this round (check ruleso f other tournaments), e.g. no damgage has been dealt (required higher mp_logdetail setting).

save matches to disk on change

Currently only every 60 seonds all matches will be persisted to disk.

Change this behavior to save the match to disk every time something (meaningful?) changes.

incorrect wrong team assignment message

In case the sides are switched after a knife round a "you're in the wrong team" messages is printed into chat (although the player is in the correct one).

Assign (force) players to teams by Steam ID

Allow submitting a list of Steam IDs per team and force players to C/CT and team A/B according to this list. This should help with players joining the right team according to the .team command, but still be on the wrong team according to the scoreboard (which then results in swapped/incorrect scores)

No Match Backup with Looped Matches

Hi,

it is not possible to restore a Match when it is in Loop Modus. Afte a lot of played rounds TMT seems not to save the backups any more.

I also had a strange behavior at the finals at 2v2 and 5v5. I set up the team Names and also the score for the winner bracket team. After the electionphase / Knive the server crashed. I know that the server is crap atm but i wanted to keep you aware of this problem.

Regards
Tobi

make matches and maps updatable via http api

ideas:

  • mapPool
  • electionSteps
  • gameServer
  • teams (names, advantage)
  • match Maps (which maps (names), startAsCtTeam, knifeForSide, knifeWinner)
  • restart current map (after knife)
  • restart current map (with knife)
  • go back to election process
  • go back to after election process

Missing info in election process after agreeing on a map

With these electionSteps no info appears in chat, that a team must pick a side.

{
    "electionSteps": [
        {
            "map": {
                "mode": "AGREE"
            },
            "side": {
                "mode": "PICK",
                "who": "TEAM_A"
            }
        },
        {
            "map": {
                "mode": "AGREE"
            },
            "side": {
                "mode": "PICK",
                "who": "TEAM_B"
            }
        }
    ]
}

incorrect team score/side when loading round backups after halftime from before half time

steps to reproduce:

  • halftime and side switch after 15th round (score e.g. Team A 10, Team B 5)
  • play 16th round (score e.g. Team A 10, Team B 6)
  • restore to beginning of 14th round (score e.g. Team A 10, Team B 4)

now after 15th round the score reported via webhook is Team A 5, Team B 10

cause:

/** Contains the state without the new score (without the just finished round). */

If this gets calculated it still thinks it's A10:B6 so it thinks teams are in switched state.

Alternative to `.team`?

Especially for public matches where it doesn't matter if they are in Team A or B executing .team a or .team b is annoying.

Maybe add an alternative to .team: Decide based on current side (CT/T), configurable per match?

Reply to incorrect commands

If a message starts with a prefix but is no valid command: Reply with command not found

If a command is entered, but has no effect currently: Reply with command not usable at the moment.

No Player reset with looped match

Hi,

i saw a bug at our LAN. When i set up the Matches in Loop mode there will be a lot of players in the Teams. See the picture.

Screenshot 2023-10-29 013445

Regards
Tobi

Players without a team cannot .pause

By design players must join a team with .team a/b
Bit it's not needed that every player joins a team, it's enough that one player per team (leader/captain) joins a team.

If the game is then in progress others players cannot .pause.

This might lead to confusion/trouble during the match if some players get dropped from the game.

Possible ideas:

  • Enforce that every player must join a team before starting the match
  • Allow some commands to be executed without team assignment
  • Guess the team of the player (If T player writes something, look all T players if one has a team assigned) [not sure this is possible]

bug in 2on2 Wingman

Hey, the game_mode 1 is wrong for Wingman. The right settings is game_mode 2.
thx :)

Feature Request

Hi Its me again xD,

is it possible to add more information on the Match site? When i click on the Match tab in tmt i can see a lot of Matches, the problem is i dont know on which server they are running. So it woul be ok for me when the ip adress would be shown in the Match overwview tab.

Is this Possible?

Regards Tobi

more useful chat commands

.info: Display information about the match, maps, scores.
.state: Display current match and map state?

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.