Author Topic: log playback  (Read 3613 times)

0 Members and 1 Guest are viewing this topic.

gulca

  • Zone Leader
  • ***
  • Posts: 308
log playback
« on: January 20, 2014, 01:50:56 PM »
Anyone ever manage to make a log playback work?

It is like if you run the script on a saved log, it would display the log at the same rate like it was in mud.

I have an idea how to make it work but I'm just wondering if it is a normal thing that others have done. Don't want to re-invent the wheel.

Just for the curious, here is what I would do:
1. (tintin++) Start time of log. <- This would be starting point.
2. (tintin++) Output all incoming messages from mud to a log file, with a delta time (calc from 1) parsed at the beginning of each line.
3.  Run a perl script that parses the log and spit out the lines (when time has reached).

This way, you can re-run any big fights logs and see the spam like you would having it recorded in a video.

Zozen

  • Immortal
  • Zoner
  • *
  • Posts: 225
Re: log playback
« Reply #1 on: January 20, 2014, 05:24:01 PM »
Cool idea. Make it work!

raf

  • Newbie
  • Posts: 21
Re: log playback
« Reply #2 on: January 20, 2014, 05:48:35 PM »
This comes with JMC but isn't part of JMC proper I don't think so it should work with any ansi log.
----

  RMUD ANSI PLAYER - RMA (C) 1998 Andrey Fidrya (andrey@alex-ua.com),
                                  RMUD (telnet://rmud.techno.ru:4000)

  RMA is freeware. You can distribute it in any way, but this file
  (rma_doc.txt) and executable one (rma.exe) must not be separated.

  This version of RMA is distributed within JMC MUD client by Sergey Ilin.
  It can be used to view RMA LOG files generated by JMC or RMUD server.
  To view such file, just type: rma.exe [filename]. You can run rma.exe
  with no parameters to read the help.

  What is RMA? Basically, it is simple ANSI player with one new code added:
  [ESC]p:[millisecs]m  , where [ESC] is escape code
                               [millisecs] amount of time to pause

  RMA gives you an ability to view MUD logs (battles, challenges etc) in
  full realism, with colors and pauses. Give it a try and you will surely
  like it.

  If you wish to contact an author of RMA PLAYER, send a letter to
  andrey@alex-ua.com or fido 2:463/103.

  Also, you are welcomed in RMUD - the first MUD which uses russian
  language for player communications... It is currently in gamma stage
  of playtesting. Connect to: telnet://rmud.techno.ru:4000, or visit
  our web page at http://rmud.techno.ru. The new versions of RMA PLAYER
  will appear here eventually in the "Links" menu.



gulca

  • Zone Leader
  • ***
  • Posts: 308
Re: log playback
« Reply #3 on: January 20, 2014, 06:39:13 PM »
@raf

I've read JMC documentation but never used it myself. I'm wondering if anyone has used that feature.

I'm really not interested in the executable though (no source code).

I would like to make this work on "open source code" and free clients.

Both Tintin++ and Perl can be downloaded for free and works in linux/windows.

And if we get the "logic" of the code working (and explained), it would be easier for others to change it to suit their mud clients.

************
Imagine if we can get this up and running and people can post logs on the website, and viewers can click and watch the logs like they were there when it happened. :)

I have nothing against reading logs, but where is the adrenaline when you have to slowly scroll down the text file??

gulca

  • Zone Leader
  • ***
  • Posts: 308
Re: log playback
« Reply #4 on: January 21, 2014, 01:54:22 AM »
Cool idea. Make it work!

Got a bit of free time to do some coding tonight.

Here is the tintin++ trigger to start logging to a file: testme.txt
Code: [Select]
#alias {tstamp}
{
 #format timestamp %U;
}


#EVENT {RECEIVED LINE}
{
tstamp;
    #line log {$logfile} {$timestamp %0};
}

#var logfile testme.txt;

Here is the Perl script to read in the log file saved from above.
Code: [Select]

