Re: Web Browser Pygame Plug-in?

2006-07-10 Thread Ravi Teja
Gregory Piñero wrote:
> That's interesting, Ben.  So we'd be better off making a new library
> similiar to Pygame in functionality but designed from the ground up to
> work in a browser.

In open source community, that would be YOU since you are the one with
the need :-). Maybe you can make "Python WebStart".

Running foreign native code from a browser has long been abandoned as a
bad idea since ActiveX spyware proliferation (which BTW, is another way
to package your game as. Although that would effectively restrict it to
IE just like XPCOM would restrict it to Mozilla family). Plus your
users will have to download Python somehow (Python is not as widespread
as Java or Flash on consumer desktops), either as part of the game or
independently. And finally, if PyGame was written in pure Python
without taking advantage of SDL to be fully cross-platform, it would
likely not be fast anymore. It better be a REALLY great game to go with
all these issues :-).

> I guess that XPCOM technology that someone
> mentioned might be the way to go?

It is far simpler to just use Jython and some Java Game library instead
of PyGame if browser delivery is that important to you.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Web Browser Pygame Plug-in?

2006-07-10 Thread Ben Sizer
Gregory Piñero wrote:
> That's interesting, Ben.  So we'd be better off making a new library
> similiar to Pygame in functionality but designed from the ground up to
> work in a browser.

I think it depends on what is most important to you. Options available
include going with Java or Flash instead (ie. dropping Python), or
using a Jython applet (which I know nothing about), or perhaps
abandoning the browser and sticking with PyGame, etc. What are your
requirements?

> I guess that XPCOM technology that someone
> mentioned might be the way to go?

I was under the impression that XPCOM was a Mozilla-only technology; if
so, maybe that won't fit your requirements either.

-- 
Ben Sizer

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Web Browser Pygame Plug-in?

2006-07-10 Thread Gregory Piñero
That's interesting, Ben.  So we'd be better off making a new library
similiar to Pygame in functionality but designed from the ground up to
work in a browser.  I guess that XPCOM technology that someone
mentioned might be the way to go?


On 10 Jul 2006 03:54:33 -0700, Ben Sizer <[EMAIL PROTECTED]> wrote:
> Gregory Piñero wrote:
> > I was just idley curious on what it would take to make a web plug-in
> > for Pygame.  I'm picturing it working the way my browser currently
> > shows flash games.  Is such an idea even possible?  Has anyone
> > attempted this?
>
> I doubt you can get PyGame to work this way - at least, not without
> some significant hacking around in the source - since PyGame relies on
> the underlying SDL library, and from my experience with it, I can't see
> it playing well with a browser whatsoever. I think SDL would have to
> acquire a new backend to translate input to the plugin into their event
> structure, and would require some way of creating an appropriate video
> mode that can draw to a browser's window, etc. Java applets and Flash
> are built for this purpose whereas PyGame is built on a technology that
> was designed for programs that have their own window and tend to
> capture all the OS's input.
>
> --
> Ben Sizer
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>


-- 
Gregory Piñero
Chief Innovation Officer
Blended Technologies
(www.blendedtechnologies.com)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Web Browser Pygame Plug-in?

2006-07-10 Thread Ben Sizer
Gregory Piñero wrote:
> I was just idley curious on what it would take to make a web plug-in
> for Pygame.  I'm picturing it working the way my browser currently
> shows flash games.  Is such an idea even possible?  Has anyone
> attempted this?

I doubt you can get PyGame to work this way - at least, not without
some significant hacking around in the source - since PyGame relies on
the underlying SDL library, and from my experience with it, I can't see
it playing well with a browser whatsoever. I think SDL would have to
acquire a new backend to translate input to the plugin into their event
structure, and would require some way of creating an appropriate video
mode that can draw to a browser's window, etc. Java applets and Flash
are built for this purpose whereas PyGame is built on a technology that
was designed for programs that have their own window and tend to
capture all the OS's input.

-- 
Ben Sizer

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Web Browser Pygame Plug-in?

2006-07-09 Thread Shane Hathaway
Gregory Piñero wrote:
> Shane Wrote:
>> Ah, so you also want to distribute untrusted Python code.  That's fairly
>> hard.  There's a discussion about it on Python-Dev right now.
> 
> Well, I want to write a game in Pygame, and people can just go to my
> website and play it within their browser.  I guess that would be
> untrusted code?

If they download your code with the plugin, your code is trusted.  If
they download it separately in a browser session, it's untrusted.  So
one way to get started quickly is to just mix your code with the plugin,
and not attempt to enable execution of untrusted code.

Shane
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Web Browser Pygame Plug-in?

2006-07-07 Thread Shane Hathaway
Gregory Piñero wrote:
> I was just idley curious on what it would take to make a web plug-in
> for Pygame.  I'm picturing it working the way my browser currently
> shows flash games.  Is such an idea even possible?  Has anyone
> attempted this?

I once played with a similar idea.  Yes, it's possible, although
platform differences make the idea non-trivial.

Specifically, I ran into difficulty when I discovered that it's not easy
on Linux to load a dynamic library (such as libpython.so) which in turn
loads other dynamic libraries (such as native Python modules), since the
library search path is not modifiable at runtime.  A possible workaround
is to launch a separate process which projects into the browser window.

I don't know what surprises may pop up on other platforms.

Shane
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Web Browser Pygame Plug-in?

2006-07-07 Thread Shane Hathaway
Gregory Piñero wrote:
> Are there security issues too?  Would you remove potentially harmful
> Python libraries for the plugin, not allow system calls, etc?  Would
> you only allow file system access in one area?

