[bfprog] Re: Packaging and Importing Custom Python Code
Forrest Thiessen
thiessen at cyberscapearena.com
Wed Jun 22 07:56:13 PDT 2005
You understood correctly--you can put anything in your own scripts that
you want, and by registering for callbacks you can hook yourself in to
any of the in-game events.
Where the problem comes in is this: you build a nice script do whatever.
. . but how do you get your script to run? There's nothing in the
EA/DICE Python stuff that will call user scripts, at all. If you want
your scripts to run, you have to change the EA/DICE code--for example,
by changing /admin/standard_admin/__init__.py, as you point out.
That's ok if you're just modifying the game for yourself, but we'd like
to get to the point where you can, for example, download a dozen
different scripts from the internet that change the behavior of the
game, and install them and have them all work correctly. Say, one to
change the way scoring works, another to make autobalancing more to your
liking, another to add statistics logging capabilities, another to
create a new game mode, and so on. If you have to modify the EA/DICE
code for every one of these scripts, it's going to be a mess, and not at
all unlikely that some of the modifications required by one script will
conflict with modifications made by others. And when something breaks,
since you've had to repeatedly hack around with the core EA/DICE files,
how do you "uninstall" you changes to get back to a working game?
You're probably out of luck, unless you were knowledgeable enough to
know which Python files were the original ones, and to have saved copies
of them.
In other words, *theoretically* there's nothing stopping you from
changing /admin/standard_admin/__init__.py (if you were writing an
admin-related script), or any of the other original files, but as a
practical matter, it would quickly become a mess.
What we're looking for is a way for people to be able to quickly and
easily install and uninstall new Python-based features without having to
modify any of the original game files. The proposal we've been talking
about does that: you add one line, one time, to one of the original
files. From then on, any scripts you want to run just get dropped in to
a standardized directory. Either way can be made to work (after a
fashion), but this proposed approach is better if people want to be
redistributing their scripts for others to use.
--Forrest
Martin Steiger wrote:
>>Does anyone else have any better ideas about how to prevent conflicts
>>between custom Python modifications?
>>
>>
>
>I only looked a bit at the python scripts and it may be, I misunderstood
>something now, but isn't it possible to create your own python files,
>register your own triggers and handlers and load them then via
>the /admin/standard_admin/__init__.py (as it is done with autobalance and
>tk_punish).
>
>Or did I misunderstand the question?
>
>Martin
>
>
>_______________________________________________
>BFProg mailing list
>BFProg at lists.matureasskickers.net
>http://lists.matureasskickers.net/mailman/listinfo/bfprog
>
>
More information about the BFProg
mailing list