Dedimania forum

Feel free to express yourself on your favorite dedicated related tool.

You are not logged in.

#1 2009-04-14 17:51:38

Fast author / Dedimania maintainer
From: Traxicoland
Registered: 2006-11-23
Posts: 879

Old API: FAQ for script devs

FAQ about old (ie TMO/TMS/TMN/TMF) Dedimania API

Replying to some questions, i thought that it could make a good start for a FAQ, so here it is !  wink

about any 2 minutes it makes an UpdateServerPlayers and on launch of the next race the next CurrentChallenge...

4 minutes is enough, 3 minutes is ok, less is unusefull and increase the number of requests (remember that there are nearly 2000 servers/scripts connected actually). The tmstats page consider > 300s (ie 5 min) before showing the server as off.

1) packmask: same settings than in orig serverconfig? are things like "Stadium,Rally,Island" allowed or empty if more than 1?

No, you should send the GetServerPackMask value  wink

2) CurrentChallenge
In the CurrentChallenge-part there is the Field "NextFiveUID".

Do your best, or leave it blank. It was asked by Vegeta who made the main dedimania site at beginning. Personnally i don't really care.

3) Nearly any send is followed by a WarningsAndTTR at moment for debugging - should i remove them for performance later or arent they a problem?

Keep it, there is no performance issue on dedimania side with it, and it is very small (except when there is a problem ^^).
It can help users to understand problems if they have it in your script log.

4) PlayerArrive
ON scriptstart - should the script make a playerarrive for any player in that moment or is it ok to make it at ChallengeRaceTimes?

You can skip PlayerArrive call, all datas are also in dedimania.CurrentChallenge and dedimania.UpdateServerPlayers. You can also group several of them one query rather than making a request for each player individually.

In the future (soon), perhaps that the api changes will add some more infos returned by this method, then it's possible that you will have more interest to use it.

5) Playerleave
Dont think that there are limitations for u - but: if a player drives a time, and leaves the server than before trackend (playerleave is sendet) should that time be submitted also? atm it is skipped

You can send its time after he has leaved, it's not a problem at all.
You can skip Playerleave call, it's not a problem.

6) Empty Server
What to do if Server is empty - no players at all? i'm skipping ChallengeRaceTimes atm if no useable time is collected, but CurrentChallenge? If no Player is there it makes errors, if a clear player is inserted also, skip it also? but thought it is needed on your side? (Warning in method_helper.php(830): update failed for player TMU: : not found) -> i know that its wrong but what to do in that moment? skip it? or should i deactivate dedimaniamodul till a player arrives? but then its something like "offline" on your side?

You can skip ChallengeRaceTimes. Personally i send UpdateServerPlayers every 3 minutes after CurrentChallenge, so CurrentChallenge is not really more than a UpdateServerPlayers for an empty server.
You should continue to send it, so your server is visible alive on tmstats.

About the error with an empty player list, it is strange. You give an empty array ?  Btw i will check it, it should not make an error.

7) warnings
WarningsAndTTR is delivering different answers very often - maybe
Warning in method_helper.php(1160): Number of checkpoints for map xxxxx set to : 7
Error: Warning in method_helper.php(1070): Ignore record for noram : checkpoints times are mandatory for TMUF/TMNF servers !
both are clear and only for example now - but can i say if there is no "Error" at begin that its accepted? i know the first isnt an "error" like this than more an info...

sadly xmlrpc give no nice way to handle other thing that pure error (without returning any other thing). I did not add warning/info levels, so yes infos, warnings and errors are melt  :?
I will try to put a 'INFO:' at begining of info messages...

8 ) replays
havent done anything in that way till now - but if i understand right u arent finish in that part also? or are there examples or something available?

new api should come soon (most will stay the same, some args added, some responses completed)

9) encoding - my only real problem atm sad
Most infos i have from, some things from forums and soon... maybe its easiest to give u an example-send:


POST /Dedimania HTTP/1.1
User-Agent: TM-DeReCo-RPC TM-DeReCo
Accept-Charset: UTF-8,ISO-8859-1,US-ASCII
Content-Type: text/xml; charset=UTF-8
Content-Length: 2445
Keep-Alive: timeout=600, max=2000
Connection: Keep-Alive

