Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Scoreboard in frontend and/or via webhook #38

Open
Bastika07 opened this issue Jun 11, 2024 · 7 comments
Open

Feature Request: Scoreboard in frontend and/or via webhook #38

Bastika07 opened this issue Jun 11, 2024 · 7 comments

Comments

@Bastika07
Copy link

It would be nice to get the scoreboard after a match is finished via webhook or if you can see the scoreboard in the frontend.

@JensForstmann JensForstmann changed the title Feature Request: Feature Request: Scoreboard in frontend and/or via webhook Jun 22, 2024
@JensForstmann
Copy link
Owner

Last time I checked the game server actually sends score board like data via its logging to the tmt... BUT only at the beginning of a round and not at the end or after a round. So the final (last) scoreboard that would be displayed is of the start of the last round :(

Example data:

04/04/2024 - 07:54:54.138 - JSON_BEGIN{
04/04/2024 - 07:54:54.138 - "name": "round_stats",
04/04/2024 - 07:54:54.138 - "round_number" : "3",
04/04/2024 - 07:54:54.138 - "score_t" : "0",
04/04/2024 - 07:54:54.138 - "score_ct" : "2",
04/04/2024 - 07:54:54.138 - "map" : "de_dust2",
04/04/2024 - 07:54:54.138 - "server" : "TMT2 Test Server",
04/04/2024 - 07:54:54.138 - "fields" : "             accountid,   team,  money,  kills, deaths,assists,    dmg,    hsp,    kdr,    adr,    mvp,     ef,     ud,     3k,     4k,     5k,clutchk, firstk,pistolk,sniperk, blindk,  bombk,firedmg,uniquek,  dinks,chickenk"
04/04/2024 - 07:54:54.138 - "players" : {
04/04/2024 - 07:54:54.138 - "player_0" : "            17041626,      3,   7600,      1,      0,      0,    100, 100.00,   0.00,     50,      1,      0,      0,      0,      0,      0,      1,      1,      1,      0,      0,      1,      0,      1,      0,      0"
04/04/2024 - 07:54:54.138 - "player_1" : "                   0,      0,    800,      0,      0,      0,      0,   0.00,   0.00,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0"
04/04/2024 - 07:54:54.138 - "player_2" : "                   0,      2,   2700,      0,      1,      0,      0,   0.00,   0.00,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0"
04/04/2024 - 07:54:54.138 - }}JSON_END

@JensForstmann
Copy link
Owner

For a correct scoreboard I'd have to implement all events on their own and keep track of them. Not impossible only a lot of work... But something that I've considered to be able to get some nice stats about teams and players across multiple matches.

@Ecnama
Copy link

Ecnama commented Dec 12, 2024

I'm part of the organization of a lan, and we'd like to use tmt2, but having players' stats after the event as we had we the ebot would be very cool. We're ready to develop this feature, but we don't know where to start, how tmt2 communicates with the server and how we can extract the data.

@JensForstmann
Copy link
Owner

Hey thanks for your interest. Technical documentation is lacking a bit so I'll just write down the parts to get you started:

Every log line from the cs2 server is sent via http to tmt and will end up in oneLogLine:

const onLogLine = async (match: Match, line: string) => {

There every different type is matched with regex and sent with parameters to a handling function.

I'm not sure that the game server will sent damage or grenade events by default. Eventually increasing the log level is needed. That can happen in in the setup function

const setup = async (match: Match) => {

Currently there is only the log on, but in the comment there are already other commands to increase the amount of logs.

TMT2 currently saves all data as text files (json or jsonl). But I'm not sure if that's the right direction when considerung saving stats. Maybe it's time to add sqlite to the project. It would make.

Tell me what you think about it. Do you need anything else to get started?

@Ecnama
Copy link

Ecnama commented Dec 17, 2024

We made a fork with our own issues, and we'll work on it.

Sqlite is a good and easy way to store this data, it's fine for us.
We'll also add a switch in the admin panel to enable/disable the ability for anyone to create a private match, as everybody will be able to see the tmt2 panel during our event. The "Create match" tab will be replace by the scoreboard if disabled. Finally, we would like to add a french localization, as we are a french organization.

If we need you help at some point, I'll ask you here, thank you very much for your help !

@JensForstmann
Copy link
Owner

Sounds great. If you plan to get your changes merged back into this project (I'd appreciate it), then please split it up into smaller PRs (instead of one big chunk).

Localization:
The frontend is prepared for this: https://github.com/JensForstmann/tmt2/blob/f5499b972d7522dd0f4086e34f04aed8f19e7053/frontend/src/utils/locale.ts
But the locale files are empty.
The messages sent from the backend to the game server are all (hard coded) in english currently, not system is in place there.
If you come up with any ideas (both frontend and backend) to better handle localization, then let me know. I never really did any i18n in projects, so experience from my side is low.

@pixup1
Copy link
Contributor

pixup1 commented Dec 18, 2024

Hey @JensForstmann !

I'm currently working with @Ecnama on this, and we're having an issue with the auto-generated files swagger.json and routes.ts. When we run the app, they get generated in a different format than yours (with spaces instead of tabs, arrays formatted differently in the json, etc.). Is this due to a difference in user config ? 🤔 I've never used tsoa before. If not, maybe we could add them to the .gitignore ?

Thanks !

Edit: Nevermind, got it ! Just had to use Prettier

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants