jtoy / replicantlife

replicantlife is a framework for generative agents that can be used in a simulation engine or standalone. Agents are powered with metacognition modules that allow that to learn and adjust their strategy over time.
https://replicantlife.com
27 stars 7 forks source link

Created obs_record.py #27

Closed chiefeu closed 6 months ago

chiefeu commented 6 months ago

Automatically records the simulation replay on the web browser (currently for 20 seconds) upon execution of the script.

  1. Download and install the following: pip install obs-websocket-py pip install selenium

OBS studio: https://obsproject.com/download

  1. Add this to your PATH: ChromeDriver: https://googlechromelabs.github.io/chrome-for-testing/#stable (i used the stable channel)

  2. Include these in the .env file: (get the host, port, password on your obs studio, tools > websocket server settings > show connect info) (also make sure to check "enable websocket server")

OBS_HOST=localhost OBS_PORT=4444 OBS_PASSWORD=password RECORD_PATH=your desired path

  1. Execute the python script (the url of the replay is taken as an argument) python utils/obs_record.py insert-url-here

NOTE: Start recording based on a javascript event is not working yet. I tried to use the isPlaying variable on the RenderLevel.tsx but it returns an error.

From chatgpt:

The error message indicates that the isPlaying variable is not defined in the JavaScript context of the page. This suggests that the script is unable to access the isPlaying variable because it's not present on the page or it's defined in a scope that's not accessible to the script.