QWPython is a Python-powered QuakeWorld dedicated server in which the QuakeC interpreter has been removed, and Python used in its place to execute game logic.
Python game logic can be generated by an included QuakeC -> Python translator.
- OSX (tested on 64-bit Yosemite 10.10.3 with Python 2.7.6)
- FreeBSD (tested on 64-bit 9.3 with Python 2.7.9)
- Windows (tested on 32-bit NT 4.0 and 2000 with Python 2.0 back in 2001)
- Python 2.7 or higher
- Quake/QuakeWorld .PAK files
QWPython should work out-of-the-box if you place its files relative to your Quake installation like this:
quake/
id1/
pak0.pak
pak1.pak
server.cfg
ctf/ (optional)
pak0.pak
pak1.pak
server.cfg
qwpython-x.y/
ctf.py
deathmatch.py
setup.py
py-ctf/
py-dm/
qwypthon-src
If you don't use this particular placement, you'll have to edit the deathmatch.py
and/or ctf.py
files to look
somewhere else for the game's .pak files.
(Unix users need to follow this step. Windows distributions contain pre-built binaries allowing you to skip this, but if you have VisualC++ you can follow this step also to build your own binary.)
Change to the qwpython directory and run this command:
python setup.py install --install-lib .
This will compile the native-code part of QWPython (the actual QuakeWorld engine), and a couple supporting modules, and place the resulting package, named 'qwpython', in the current directory. So you should end up with something like:
qwpython-x.y/
build/
qwpython/
pakfile.py
qcsupport.py
qwsv.pyd (or .so)
You may remove the 'build' directory after this is finished.
QWPython comes with pre-translated versions of Deathmatch and CTF, which can be found in the py_dm
and py_ctf
directories. If you want to translate your own QC code, be sure to read the translator notes in docs\translate.html
.
You might want to use a standard QuakeWorld server.cfg
file (usually
in the same place as your .PAK files), that looks something like:
deathmatch 1
hostname "Python-Powered Deathmatch"
timelimit 15
fraglimit 150
maxclients 16
rcon_password mypass
map dm1
Although it should still work without one. From inside the QWPython directory, run this command:
python deathmatch.py
and you're in business. You should also be able to use the normal QW
command line parameters, such as: +map dm1
Currently QWPython doesn't handle keyboard input to the console, so to
stop it you'll either have to use the 'kill' command on Unix, or just
close the window under Windows, or use the QuakeWorld 'rcon' command from
within a connected QW client console (as in: rcon mypass quit
).
The file ctf_service.py is an example of running a QWPython game as a service. To install and run, use the commands:
python ctf_service.py install
net start ctfpython
To stop and remove the service, try:
net stop ctfpython
python ctf_service.py remove
You can also control the service through the Windows service control panel. Adapting this to other games besides CTF should be easy - nothing in the game itself changes, only the ctf_service.py has anything specific to Windows services in it.