• Do not use Works in Progress as a way of avoiding the releases system! Works in Progress can be used for sharing early betas and for getting suggestions for improvement. Releases of finished content are not allowed in this forum! If you would like to submit a finished addon, click here for instructions on how to do so.

SRB2Python prototype

Status
Not open for further replies.

yoshibot

With parts made in Japan
If you've been looking at the SVN and IRC chat, you might have noticed some activity regarding something called SRB2Python.

SRB2Python is essentially an EXE mod that has an embedded Python interpreter in it and SWIG bindings to expose some of SRB2's functions to the Python interpreter allowing for more dynamic and sophisticated scripting.

tl;dr: It's SRB2 with Python scripting.

This is currently a very early PROTOTYPE with limited features and probably very many bugs hiding in the sidelines. I'm posting this up here to get your opinion as to what you would like to see be able to be done as well as get testing feedback if anything breaks on systems different from my own.

tl;dr: This is an early beta, don't kill me if stuff breaks mmkay?

HOW TO USE:
Type: python '[whatever]' in the SRB2 console to execute a random line of Python. The line of code must be in quotes.
Type: openpyconsole to open a nice GUI console with which to hack at SRB2 even further. Or crash the game. It depends.

Useful hints:
dir() can tell you what is in the environment, and dir(thing) tells you what is in the thing.
Everything you likely want is in the 'srb2' module, which you can get by typing 'import srb2' in the Python command or console.
The wiki is a great source of information. Check here: http://wiki.srb2.org/wiki/SRB2Python

Project progress:
Wrap SRB2 functions and variables: 10~15%
Add Python WAD lump support: 0% (optional)
Add C callbacks to generate Python events: 0%
Add better game state syncing to netcode: 0% (optional, if I can wrap my head around SRB2's netcode :)
Clean up Python module hierarchy: 0% (srb2 module would quickly spiral out of control otherwise)

Where do I get it?:

You can get the archive for Windows here: SendSpace
Or...
Ok, SRB2Python for both i386 and PowerPC are available on my SRB2 repositories and as standalone packages. If you have my repositories enabled, update your package information and just use APT or Yum to install the package "srb2python" otherwise they are available as standalone packages too (you need my signing key installed for the Fedora packages):

(RPM packages, you need the extra packages "tcl" and "tk" installed, and for non-PowerPC users the extra "python-tk" package linked here)
http://repos.srb2.org/rpm/fedora/releases/10/i386/rpm/srb2python-2.0.4-1.i386.rpm
http://repos.srb2.org/rpm/fedora/releases/10/i386/rpm/python-tk-2.6.0-6.1.i586.rpm

http://repos.srb2.org/rpm/fedora/releases/10/ppc/rpm/srb2python-2.0.4-1.ppc.rpm

(DEB packages, you need the extra packages "tcl8.5", "tk8.5" and for non-PowerPC users, "python-tk" but dpkg will automatically download them if needed)
http://repos.srb2.org/deb/debian/dists/stable/main/binary-i386/srb2python_i386.deb

http://repos.srb2.org/deb/debian/dists/stable/main/binary-powerpc/srb2python_powerpc.deb

The PowerPC versions unfortunately do not support the external Python console because python-tk isn't on any other platform. Sorry. =/
Thank you Callum! :D
If you're on Windows, it requires SRB2's WAD data to be in the same folder, as this is only the executable and Python libraries. If you downloaded the RPM or APT package, congratulations! Everything should be all set for you to begin!

Please don't hesitate to post replies asking for help on how to use it or really anything else pertaining to this project. Odds are I'll see it the same day and post a reply for you.

Troubleshooting:
Q: I'm getting an error from SRB2Python complaining that "This application has failed to start because the application configuration is incorrect."
A: Download and install the Microsoft Visual C++ 2008 SP1 Redistributable Package from http://www.microsoft.com/downloads/...75-3B97-4AB7-A40D-3802B2AF5FC2&displaylang=en. This contains a very important system DLL that SRB2Python relies on under Windows.

EDIT: Original zip file had bad bug, updated. Thanks to ZeldaGamer00, Callum, and Senku for volunteering to test :)
EDIT2: Changed version numbers in new build, to stop potential netgame abuse.
EDIT3: There is now an early Wiki page for this project.
 
Last edited:
Well, I see that most people here do not udnerstand the magnitude of such a thing.

Let me put it in simple terms: You know how WAD files and SOCs and other normal addons can't do much? And people use EXE mods so they can do more stuff? Well, imagine if you could have an EXE mod as an addon, and you can simply add it through the console. You'd have this.
 
Well, I just edited the forum topic to point to a new release with changed version numbers so this cannot be exploited to ruin netgames. Oops!
 
For all the Linux folks, PowerPC and i386 Linux binaries of this will be on my repositories soon, so sit tight. =)
 
Ok, SRB2Python for both i386 and PowerPC are available on my SRB2 repositories and as standalone packages. If you have my repositories enabled, update your package information and just use APT or Yum to install the package "srb2python" otherwise they are available as standalone packages too (you need my signing key installed for the Fedora packages):

(RPM packages, you need the extra packages "tcl" and "tk" installed, and for non-PowerPC users the extra "python-tk" package linked here)
http://repos.srb2.org/rpm/fedora/releases/10/i386/rpm/srb2python-2.0.4-1.i386.rpm
http://repos.srb2.org/rpm/fedora/releases/10/i386/rpm/python-tk-2.6.0-6.1.i586.rpm

http://repos.srb2.org/rpm/fedora/releases/10/ppc/rpm/srb2python-2.0.4-1.ppc.rpm

(DEB packages, you need the extra packages "tcl8.5", "tk8.5" and for non-PowerPC users, "python-tk" but dpkg will automatically download them if needed)
http://repos.srb2.org/deb/debian/dists/stable/main/binary-i386/srb2python_i386.deb

http://repos.srb2.org/deb/debian/dists/stable/main/binary-powerpc/srb2python_powerpc.deb

The PowerPC versions unfortunately do not support the external Python console because python-tk isn't on any other platform. Sorry. =/
 
Last edited:
I went into the source code, and saw that there's a bunch of files named after cities around the world. What the heck is up with that?
 
That's timezone data for Tcl/Tk. It sort of has to be there, so please don't mess with it...

EDIT: Just added project goals to the topic. Hopefully that will give more people a better sense of what I plan to do to SRB2.
 
Last edited:
Ok, as promised, here are the PowerPC binaries of SRB2Python. "lsdlsrb2nohw" doesn't have OpenGL support, and therefore doesn't require it, for people who want to try out SRB2Python on SRB2Wii, this is the one you use.

http://repos.srb2.org/srb2python/Release/lsdlsrb2
http://repos.srb2.org/srb2python/Release/lsdlsrb2nohw

---------- Post added at 12:09 PM ---------- Previous post was at 11:36 AM ----------

Ok, for people fed up with Sendspace's slowness:
http://repos.srb2.org/srb2python/srb2python_redist.zip
 
Sounds very neat, yoshibot. Hope you manage to get the game state syncing better, too. :P Though I don't blame you at all if you don't want to.
 
Another another caveat: Netgames will lag like no tomorrow if you try pulling something like this as the host. Doing it as a client has not been tested, but it likely will not work.

Cfail protection, per chance?

Shouldn't be too hard to sync python alterations.
 
Only a very small subset of player data (mostly x/y/z position and velocity, as well as score) are synced over the network as testing has shown. Cfail protection helps keep the game together at a basic level, but whenever player data on the host is modified significantly everybody gets consistency lag.
 
Status
Not open for further replies.

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top