[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygame] java pygame



Hello again,

On Monday 13 January 2003 11:45 am, Edward Povazan wrote:
> Is there such a thing as a pure Java PyGame.
> I ask because I use Jython with Java, and am writing a little game that
> needs to run as an Applet as well as an .exe.
> So I will code most of the game in Python, and with Jython I would have
> hardly any porting issues to deal with between the .exe and applet.
> 
> If this does not exist, is this of any interest to anyone? I will most
> likely attempt a partial port in the near future.

I've been researching a very similar problem, so I think maybe my information 
might be of some use to you. I'm not really so much interested in games that 
will run this way (though I think they'd be cool), but in clientside support 
for web-editable projects.

I'm working on a web application (using Zope) that will allow people to 
collaborate in a more informal and direct way than has been possible up to 
now.  One thing I want is more WYSIWYG editing (including graphics editing).

Unfortunately, the situation is rather dismal if you don't want to make your 
users download and install software. Even with Java this is a problem, 
because most of the reasonably useful software requires Java 1.2 or higher, 
which is not provided by the JVMs embedded in consumer web browsers, and 
which is Non-Free, to boot.  So, you're still going to make them download and 
install a plugin, which is crummy.

The solution I hit upon was to use Jython on Java 1.0 (which *is* the Java 
provided in consumer browsers), and use only the AWT interface for graphics. 
I planned to build a platform on that, using PyUI (which is a GUI toolkit 
which uses a lightweight renderer -- only about 250 lines of code).  It 
already has rendering for PyGame and some other platforms. 

I figured that all I would have to do is port the PyUI renderer to the 
Jython/Java AWT canvas.  This would allow the GUI stuff to work. I'm not sure 
what sort of support for primitive drawing (if any) that PyUI exposes, 
though. It's possible that one has to rely on the underlying graphics 
library.  Since the author developed it originally on PyGame, that wouldn't 
surprise me too much.

Unfortunately, although I keep saying I'm going to, I've never gotten around 
to playing with PyGame itself, so I'm not sure what it can do or how to use 
it.  I did do some programming with SDL (in C), so I have some idea of what 
that is capable of.  Anyway, so I don't have a clear idea of the scale of 
what you've proposed to do, nor how much it would gain over just porting the 
PyUI renderer, which is what I had in mind.  Of course, if the whole PyGame 
platform were ported, it would obviously make a lot of games and stuff work 
as applets, which would be a major milestone.

Regarding Jython -- You should be aware, of course, that Jython lags CPython 
by a bit -- the currently available Jython is roughly equivalent to Python 
2.1.  There is a development effort to reproduce Python 2.2, but 2.3 is still 
a ways off. So, it's not enough to assume that because Python 2.3 supports 
something that Jython will too. You'll have to be conservative.

Another factor to consider, of course, is speed -- Jython code is slower than 
either Java or Python, and you obviously can't use Psyco on it or anything. 
That means that if your users want more speed, they will probably want to be 
able to run the application natively -- i.e. install Python, download your 
program, and run it as an application. Or else, we'd need a Python 
interpreter plugin (which is another possibility, but a fairly big project).  
However, power users will definitely want this speedup for many applications 
(not to mention anyone with a slow computer).

So, you really want your program to run on either the Jython or Python 
platforms.  And the ideal case is that the same program, without 
modifications, runs on both. I think that's feasible, but it will involve 
testing and documenting a subset of Python (especially the libraries) that is 
"known to work" on both platforms. This kind of dual-platform Python 
environment is something that would be really useful for my project, and I'm 
planning to create some kind of resource for that.

Also, I know that you and I are not the only folks interested in Python 
applets -- I've brought this topic up on comp.lang.python once or twice, and 
there were a number of interested people. The main consensus is that it's 
somewhat difficult technically, but I personally think there's a way through.

Given this fact, I wonder if it would be appropriate to form a SIG or working 
group of some kind to share and coordinate ideas about this?  I could 
probably set up a wiki or something on our company site to support it, if 
there's enough interest.  Or we could see what it takes to get a SIG mailing 
list at Python.org.

Should I try to set something like that up?

Cheers,
Terry

--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks  http://www.anansispaceworks.com

"Some things are too important to be taken seriously"
____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org