use Time::HiRes;
my $file = "testme.txt";
print "Opening file: $file\n";
open my $in,  '<',  $file      or die "Can't read old file: $!";
$totcount = 0;
#$perlstarttime = time();
$perlstarttime = Time::HiRes::gettimeofday() ;#* 1000000;

print "Start time now is $perlstarttime\n";
$firstlogtime = 0;
while( <$in> )
{
# print "$_\n";
# chomp;
 $newstring = $_;
 @newstring = split(" ",$newstring);
 $logtime = shift @newstring;
 $logtime /= 1.0e6;
 if($firstlogtime == 0)
 {
  $firstlogtime = $logtime;
  $deltatime = $firstlogtime - $perlstarttime ;
  #print "deltatime is $deltatime \n";
 }
 $curtime = Time::HiRes::gettimeofday() ;#* 1000000;
 $tcurtime = ($curtime + $deltatime);
 $adddelta =  $tcurtime - $logtime;
 #print "xxx $tcurtime yyy ", ($tcurtime - $logtime), " zzz $logtime\n";
 while( $tcurtime  < $logtime)
 {
  if(($logtime - $tcurtime) > 2) {print "Skipping ", -int($adddelta), " secs \n";$deltatime += abs($adddelta);  Time::HiRes::sleep(0.5);last;}
  Time::HiRes::sleep(0.001);
  $curtime = Time::HiRes::gettimeofday() ;#* 1000000;
  $tcurtime = $curtime + $deltatime;
   }
 print "@newstring\n";

 Time::HiRes::sleep(0.001);
}
print "End of log\n";

I'm in windows xp, used Wintin++ and Perl: Padre Editor (DWIM Perl) to run them. Works ok.

Here is the portion of the logfile
Code: [Select]
1390349575330785 You say 'hi friends'
1390349575330786
1390349575330787 98H 94V 2731X 10C Exits:D>
1390349575830785 The Reception
1390349575830786 A large heavy tome made from silver and gold rests here...it glows dimly
1390349575830787 A loaf of bread has been left here. [12]
1390349575830788 A small hoopak has been stuck in the ground...it hums softly
1390349575830789 An ancient key made of granite and crystal has been dropped here.
1390349575830790 A large board with numerous wanted posters tacked on it is here.
1390349575830791 <Maza> Pousoidis Pestrofas, Maza Beast is standing here. (flying)
1390349575830792 <Myth> Begsby the Mythical Keg Smashing Hooligan is standing here. (flying)
1390349575830793 Sahib, captain of the Solace peacekeepers patrols the area.
1390349575830794 <Maza> Mpriki Teneke'denio, the White Mazmpire is resting here. (flying)
1390349575830795 . . . emits an eerie glow.
1390349575830796 Dandrea, Noble Lady of Palanthas is standing here.
1390349575830797 A girl twirls her hair in the Solace Tourist Information booth.
1390349575830798 A man wearing heavy armor is standing here.
1390349575830799 A receptionist sits here doing her nails.
1390349575830800
1390349575830801 98H 94V 2731X 10C Exits:D>
1390349578205785
1390349578205786 Dandrea says 'I am Lady Dandrea.  I am very pleased to meet you.'
1390349578205787
1390349578205788 98H 94V 2731X 10C Exits:D>
1390349579893785
1390349579893786 Pousoidis says 'oe'
1390349579893787
1390349579893788 98H 94V 2731X 10C Exits:D>
1390349582705785 You say 'i need someone to talk to '
1390349582705786
1390349582705787 98H 94V 2731X 10C Exits:D>
1390349584143785 You say 'oeoe'
1390349584143786
1390349584143787 98H 94V 2731X 10C Exits:D>
1390349584455785
1390349584455786 Dandrea says 'And what do you wish to talk about?'
1390349584455787
1390349584455788 98H 94V 2731X 10C Exits:D>
1390349584643785
1390349584643786 Pousoidis stops using a crystalline spear.
1390349584643787
1390349584643788 98H 94V 2731X 10C Exits:D>
1390349589268785
1390349589268786 Pousoidis says 'to talk to'
1390349589268787
1390349589268788 98H 94V 2731X 10C Exits:D>
1390349590768785
1390349590768786 Dandrea says 'And what do you wish to talk about?'
1390349590768787
1390349590768788 98H 94V 2731X 10C Exits:D>
1390349593455785
1390349593455786 Pousoidis says 'a should to cry on?'
1390349593455787
1390349593455788 98H 94V 2731X 10C Exits:D>
1390349595955785
1390349595955786 Dolan rests his hand on the hilt of his sword and looks around the inn.
1390349595955787
1390349595955788 98H 94V 2731X 10C Exits:D>
1390349596143785
1390349596143786 The receptionist shows Begsby to his room.
1390349596143787 Begsby sinks gently to the ground.
1390349596143788
1390349596143789 98H 94V 2731X 10C Exits:D>
1390349603080785
1390349603080786 Dandrea leaves down.
1390349603080787
1390349603080788 98H 94V 2731X 10C Exits:D>
1390349604768785
1390349604768786 Someone shouts 'its a party its a party its a party'
1390349604768787


