The online racing simulator
MPR parser in PHP5.
(8 posts, started )
MPR parser in PHP5.
Hi guys,

I've been working on a MPR-parser for what could be a new lfs-league. I'm going to release it as a opensource project when I think it is stable enough, so everyone who would like, could use it.
I've read the header-format from Scawen, and its easy to follow, but as I see it, the player-names listed in the header only shows the playernames finishing the race. So if someone drops out midgame, they will not show up. Is there any other way to get the player-table from the MPR without doing a lot of guessing? (iow, have someone stumbled into this problem before?)

I'm afraid its all guess work if you're parsing the mpr file directly.
Yes, I have encountered that problem too. What I did was look for usernames that could possibly have been racing. Eg. I was working with a system with divisions, and it would simply search the file for the people registered for that division.

The lfs-usernames are indeed stored, but not listed. But this has been adressed to scawen like a thousand times, so I bet he will come with a new MPR header format sometime
Quote from Frankmd :So I bet he will come with a new MPR header format sometime

Hope you mean new MPR format... Would love to be able to make sense of the entire file for personal reasons. No, not cheating.
same here...

i just compare the list of user names with the list of finished racers...
if a racer is in the username list, but not in a header, he gets a DNF
in he is not in both lists, he gets a DNSH

look here for a way to get the list of usernames...


better solution might be not to parse MPR, but to make a program to save an insim output of a race to a file, and then parse it
Thanks guys. Will do some research for this in the xmas break (if any)
Quote from TagForce :Hope you mean new MPR format... Would love to be able to make sense of the entire file for personal reasons. No, not cheating.

I wouldn't bet on that. We have been told that the MPR format is probably ... some kind of "modified", e.g. add time indexes to 'jump' within the replay but only from within LFS. As far as I know it is like a stream of in-game data, thus making it playable forward only and running LFS as dependency.
Quote from Messiah :I wouldn't bet on that. We have been told that the MPR format is probably ... some kind of "modified", e.g. add time indexes to 'jump' within the replay but only from within LFS. As far as I know it is like a stream of in-game data, thus making it playable forward only and running LFS as dependency.

Of course we won't be able to do anything with the replay itself outside of LFS, even if it IS a frame by frame state file at 36fps... But it would help greatly if we were able to get stats from the MPR files directly, rather than having to actually 'play' the entire race and use in/out sim packets. Not only would it help US users, but it would help LFS as a platform for tournaments/seasons in online racing... Just look at some of the NASCAR 2003 Season standings... at the moment it's impossible to create something like that in LFS without having to watch the entire replay over and record the info realtime in a side app at the risk of losing some data. Moreover the replays themselves and therefor the resulting video output would be a lot smoother because it's easier to interpolate and smooth movement if the data further up in the replay can be read ahead and taken into consideration.

Get what I'm going for?

MPR parser in PHP5.
(8 posts, started )
FGED GREDG RDFGDR GSFDG