etopiei / QWOP-Bot

This is a bot to play QWOP, written with web sockets and python using a genetic algorithm.
4 stars 2 forks source link

How do I run this? #1

Closed popedaddy69 closed 4 years ago

popedaddy69 commented 4 years ago

This isnt an issue but how do I run the bot?

etopiei commented 4 years ago

Hi @popedaddy69, it's a little complicated to run this, as I don't own the rights to QWOP. However I can give a general guide as to how to set this up:

First you need to download the required assets from foddy.net to load the game through the Athletics.html folder in this repo. The code there should give you a clue what assets are required.

The next step is to edit QWOP(2).min.js to not have restrictions on domain. The code checks if it is running on foddy.net and doesn't if it isn't, so you have to remove this restriction.

Next you have to add three functions to the game code to connect to the runner on the page:

  1. Add a qwopLoaded() method call when the game starts.
  2. Add a sendGameStats() method to the update method that fires every frame
  3. Add a sendEndGameStats(score, time) call to the end game method.

Now the JS is all set up to run QWOP via websockets. Sp you can host a webserver (using python or PHP) and load the file 'Athletics.html' in your browser.

The final step is setting up the python script which will connect to the browser via web-sockets and give commands to the athlete.

To do this:

$ pip install tornado
$ python3 qwop-send.py

Now it should connect to the client in the browser to play QWOP. Update the code in gen.py and qwop-send.py to control how the bot plays.

Hope this helps, and sorry this isn't easier, as mentioned above, as I don't own the rights to QWOP I cannot do this config for you or save it to this repo. Let me know if you need any further instructions.

etopiei commented 4 years ago

I'll add some of these instructions to the README too, as well as hopefully uploading a 'gif' demonstrating the use of this bot soon.