[bf1942] Using sqlite with BF2 in Windows

Andreas Fredriksson deplinenoise at gmail.com
Fri Apr 21 03:45:30 EDT 2006

On 4/21/06, "Einar S. Idsø" <esi at itk.ntnu.no> wrote:

> The last line fails with the exception "exceptions.ImportError". This is
> on a Linux host. I've tried the same in a regular python interpreter,
> and it works fine.

pyexpat uses expat in a shared object form, and I think it wasn't
included at all in the DICE  Python build. Also, because of the so/dll
loading limitations it's not possible to add it dynamically (which
you've already found out.)

> It seems as if xml.dom.minidom.parseString uses
> xml.dom.expatbuilder.parseString which uses xml.parsers.expat which in
> turn depends on pyexpat which doesn't exist. Is there any way to get
> that missing module into the internal py-engine for the next patch?

I can't speak for DICE (any longer) but I wouldn't bet on it. It takes
significant effort to rebuild the Python layer and I'm sure a security
audit would have to happen as well.

> I'd rather not be handling xml with plain regexps, and the deprecated
> xmllib package gives me the shivers...

I think the pickle module is included, and sockets definitely work, so
maybe the best option is to build a side-by-side server in "real"
Python which has unrestricted access to Python modules in general.
That way you could use a simple form of RPC across a pickle layer
which works with all Python types.

With this approach, the bugs in the BF2 build only has to be dealt
with once, and  servers can use what ever game modes the like. Just
take care to make the RCP layer asynchronous, or the game loop could
suffer badly from blocking.

This applies to locally connected sockets as well ( because
a read/write cycle implies at least two context switches which would
absolutely drain the server FPS (the default time slice is 10ms IIRC).

Hope this helps,

Those who live by the sword get shot by those who don't.

More information about the Bf1942 mailing list