Python console-based visualizer

Hi everyone,

I’ve written a python-based console visualizer with no external dependencies. It looks basically exactly the same as the game-engine’s text-map output but it renders the movements one block at a time in real-time (meaning it moves faster/slower based on the speed) (just a lot easier to watch than replaying the text-maps). A demo of the output:
asciicast

Source code can be found at this gist. I’ve only tested this on Linux but it uses ANSI terminal escape codes so it should be fairly portable. To use it you just need to run the script inside a match logs folder. Please excuse the horrible code - it’s better if you just look at the pretty animations :slightly_smiling_face:

It displays two maps, one for each player representing their separate views. You can modify the playback speed and fps by changing the spr and fps variables, respectively (line 34). Let me know if there are issues and I’ll check if I can fix it. I know that it currently skips the first round but this is due to the output of the game-engine starting at round 2’s starting position, but for now I’m just leaving it as is.

2 Likes

I’ve added an option that allows delaying the output between rounds and that freezes the map for the round which makes it easier to see it as the bot sees it (as the bot isn’t seeing a rolling window). The option can be seen in action here:

asciicast

To enable it set the round_delay variable (line 36) to a non-zero value

1 Like

dude this is super cool, thank!

Works like a charm inside a docker python3 container as well.

Neat!

One suggestions/request : allow the source folder to be specified via command line argument…

Glad you like it :smile: I’ve added the option to specify the directory as a command-line argument - if you specify no arguments it assumes the logs are in the current directory, otherwise it uses the first argument you pass it as the log directory. Updated code on the same gist

1 Like

Schweeet, nice one @kobus-v-schoor !

I thew together a tiny wrapper script to make running with docker easy . Well, assuming you are using linux. And have docker installed. And bash. And cURL.

Hi All, I’ve done a rewrite of the visualizer and updated it for the second phase. It now shows much more info and player commands/states and positions are properly synced with the current round number. The round delay option also works better now, and lifting the “fog of war” (displaying blocks beyond what the car can see) has now been made a toggle-able option.

Preview (no delay):

asciicast

Preview (with delay):

asciicast

Code is still available at https://gist.github.com/kobus-v-schoor/ec1923bb09858a5037df21444aeabbcd. If you find any issues/have questions please let me know.

EDIT: Forgot to mention, the new version of the visualizer also still supports to first phase’s match logs

2 Likes

Happy days sir, happy days!

Thanks for sharing (again) :smiley: