[bfprog] Packaging and Importing Custom Python Code
Forrest Thiessen
thiessen at cyberscapearena.com
Mon Jun 20 15:43:03 PDT 2005
I've been rumaging through the Python code included with the BF2 server,
learning how it works, and updating the wiki
(http://bf2.fun-o-matic.org) with stuff like evolving object and event
references; entertaining, in a geeky sort of way! As I'm doing this,
though, the thought occured to me: how are people supposed to modify
this stuff without stepping on each other's toes?
It's straightforward (amazingly so) to see how to add new admin
commands, to do stats logging, change game behavior, etc. . . but the
out-of-the-box BF2 Python code is "hardwired" to load particular Python
packages and modules--and to ONLY load those packages and modules. If
you want to change something you can easily do so. . . but only by
messing with DICE's code. . . which might have already been modified by
someone else for another purpose, and so on. Ugh!
It's tough even if you're developing a full mod of BF2: the only
mod-specific Python stuff that gets pulled in as the server loads is the
scoring system in the module game.scoringCommon. . . unless, again, you
monkey with the default Python files to make them pull in other things, too.
It seems to me that what's missing here is something in the default code
that (as one way of doing it) would import any custom Python packages
contained in a certain directory, so that all you need to do to add or
change features in the game is to drop the new packages into that
directory and restart the server. Since that's not in the default server
code, I suggest the way to do this is to have ONE standard modification
to the default code that adds this capability; everybody makes that one
standard change, and from then on, everyone just pops any changes they
want cleanly into the "custom" directory, and away you go.
Of course, EA/DICE are the logical people to make this change, but we
haven't had any hints yet, that I know of, as to how receptive they are
to such things (or whether they are even on this mailing list).
Does anyone else have any better ideas about how to prevent conflicts
between custom Python modifications?
--Forrest
More information about the BFProg
mailing list