Ah, so you also want to distribute untrusted Python code.  That's fairly
hard.  There's a discussion about it on Python-Dev right now.

> I guess you'd just copy however Java applets work?  But run faster ;-)

More or less.

Shane

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Web Browser Pygame Plug-in?

2006-07-07 Thread Rob Knapp
On Thu, 2006-07-06 at 14:24 -0400, Gregory Piñero wrote:
> Hi guys,
> 
> I was just idley curious on what it would take to make a web plug-in
> for Pygame.  I'm picturing it working the way my browser currently
> shows flash games.  Is such an idea even possible?  Has anyone
> attempted this?
> 

At a previous position, I looked at this.  Not for a game but for
embedding our components in IE & Mozilla.

I started work on a Mozilla (this was pre-firefox) plugin that was based
on pyxpcom.  The company told me to stop development due to changing
business stuff, and I convinced them to release the non-working source.

However, I have since lost the source code.  It was a strange situation
as I wasn't allowed to start a sf project, and hosted the source on my
website. (they didn't want to be "seen supporting open source" if that
makes any sense...esp since the project was largely python based).
Unfortunately, sometime over the course of 2 web host changes and 1 move
from NC to PA I lost the source.  It might be available in a mailing
list archive of the pyxpcom list. (I make no claims of quality code,
this was during extra-special heavy duty start-up mode and I was getting
maybe 6 hours of downtime a day for meals, sleep and saying "Hi" to my
wife... so if you do manage to find the code, keep that in mind. :) )

It was not, as I recall, overly difficult at least conceptually since
most of the cross-platform hurdles were handled by pyxpcom.  Just follow
the examples in pyxpcom and in the netscape documentation to get a basic
plugin.  This would load a xpcom component and start it.  It was just a
matter of creating the pyxpcom component and "that was it."  (Pushing
aside implementation details like getting pyxpcom installed on the
machine, and how the extent of the plugin's area gets passed in and a
bunch of other niggling little details.)

Mind you this was back in 2002, so my memory may be simplifying things
slightly, and there is always the chance that I was just flat out wrong
from beginning to end. :)   Also, I'd spent maybe 10 hours on the
project before I was told to stop, so who knows what issues might be
laying under the surface.  For example, getting the same concept to work
in IE ended up taking a great deal of development as we ended up using
trolltech's ActiveQT to wrap our components (which were already QT
classes).

At anyrate, I'm 90% certain that it can be done and think it's a rockin'
good idea.  I might return to it in future, as my new employer may have
a need, but that wouldn't be until at least next year, if not the year
after that.





> -- 
> Gregory Piñero
> Chief Innovation Officer
> Blended Technologies
> (www.blendedtechnologies.com)

-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Web Browser Pygame Plug-in?

2006-07-07 Thread Gregory Piñero
Shane Wrote:
> Ah, so you also want to distribute untrusted Python code.  That's fairly
> hard.  There's a discussion about it on Python-Dev right now.

Well, I want to write a game in Pygame, and people can just go to my
website and play it within their browser.  I guess that would be
untrusted code?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Web Browser Pygame Plug-in?

2006-07-07 Thread Gregory Piñero
Are there security issues too?  Would you remove potentially harmful
Python libraries for the plugin, not allow system calls, etc?  Would
you only allow file system access in one area?

I guess you'd just copy however Java applets work?  But run faster ;-)


On 7/7/06, Shane Hathaway <[EMAIL PROTECTED]> wrote:
> Gregory Piñero wrote:
> > I was just idley curious on what it would take to make a web plug-in
> > for Pygame.  I'm picturing it working the way my browser currently
> > shows flash games.  Is such an idea even possible?  Has anyone
> > attempted this?
>
> I once played with a similar idea.  Yes, it's possible, although
> platform differences make the idea non-trivial.
>
> Specifically, I ran into difficulty when I discovered that it's not easy
> on Linux to load a dynamic library (such as libpython.so) which in turn
> loads other dynamic libraries (such as native Python modules), since the
> library search path is not modifiable at runtime.  A possible workaround
> is to launch a separate process which projects into the browser window.
>
> I don't know what surprises may pop up on other platforms.
>
> Shane
>


-- 
Gregory Piñero
Chief Innovation Officer
Blended Technologies
(www.blendedtechnologies.com)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Web Browser Pygame Plug-in?

2006-07-06 Thread 3KWA
Gregory Piñero wrote:
> I was just idley curious on what it would take to make a web plug-in
> for Pygame.  I'm picturing it working the way my browser currently
> shows flash games.  Is such an idea even possible?  Has anyone
> attempted this?

Not a plugin but at Europython the PyPy crew presented the Javascript
backend  of PyPy which transforms-converts a python program into a
Javascript application (not sure I understood it all so ...). They
showed us a Javascript version of the Bub-n-Bros game (written using
pyGame). Pretty cool is you ask me.

EuGeNe

-- 
http://mail.python.org/mailman/listinfo/python-list


Web Browser Pygame Plug-in?

2006-07-06 Thread Gregory Piñero
Hi guys,

I was just idley curious on what it would take to make a web plug-in
for Pygame.  I'm picturing it working the way my browser currently
shows flash games.  Is such an idea even possible?  Has anyone
attempted this?

-- 
Gregory Piñero
Chief Innovation Officer
Blended Technologies
(www.blendedtechnologies.com)
-- 
http://mail.python.org/mailman/listinfo/python-list