Results 1 to 6 of 6

Thread: Debugging your bots with video recordings

  1. #1
    Join Date
    Oct 2012
    40 Post(s)
    586 Post(s)

    Default Debugging your bots with video recordings

    Do your bots ever run into a problem? Would you like to see the last couple of seconds/minute of gameplay leading up to this problem?

    With this include + ffmpeg, you can add video recording to your script as easily as:
    Simba Code:
    {$include_once recorder.simba}    

      VideoRecorder.Start(10, 15); //15 second clips @ 10 fps
      TheScript(); //Your bot's code
    In this example above, whenever the script is terminated you would have a video recording of the last 15 seconds ingame. This is similar in concept to Nvidia's Shadowplay.

    Combine these video recordings with a notification system (e.g. that lets you know whenever a bot stops and I really think you won't need to manually watch your bots in action anymore. Also, this could be used for getting better debugging information from other people, if you have other people running your scripts.

    See the "Extra Features" section for more information on what else the include can do.


    Windows 7+ (other OSs have not been tested)
    Simba 1.2+

    Simba 1.2+
    Slacky's 1.2 was used to develop this:
    Place into your simba folder if it's not already there (SRL/SRL users likely already have it)

    Olly's 1.3 (in development) currently also seems to work with this recorder. Simba 1.1 & the 1.2 without slacky's fixes don't seem to.

    64 bit ffmpeg needs to be available through command prompt, however way you want to do that should be fine. Latest stable version currently is 4.0.1. Older versions might not work.
    One way to do this be to:
    -download the latest 64 build from (Here's the direct download link I used, the 4.0.1 versions work too.)
    -extract and put this into your c: folder as ffmpeg
    -append C:\ffmpeg\bin to your environment variables. (this filepath should be leading to ffmpeg.exe, if it doesn't, you probably messed up somewhere)

    Video demonstration
    Alternative source of video

    This should be moved to your include folder, e.g. C:\Simba\Includes

    Confirming it works
    You can test if this has all been setup properly.
    1) Enter ffmpeg into command prompt. Did it work or was it not found? See "Video demonstration" for how this looks.

    2) trying to use the recorder. open up simba and try to run the following code
    Simba Code:
    {$include_once recorder.simba}    

      VideoRecorder.Start(10, 5); //5 second clips @ 10 fps
      wait(6000); //simulates a script running for 6 seconds
    You should see the following output
    Compiled successfully in 530 ms.
    Stopping Recorder and doing a final save.
    Saving 50 Images to temp_videos\temp_images1
    Generating video: temp_videos\output1.mp4
    Successfully executed.

    Extra Features

    Saving a video whenever you want

    Would you like to record video of an issue but also have your bot keep on going? You can call .Save() with whatever video name you want.
    Simba Code:
    This would save the last X seconds (whatever clip duration is set to) as a video named error.mp4

    Changing the folder that videos are saved in

    By default the videos will be saved in the folder temp_videos, inside your simba directory. You can change this folder to whatever you want, here's two examples.
    Simba Code:
    VideoRecorder.MainFolder := 'test';
    This would now save videos in the folder test, inside your simba directory

    Simba Code:
      SCRIPT_FOLDER = 'C:\Users\USER\Desktop\EpicScript';
      RSN = 'zezima1337';

      VideoRecorder.MainFolder := SCRIPT_FOLDER + '\' + RSN;
    The path here in SCRIPT_FOLDER would need to already be existing. If this is the case, you'd now be saving videos in the folder zezima1337. Full path C:\Users\USER\Desktop\EpicScript\zezima1337
    USER in this example ofcourse would need to be changed to whatever was correct for your system.

    Recording the desktop's mouse

    Simba Code:
    VideoRecorder.RecordMouse := True;
    Self Explanatory ^

    You can also change the mouse's size and color, e.g like so:
    Simba Code:
    VideoRecorder.MouseColor := 13606815;
    VideoRecorder.MouseSizeX := 2;  
    VideoRecorder.MouseSizeY := 5;
    This will be an odd mouse ^ leaving these as defaults is fine.

    The MouseColor's data type is "TColor". See here for conversions to TColor

    Not recommended
    Saving constantly

    If your script crashes due to something like an access violation, then whatever is set to run on terminate won't be ran. You could 0) Shrug your shoulders and just try to fix the code giving acess violations 1) wrap your code in a try block and lose out on debug messages 2) wrap the code that gets an access violation with something like try BadCode(); except TerminateScript(); so that it terminates more gracefully or 3) save to disk constantly

    I'd recommend #2 or even #0, but if you want to do #3 you could. Like so:
    Simba Code:
    VideoRecorder.SaveConstantly := True;  
    VideoRecorder.KeepCopies := 3; //is 2 by default
    I don't recommend this because it's pretty resource intensive, even if you set .DontProcessVideos to true (which means that only the images are saved to disk, processing into a video via ffmpeg is skipped).


    The images in memory are quite raw and thus they take up quite a bit of space. I would thus recommend playing around with clip duration and clip FPS to determine what works best for you memory usage wise. If somebody else is interested in making higher fps/much longer durations feasible, they should look into adding in image compression.

    I'm probably not going to be adding much more functionality to this project, if at all. If you wish to create an alternative to this program I'd be very happy to link it here and recommend it to others, even if it's simply a small fork of this project.


    If you know of/make an alternative video recorder for simba bots, let me know and I'd be happy to list it here.

    @slacky; for both explaining that this was feasible with just a simba include and for helping to make this a reality.
    @Citrus; for mentioning ffmpeg and how it can be used via a simba script
    Other people in the srl discord for discussing this/helping test it/etc

    The brief history behind this project

    When I was botting, I had a taped together frankentstein of a solution with third party software that gave me video recording. It only worked for my use case because I was already willing to dedicate a full VM for each bot. However, it got the job done. I for the most part didn't have to watch my bots in action anymore in order to see mistakes with my script, this was huge! Just press play, come back when the bot stops due to some problem, and I'd see the last ~15 seconds of gameplay leading up the problem. This made bug fixing a breeze for the most part, a ton of time saved.

    Later on, discussing some stuff on the srl discord with citrus/slacky/others I saw that it might be feasible to write a simba include that can record video. While by then I'd decided to stop botting rs, having seen the usefulness of video debugging in my own experiences, I was interested in making this available for other people here. I did a prototype and got it working in a single threaded manner. This was pretty easy and straightford, you're basically just creating and maintaining a bitmap array of what simba sees. Once the array is full, each new bitmap means the oldest one should be removed. To turn this into a video I then just save them all to disk and have ffmpeg process the images into a video. The main problem was being able to do this in a seperate thread. Slacky's help with this problem was critical for turning this prototype into the somewhat useful thing that's available here now. I'm still not 100% sure what exactly is being utilized to get things working this smoothly outside of simba's main thread (without using a plugin).

    If you end up finding this software useful to you, please do give slacky a thank you.

  2. #2
    Join Date
    Dec 2006
    Program TEXAS home of AUTOERS
    26 Post(s)
    236 Post(s)


    Wow awesome! I remember the days when I use to have my HyperCam run for hours/day. The crappy part was I would have to scroll back and forth until I found the issue that caused my player go off path, it was such a pain in the butt

  3. #3
    Join Date
    Jan 2007
    Stavanger, Norway
    123 Post(s)
    327 Post(s)


    This is very nice! Thanks a lot for sharing

  4. #4
    Join Date
    May 2018
    0 Post(s)
    3 Post(s)


    This is awesome!! Thank you.

  5. #5
    Join Date
    Nov 2011
    294 Post(s)
    1092 Post(s)

  6. #6
    Join Date
    Aug 2007
    266 Post(s)
    1398 Post(s)


    Quote Originally Posted by Olly View Post
    I've yet to use this but I'll probably start utilizing it when my in-development scripts get to a point of strenuous testing. This tool can be crucial for developers. As always, nice work Olly.

    Current project:
    [AIO Fisher]

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts