trying to get some elite stats

Discuss the Dedicated Server Tools developed by Nadeo Live such as ManiaLive, Trust Circles, Dedicated Manager, Competition Manager and Lobbies

Moderator: NADEO

Post Reply
MuNgLo
Posts: 314
Joined: 12 Jul 2012, 03:37

trying to get some elite stats

Post by MuNgLo »

While playing around with manialive I wanted to make a statistic collector and ranking plugin for Elite mode. But Now I think I might have to give up. That is if I understand how it works correctly.

My understanding is that to track events in a gamemode you need to have callback written into the gamemode script file. Since I don't have the Elite script file I can't do it that way.

The stats I want to track is basically what's on the scoreboard. Might it be possible to just grab those on matchEnd?
User avatar
w1lla
Posts: 2287
Joined: 15 Jun 2010, 11:09
Location: Netherlands
Contact:

Re: trying to get some elite stats

Post by w1lla »

Try to do something like this:

Code: Select all

function onModeScriptCallback($param1, $param2) {
		Console::println('[' . date('H:i:s') . '] Script callback: '.$param1.', with parameter: '.$param2);
		switch($param1) {
case 'playerHit':
				$this->mode_onPlayerHit($param2);
				return;
}
	}

// param = Victim:###;Shooter:###
	function mode_onPlayerHit($param) {
		$players = explode(';', $param);
		$victim = str_replace('Victim:', '', $players[0]);
		$shooter = str_replace('Shooter:', '', $players[1]);
This is based on a MLEPP Script but can be used for any other servercontroller/tools.

For Elite nadeo made a post about the Stats Elite Database in Alpha.

I will quote it here but they are not the original callbacks.

Code: Select all

CREATE TABLE IF NOT EXISTS `Captures` (
  `player` varchar(60) NOT NULL,
  `team` varchar(60) NOT NULL,
  `roundId` int(11) NOT NULL,
  `mapNum` int(11) NOT NULL,
  `mapName` varchar(75) NOT NULL,
  `matchId` varchar(13) NOT NULL,
  PRIMARY KEY (`matchId`,`player`,`roundId`,`mapNum`),
  KEY `fk_Capture_Match1` (`matchId`),
  CONSTRAINT `fk_Capture_Match1` FOREIGN KEY (`matchId`) REFERENCES `Matches` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `Eliminations` (
  `player` varchar(60) NOT NULL,
  `team` varchar(60) NOT NULL,
  `roundId` int(11) NOT NULL,
  `mapNum` int(11) NOT NULL,
  `mapName` varchar(75) NOT NULL,
  `matchId` varchar(13) NOT NULL,
  `eliminations` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`player`,`matchId`,`roundId`,`mapNum`),
  KEY `fk_Deaths_Match1` (`matchId`),
  CONSTRAINT `fk_Deaths_Match1` FOREIGN KEY (`matchId`) REFERENCES `Matches` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `Matches` (
  `id` varchar(13) NOT NULL,
  `name` varchar(45) NOT NULL,
  `team1` varchar(60) NOT NULL,
  `team2` varchar(60) NOT NULL,
  `startTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `isFinished` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `Shots` (
  `player` varchar(60) NOT NULL,
  `team` varchar(60) NOT NULL,
  `weaponId` int(11) NOT NULL,
  `roundId` int(11) NOT NULL,
  `mapNum` int(11) NOT NULL,
  `mapName` varchar(75) NOT NULL,
  `matchId` varchar(13) NOT NULL,
  `shots` int(11) NOT NULL DEFAULT '0',
  `hits` int(11) NOT NULL DEFAULT '0',
  `eliminations` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`player`,`weaponId`,`matchId`,`roundId`,`mapNum`),
  KEY `fk_Shots_Weapon1` (`weaponId`),
  KEY `fk_Shots_Match1` (`matchId`),
  CONSTRAINT `fk_Shots_Match1` FOREIGN KEY (`matchId`) REFERENCES `Matches` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_Shots_Weapon1` FOREIGN KEY (`weaponId`) REFERENCES `Weapons` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `Teams` (
  `team` varchar(50) NOT NULL DEFAULT '',
  `matchId` varchar(13) NOT NULL,
  `mapNum` int(11) NOT NULL,
  `mapName` varchar(75) NOT NULL,
  `attack` int(10) NOT NULL DEFAULT '0',
  `defence` int(10) NOT NULL DEFAULT '0',
  `capture` int(10) NOT NULL DEFAULT '0',
  `timeOver` int(10) NOT NULL DEFAULT '0',
  `attackWinEliminate` int(10) NOT NULL DEFAULT '0',
  `defenceWinEliminate` int(10) NOT NULL DEFAULT '0',
  `isFinished` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`team`,`matchId`,`mapNum`),
  KEY `FK_Teams_Match` (`matchId`),
  CONSTRAINT `FK_Teams_Match` FOREIGN KEY (`matchId`) REFERENCES `Matches` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


CREATE TABLE IF NOT EXISTS `Weapons` (
  `id` int(11) NOT NULL,
  `name` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

INSERT INTO `Weapons` (`id`, `name`) VALUES (1, 'Rail'),(2, 'Rocket');
The callbacks aren't providable but its possible to retrieve them with the first code i posted. As there is a console part to tell you what is being sent towards you.
TM² Info
SM Info
QM Info

OS: Windows 10 x64 Professional
MB: MSI 970A-G46
Processor: AMD FX-6300 3500 mHz
RAM Memory: 16 GB DDR3
Video: SAPPHIRE DUAL-X R9 280X 3GB GDDR5
KB: Logitech G510s
Mouse: Logitech G300s
Mode Creation
ManiaScript Docs
MuNgLo
Posts: 314
Joined: 12 Jul 2012, 03:37

Re: trying to get some elite stats

Post by MuNgLo »

Thx for the reply w1lla. I'll look into it. It's just a very roundabout way for me :( Then I would have to check who's attacker/defender, is it an active round and store it in a temporary table until the end of the match. Just to get the scores from the scoreboard.
But as I said I'll look into it.
MuNgLo
Posts: 314
Joined: 12 Jul 2012, 03:37

Re: trying to get some elite stats

Post by MuNgLo »

Where can I find info on what different cases (like playerHit) there is?
User avatar
Eole
Nadeo
Nadeo
Posts: 1265
Joined: 26 Apr 2011, 21:08

Re: trying to get some elite stats

Post by Eole »

For the time being all these infos (round begin/end, players score, hit, capture, etc) are not sent by the script via XmlRpc. There's only some remnants of an early implementation for the Gamers Assembly LAN in Elite, but it's very likely to change.
We will start to create a ManiaScript library specifically for this use after the next update. People we'll be able to use it to get some standard callback for their modes and we'll use it in the official modes too. So we'll come back to you with more informations at that time.
Meanwhile feel free to make some suggestions about the informations you would like to receive from the mode and we'll try to see if it's possible to add that to the library.
Contribute to the ManiaPlanet documentation on GitHub
A question about ManiaScript? Ask it here!
MuNgLo
Posts: 314
Joined: 12 Jul 2012, 03:37

Re: trying to get some elite stats

Post by MuNgLo »

What I had in mind is a really really simple ranking database for all the elite servers connected to it. All needed is the scoreboard really. Successful attackrounds and defender hits per player and the over all round score between the teams.
After that I'll calculate all I need.

I would say that sending all the scoreboard info on match end is an excellent first step. Imo this should probably happen on any mode. Another thing would be to on match start to. So you can check for playerswitches midgame. Also stick in a flag for warmup or not in each roundstart.

Bare in mind that I'm still trying to get some time in to get familiar and up to date with what features there is now and what's planned.
Post Reply

Return to “Dedicated Server Tools”

Who is online

Users browsing this forum: No registered users and 0 guests