Updated the code, so it skips waiting time for more than 2secs.
« Last Edit: January 21, 2014, 07:46:31 PM by gulca »

Anthony

  • Newbie
  • Posts: 38
Re: log playback
« Reply #5 on: January 21, 2014, 09:15:18 AM »
I guess I question the value of making a playback tool based on a specific log format. You have prompts, how much log fidelity are you going to be missing by just using the prompts as your timing mechanism, especially if your proprietary log format can't have more granularity than seconds anyways.

gulca

  • Zone Leader
  • ***
  • Posts: 308
Re: log playback
« Reply #6 on: January 21, 2014, 11:05:27 AM »
I guess I question the value of making a playback tool based on a specific log format. You have prompts, how much log fidelity are you going to be missing by just using the prompts as your timing mechanism, especially if your proprietary log format can't have more granularity than seconds anyways.

I don't quite understand what you are trying to say. Maybe I was unclear about what the script does.

1. It is not prompt dependent. It appends the timing information at each line received from the mud.
2. Because of #1, you get exactly the same log you see on your screen during playback.
3. There is no proprietary log format. That was the whole point. If you can put the timing info inside your log, the Perl script will run it.
4. The seconds limitation may only be true to the function I'm using in Tintin++. If your mud client allows sub-seconds to be recorded, then you can use different Perl timing to catch that. That would make it more like real mud output.
5. Mud fights goes in 4 secs per round anyway. You don't lose much. I put a 0.01 seconds delay on each line so it doesn't zoom pass like a flash.

You might be saying what is the difference from using prompt to trigger timing? That would be way more complicated (eg to catch continuous "enter" spams, or deduce the actual timing each passing lines/prompts.) I'm an engineer. I like simple solutions.

Edit: Modified the above code to work in milli seconds. Now its very close to the original mud output rate.
« Last Edit: January 21, 2014, 05:19:43 PM by gulca »

Anthony

  • Newbie
  • Posts: 38
Re: log playback
« Reply #7 on: January 21, 2014, 07:12:22 PM »
I'm talking about a playback tool that can closely mimic mud output for any arbitrary log of Arctic ever produced. You're talking about a playback tool that can closely mimic mud output for a specific log format generated from this point forward.

I am proposing that the accuracy gained by your new log format, allowing you to pause on a prompt for 3 seconds until the mud actually sent you output versus the backwards compatibility gained by assuming that every prompt was a pulse is not worth it.


gulca

  • Zone Leader
  • ***
  • Posts: 308
Re: log playback
« Reply #8 on: January 21, 2014, 07:55:34 PM »
@Anthony

Nod, this is not for everyone and this script is definitely not going to parse any log that doesn't have time info in it.

But for the rest of the people, feel free to tinker with the code.

Cleaned up the code a bit so any "afk" moments are cut short with a message Skipping X secs.