<?xml version="1.0" encoding="UTF-8" ?><methodCall><methodName>system.multicall</methodName><params><param><value><array><data><value><struct>
</member><member><name>Nation</name><value><string>World|Germany|North Rhine-Westphalia|Dortmund</string></value>
<value><string>Sun is Raceing</string></value>

(In newest version i have changed checks to a string like <member><name>Checks</name><value><string>5420,8490,11790,26080,29790,45760,49380</string></value></member> as seen in forum that its accepted also )

This is a ChallengeRaceTimes without any errors at end with 2 players (1 with score). (password cleared here)
On that Track it isnt a Problem - but sometimes there are (off course) "bad" tracknames,... which encoding should be used?

Most time it is because "many" nicknames and mapnames have bad utf8 in it (which can also be a problem with manialinks).
If you use a real utf8 filter on names, you should not have problems any more.

dedimania use the parse() method of a new IXR_Message (from, so if it fails to decode the sent xmlrpc, i can't do anything with the data...

10) in your RPC4/server.php u write "The value for the 'xmlrpc' attribute is just a xmlrpc text, urlsafe base64 encoded." didnt understand it clearly sad

You are using a real http/xmlrpc request, so you don't care about this.
It was an alternative to permit to use standard html GET or POST.

11) one track i know that makes trouble is for example "On & On" by Kev_Fan, the "&" is in plaintext a problem, but which encoding should be used and for what parts of the sending?  all or only the strings for it own or ...?

If you are using a xmlrpc encoder (like the one included in, then you don't have to care about it.  If you build it yourself then yes, of course, all datas must be xml compliant, and so strings have to be encoded using htmlspecialchars() or equivalent.

12) what about requests/responses compression ?

Dedimania handle standards http compressions : deflate and gzip, and it's responses http headers indicate them.
Both deflate and gzip are accepted to receive and send datas.

Compression should really be use !  xmlrpc use lot of clear text, and such text is dramatically reduced in size using compression. So using compression really save lot of bandwidth !

13) what about http keepalive ?

It is highly recommended to handle correctly the http keepalive (with long timeout) on the client side, especially if your script is widely used !   It avoid to make a new connection for each request, which use less resources on server side, and avoid connection timeouts on the client script side.

14) what about http cookies ?

It is better if your client support cookies, btw it is actually not a real problem to not support it.

15) what url/ports should be used by scripts to send requests to Dedimania ?

You have to use the url/ports indicated for your script (or script family) in this post. For those which can use several ports, choose one randomly at startup of the script, then continue on it. If you use keepalive then of course the idea to change the url/port should not come in your mind as you keep the same connection opened... should not be used except eventually for the initial dedimania.Authenticate, when the login/pass is unsure.

16) dedimania.Authenticate login

Only the real login of the dedicated on which the client script is connected should be used. You can authentify using the password or the community code, both should work.

Note: please, make your script disable its calls to Dedimania if the login/pass has not be configured, ie if they are the default ones that you have set in your default config. Testing stupid wrong login/pass for nothing make dedimania loose time and resources for nothing.

17) Dedimania and UTF-8

Dedimania accept the same utf-8 chars as the dedicated server. See this post.
In many cases the xmlrpc decoder will fail if the client send wrong utf-8 chars, ie if the builtin php5 xml_parser_create('UTF-8') fail to parse the received data (this parser is used by GbxRemote, which is used by Dedimania to decode xmlrpc requests and encode xmlrpc responses).


#2 2010-12-10 19:50:02

New member
Registered: 2010-10-11
Posts: 3

Re: Old API: FAQ for script devs

Dear slig,

I have been playing TM now for about 2-3 years and I saw lots of scripts for Trackmania and alle the dedicated servers so far. Now I have some questions, especially concerning the exposure to the Dedimania database for developers, because I haven't seen my answer in any thread yet.
And ... because I don't want to post it here in this FAQ thread (you can delete this post after reading it), i wondered if it's possible to write a mail to you or use any private message function, IM...
So it would be really glad to hear from you I would like to apologize my incomplete English skills. =P

ICQ: 398721304
Or is there any PM function I haven't seen yet?

Macximilian / Schnapsi


#3 2010-12-11 18:33:11

Fast author / Dedimania maintainer
From: Traxicoland
Registered: 2006-11-23
Posts: 879

Re: Old API: FAQ for script devs

Eventually i will reply by email if it is a little long, but start using the tm-forum PM function : … &u=487


Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson