[SCRIPT] replay.py, server-side gameplay recorder for pique

gameplay recording script for piqueserver

this script is based on BR’s aos_replay: GitHub - BR-/aos_replay: Demo recorder/player for Ace of Spades 0.75 and 0.76

recordings resulting from replay.py are compatible with BR’s Playback.py

replay.py is a server-side gameplay recording implementation which bears advantages over client-side versions such as aos_replay.

  • u wont have to deal with lag in server => client traffic.
  • it does not take up a playerslot
  • it doesnt spoof up playercount on masterlist.
  • not a bot that gets kicked after just 5 minutes by the server, ending its recording in the process.
  • broadcast independent world_update (UPS) recording. u can record much smoother gameplay without having to raise actual UPS.

recording a game for later reviewing could proof to be a powerful tool for staff. if u can record your server at all times there is no way for cheaters to hide obvious cheats such as noclip, hardaimbot and etc. and even if the cheater were to use less obvious cheats such as esp, softaimbot and etc. every instance of that will be recorded and it will just be a matter of a staff to compile, review and judge them.

thank u sByte for ur help and many good ideas!

command and settings

command use:

  • /replay on <optional: custom file name> <optional: recording time in seconds> <optional: recorded ups>
    starts to record the gameplay. optionally specify a custom file name for the recording. optionally specify for how long u want to record the gameplay. optionally specify how many world_updates per second (ups) should be recorded
    • example:
      • /rpy on test 1200 ups60 => filename: test.demo | recording time: 20 minutes | recorded ups: 60
  • /replay off
    stops current active recording.
  • /replay ups <recorded ups>
    set the recorded ups during an active recording.
  • /replay help
    get help with how to use the command.
  • u can replace /replay with the shorter /rpy

config settings:

  • autorecording = true (false by default)
    set the server to automatically start a recording under these conditions when there is no active recording already:
    • enough players have joined the server again
    • after the map was changed and if enough players are present
  • auto_minimum_players_required = 2 (by default)
    how many players required to auto start recording (autorecording setting).
  • command_minimum_players_required = 1 (by default)
    how many players required to command start recording.
  • recorded_ups = 20 (by default)
    set how many world_update packets should be recorded per second. the higher this setting, the smoother the recorded gameplay looks, the more accurate the gameplay is being depicted in the resulting recording.
  • minimum_recorded_ups = 10 (by default)
    set the minimum ups (if recorded ups was specified via command).
  • maximum_recorded_ups = 60 (by default)
    set the maximum ups (if recorded ups was specified via command). set this to 0 if u dont want a maximum cap.
  • minimum_recording_length = 30 (by default)
    set the minimum recording length (if recording length was specified via command).
  • maximum_recording_length = 3600 (by default)
    set the maximum recording length (if recording length was specified via command). set this to 0 if u dont want a maximum cap.
  • file_name = "rpy_{server}_{time}_{map}" (by default)
    set the file name of your recordings. choose if and where in the filename u want to include the following:
    • {server} => name of your server.
    • {map} => name of the map that was recorded.
    • {time} => time and date of start of the recording.
      these expressions if enclosed by the curly brackets {} r automatically replaced with the actual complementory server values in the resulting filename.
  • compress_with_gzip = true (false by default)
    set wether to compress recordings with gzip.
  • auto_delete_after_time = 604800 (by default)
    set after how many seconds files get automatically deleted. set this to 0 if u dont want to delete anything.
  • auto_minimum_length_to_save = 300 (by default)
    how long an auto demo should be in seconds to save it. if its too short it will be automatically deleted. doesnt affect command recordings. set this to 0 if u want to keep short auto recordings.
  • replay_help = ["second helpful chat message", "first helpful chat message",] (exemplary)
    set what should be sent to the user on /rpy help

recordings r always automatically ended when there r not enough players (auto_minimum_players_required setting) or the map changes.

one little advise:
download the playback.py script from BR’s repo into the replays directory for easier viewing of the recordings.
version with quick fixes for newer versions of python and enet: piqueserver-extras/playback.py at master · piqueserver/piqueserver-extras · GitHub

demonstration video
one last important note

when the server becomes full the recorder has no option other than to take an invalid player ID (in this case 33). valid player IDs r those from 0 to 31. those r the ones most clients will accept. if u were to review a recording where the recorder got the player ID 33, most clients will reject that and u wont be able to view the recording.
thanks to sByte, if the server was recorded when it wasnt full u wont necessarily need a modified client.
clients with following or a similar modification can view such recordings:

download for a compatible openspades builds:


Nice work!

1 Like

imma bump this because a lot has changed since the initial post