Author Topic: Replay logging  (Read 8095 times)

alanrotoi

  • Having only spam addict friends
  • ********
  • Posts: 3982
  • Suck my Indy!
    • View Profile
    • Maite Zaitut, La Vengadora Oscura
Replay logging
« on: February 02, 2013, 08:58:42 PM »
Is there a possibility to make an automatic statistic program? Only with reading the replay?

dreadnaut

  • Helen`s Lover
  • **
  • Posts: 636
    • View Profile
    • chezDreadnaut
Re: Replay logging
« Reply #1 on: February 03, 2013, 12:23:46 AM »
What kind of statistics?

alanrotoi

  • Having only spam addict friends
  • ********
  • Posts: 3982
  • Suck my Indy!
    • View Profile
    • Maite Zaitut, La Vengadora Oscura
Re: Replay logging
« Reply #2 on: February 03, 2013, 08:54:52 PM »
Section times.

Friker

  • Otto's Student
  • **
  • Posts: 385
    • View Profile
Re: Replay logging
« Reply #3 on: February 03, 2013, 10:51:48 PM »

Duplode

  • Moderator
  • Considering trying out spam
  • *****
  • Posts: 3430
  • Through the astral door - to soar
    • View Profile
    • The Southern Cross Stunts Trophy
Re: Replay logging
« Reply #4 on: February 03, 2013, 11:05:58 PM »
Section times.

Nope.

Because the .RPL file saves laps as keystrokes, so you need the game engine to know where the car is at each instant. (That's the same reason why the various RPLInfo implementations can't detect penalty time.)

dreadnaut

  • Helen`s Lover
  • **
  • Posts: 636
    • View Profile
    • chezDreadnaut
Re: Replay logging
« Reply #5 on: February 04, 2013, 02:26:31 AM »
How much code from restunts is reusable? Could the replay engine (i.e., the fast forward button) be used to run replays?

Friker

  • Otto's Student
  • **
  • Posts: 385
    • View Profile
Re: Replay logging
« Reply #6 on: February 04, 2013, 10:13:48 AM »
How much code from restunts is reusable? Could the replay engine (i.e., the fast forward button) be used to run replays?

I don't know. I was thinking about simulating a replay and now - blink - that's it - guys from stuntschallenge.net could run the game with a given replay, couldn't they? And also they could determine a time with penalty! Oh.. definitely we should ask them how is it possible (to run the game with a given replay). At least, it should be possible to run an environment which can capture key strokes and they make a list of key strokes to input (press enter at 10 secs, right key twice at 15 secs, x times down, then type a filename of replay, ...). 

CTG

  • Spam, egg, spam, spam, bacon and spam
  • *
  • Posts: 20046
  • Psycho
    • View Profile
    • UnskilledStunts Championship
Re: Replay logging
« Reply #7 on: February 04, 2013, 11:11:44 AM »
How much code from restunts is reusable? Could the replay engine (i.e., the fast forward button) be used to run replays?

I don't know. I was thinking about simulating a replay and now - blink - that's it - guys from stuntschallenge.net could run the game with a given replay, couldn't they? And also they could determine a time with penalty! Oh.. definitely we should ask them how is it possible (to run the game with a given replay). At least, it should be possible to run an environment which can capture key strokes and they make a list of key strokes to input (press enter at 10 secs, right key twice at 15 secs, x times down, then type a filename of replay, ...). 

The stuntschallenge guys are in our midst... I don't really like the way of this whole hacking development. It will be a great weapon for "high-tech" cheaters (although I think some of us already have the tools for creating superb replays without touching stunts_k.exe).

The only way to avoid any kind of cheating is a special rule set, like in ZSC 2007, for example: you should hit all the signs, stay in the right lane or whatever - anything that can't be generated by softwares (or at least it's too much effort to write a new code for that).
« Last Edit: February 04, 2013, 11:14:47 AM by CTG »

dstien

  • Moderator
  • Stunts Master
  • *****
  • Posts: 160
    • View Profile
    • Stunts Tools
Re: Replay logging
« Reply #8 on: February 04, 2013, 12:28:07 PM »
How much code from restunts is reusable? Could the replay engine (i.e., the fast forward button) be used to run replays?
Restunts is just a 1:~1 translation from ASM to C. The replay functions haven't been documented yet, but I don't think there should be any problems* creating a separate executable that loads a replay, iterates through the buffer and dumps the final game state without the need to invoke any display code. Locating the needed functions and their signatures should be enough, as we are mixing ported and untouched code in the build process.

*) No problems besides lack of time.

Duplode

  • Moderator
  • Considering trying out spam
  • *****
  • Posts: 3430
  • Through the astral door - to soar
    • View Profile
    • The Southern Cross Stunts Trophy
Re: Replay logging
« Reply #9 on: February 04, 2013, 04:09:12 PM »
I was thinking about simulating a replay and now - blink - that's it - guys from stuntschallenge.net could run the game with a given replay, couldn't they? And also they could determine a time with penalty!

IIRC Wind (one of the stuntschallenge.net developers) said they ran the replays in-game used a modified DOSBox. That doesn't sound convenient for simulations...

While I'm not terribly excited about any dreams of automated replay generation (see CTG's post), I would be very happy with after-the-fact analysis tools. The crucial one, I guess, would be a logger which recorded the car position at every instant over a lap. (Dstien and co.: how hard would be doing that today given what we already know? I believe we already have located where the coordinates are stored in the ASM, but I am too clueless about debuggers and other low-level stuff to know how far along the way that takes us.)
« Last Edit: February 04, 2013, 04:11:42 PM by Duplode »

dreadnaut

  • Helen`s Lover
  • **
  • Posts: 636
    • View Profile
    • chezDreadnaut
Re: Replay logging
« Reply #10 on: February 04, 2013, 04:28:43 PM »
@CTG: You're smart enough to sketch a dimensional analysis for the problem of automatically generating a decent replay yourself. Not sure why you keep bringing this up :|   And sections times would indeed be an interesting stat to extract from replays, we could make all sorts of crazy graphs! :)

The replay functions haven't been documented yet, but I don't think there should be any problems* creating a separate executable that loads a replay, iterates through the buffer and dumps the final game state without the need to invoke any display code. [...] *) No problems besides lack of time.

This, included the footnote, is what I was thinking. Run the game "engine" and print a list of tiles and times when a tile is reached —that's what you need for most statistics, including section times.


While I'm not terribly excited about any dreams of automated replay generation (see CTG's post), I would be very happy with after-the-fact analysis tools. The crucial one, I guess, would be a logger which recorded the car position at every instant over a lap. (Dstien and co.: how hard would be doing that today given what we already know? I believe we already have located where the coordinates are stored in the ASM, but I am too clueless about debuggers and other low-level stuff to know how far along the way that takes us.)

Two other things related to this come to my mind: dosbox has an integrated debugger —can it watch memory locations? and also, if we know where tile coords are kept in memory, we could just write a small tsr to dump them to a text file.

alanrotoi

  • Having only spam addict friends
  • ********
  • Posts: 3982
  • Suck my Indy!
    • View Profile
    • Maite Zaitut, La Vengadora Oscura
Re: Replay logging
« Reply #11 on: February 04, 2013, 11:49:47 PM »
@CTG stallin shut up!

Zak once did some code where the result was how meny times accel and breaks butons were pressed, remember?

Friker

  • Otto's Student
  • **
  • Posts: 385
    • View Profile
Re: Replay logging
« Reply #12 on: February 05, 2013, 01:17:54 AM »
well, i have to admit that - for me - write a replay generator is far more easier than getting some idea about low level code/ debugging. still i cannot spend a time with that (and its level is comparable to high-level master degree theses at our faculty).

btw a car position is probably irrevelant for section times because you can leave (at least) one tile out w/o penalty. which is leading to a question - does anyone know how is penalty counting?

dreadnaut

  • Helen`s Lover
  • **
  • Posts: 636
    • View Profile
    • chezDreadnaut
Re: Replay logging
« Reply #13 on: February 05, 2013, 02:24:27 AM »
well, i have to admit that - for me - write a replay generator is far more easier [...]
You may think that, but on top of the dimensionality issue you have others: it's hard to evaluate solutions (need to run the replay¹), it's hard to evaluate partial solutions (need to reach the finish line, or set mid-lap goals which might be tiles you would actually skip), etc. A probabilistic/big-data solution might have more success, feeding on thousands of replays of winning drivers, but it's still much more than an MSc thesis.

[1] and this actually solves the whole "let's get section times!" idea!

Quote
btw a car position is probably irrevelant for section times because you can leave (at least) one tile out w/o penalty.

Section times would be measured on tiles you are sure to drive through, I suppose. It's still arbitrary stats anyway, so it's not really a problem.
« Last Edit: February 05, 2013, 02:58:59 AM by dreadnaut »

dstien

  • Moderator
  • Stunts Master
  • *****
  • Posts: 160
    • View Profile
    • Stunts Tools
Re: Replay logging
« Reply #14 on: February 06, 2013, 01:14:22 AM »
Dstien and co.: how hard would be doing that today given what we already know? I believe we already have located where the coordinates are stored in the ASM, but I am too clueless about debuggers and other low-level stuff to know how far along the way that takes us.

Should just be a matter of getting the coordinates from the player matrix for each tick. Would be neat to overlay the resulting paths on a track map in order to compare racing lines.

Two other things related to this come to my mind: dosbox has an integrated debugger —can it watch memory locations? and also, if we know where tile coords are kept in memory, we could just write a small tsr to dump them to a text file.

The DOSBox debugger allows you to browse the memory and set breakpoints on changes. It's very helpful to locate and inspect code. Replays loaded from Main screen -> Options are fully processed to the end before the world is rendered, so going from there with a breakpoint on file reads (DOS interrupt) would probably be sensible.

Regarding the conspiracy theory/pipe dream about a perfect replay generator; you must have been watching too many computer science Hollywood movies, CTG. The individuals who are capable of doing that aren't tapping their feet, waiting for us hand them reversed code they could write themselves in their sleep. They're busy raking in Nobel prizes and building self-aware quantum computers.