REST stats

Search, find and discuss about Mutators!
Post Reply
chacha
Novice
Posts: 5
Joined: Sun Jul 24, 2022 5:55 pm

REST stats

Post by chacha »

H there !

A little mod to help getting real-time server stats in a programmably readable format (JSON), using REST-like URL.
It's mainly an adaptation of the UT Web admin page (limited to same informations) but might be improved in the future.
There is multiple reason I created this mod for:
- Gamestat protocol doesn't have all the informations (mutator list, map list, players IP ..)
- UTAdmin page is unconsistent when language and/or version change so very hard to maintain a parser... (I tried !)
- There is a memory leak somewhere in the HTML renderer so pooling UTAdmin make UCC Out-Of-Memory after a few hours/days (depending on pooling rate)
- Accessing UTAdmin is more CPU intensive than creating a simple JSON output, so hopefully less/no impact on gameplay

Usage:
- Install .u
- update your UnrealTournament.ini:

Code: Select all

[UWeb.WebServer]
Applications[0]=UTServerAdmin.UTServerAdmin
ApplicationPaths[0]=/ServerAdmin
Applications[1]=UTServerAdmin.UTImageServer
ApplicationPaths[1]=/images
Applications[2]=ChaChaRESTStats.ChaChaRESTStats
ApplicationPaths[2]=/api/v1
DefaultApplication=0
bEnabled=True
ListenPort=<YOUR_LISTEN_PORT>
Download and further informations (including output samples):
Current release:
https://chacha.ddns.net/gitea/chacha/UT ... tag/V1.0.0
Main repository:
https://chacha.ddns.net/gitea/chacha/UT ... aRESTStats

Bug & Suggestions:
You are welcome to post here but you can also open a ticket on the GIT repo (https://chacha.ddns.net/gitea/chacha/UT ... ats/issues)
(You can loggin with gmail/github)

Limitations:
UT99 version >= 451 is needed

Planned other features:
- Get Game Engine version
- Get this mod version
- (maybe) enable simple HTTP auth
- port to UT2k4 and UT3 (and UT4 ?) (same reason)

NOT planned other features:
- write / set value (this mod is and will always focus only on statistics => read only)
User avatar
[rev]rato.skt
Adept
Posts: 438
Joined: Mon Aug 16, 2010 1:09 pm

Re: REST stats

Post by [rev]rato.skt »

Very good man, when you can put a small sshot so we can appreciate your work :D
Brazilian Server:
Alma Negra - 34.95.189.187:7777
Classic - madruga.utbr.cf:7777
Duel - x1.utbr.cf:6666
chacha
Novice
Posts: 5
Joined: Sun Jul 24, 2022 5:55 pm

Re: REST stats

Post by chacha »

Sure, its on the GIT page :)

Ok, I can also give some sample here:

GET http://YOUR_SERVER_IP:YOUR_LISTEN_PORT/api/v1/map_list

Code: Select all

{"Maplist":["CTF-Gauntlet.unr","CTF-Command.unr","CTF-Coret.unr","CTF-Dreary.unr","CTF-LavaGiant.unr","CTF-November.unr"]}
/!\ .unr extension will be removed on next release

GET http://YOUR_SERVER_IP:YOUR_LISTEN_PORT/api/v1/current_all

Code: Select all

{"GameName":"Capture the Flag","GameClass":"Botpack.CTFGame","LevelTitle":"Lava Giant","Level":"CTF-LavaGiant","Mutators":["Botpack.FatBoy"],"player_list":[{"PlayerName":"chacha","Ping":25,"Score":0.000000,"bIsABot":False,"bIsSpectator":False,"IP":"172.16.4.101"}]}
GET http://YOUR_SERVER_IP:YOUR_LISTEN_PORT/api/v1/default_all

Code: Select all

{"GameStyle":"Turbo","GameSpeed":100.000000,"AirControl":35.000000,"UseTranslocator":True,"MaxPlayers":16,"MaxSpectators":2,"bMultiWeaponStay":True,"bTournament":False,"bPlayersBalanceTeams":False,"bForceRespawn":False,"GoalTeamScore":3.000000,"TimeLimit":0,"FriendlyFireScale":0.000000,"ServerName":"Another UT Server","AdminName":"","AdminEmail":"","MOTDLine1":"","MOTDLine2":"","MOTDLine3":"","MOTDLine4":"","bWorldLog":True}
Post Reply