If your were going to program a game...

T

Tokyo Dan

If your were going to program a game in python what technologies would
you use?

The game is a board game with some piece animations, but no movement
animation...think of a chess king exploding. The game runs in a
browser in a window of a social site built around the game. The social
site has login, chat, player stats, list of active games, etc. AND
there is also be a desktop client that accesses the game server via
the same communication mechanism (like an AIR-based desktop client/
app) as the browser-based version - I guess using JSON/RPC.
 
J

janislaw

If your were going to program a game in python what technologies would
you use?

The game is a board game with some piece animations, but no movement
animation...think of a chess king exploding. The game runs in a
browser in a window of a social site built around the game. The social
site has login, chat, player stats, list of active games, etc. AND
there is also be a desktop client that accesses the game server via
the same communication mechanism (like an AIR-based desktop client/
app) as the browser-based version - I guess using JSON/RPC.

If I were to write a python game that ran in a _browser_ I'd go for
jython applet.

JW
 
K

Kay Schluehr

If your were going to program a game in python what technologies would
you use?

The game is a board game with some piece animations, but no movement
animation...think of a chess king exploding. The game runs in a
browser in a window of a social site built around the game. The social
site has login, chat, player stats, list of active games, etc. AND
there is also be a desktop client that accesses the game server via
the same communication mechanism (like an AIR-based desktop client/
app) as the browser-based version - I guess using JSON/RPC.

There is no solution to this problem from a Python perspective. Do
what everyone does right now: use Flash for the game and manage your
site with Python if you like the language.
 
E

excord80

There is no solution to this problem from a Python perspective. Do
what everyone does right now: [snip]

It still surprises me that no one has implemented the solution for
this yet.

Maybe it's harder than it seems, but it *seeems* like it's just a
matter of telling Firefox, "hey, when you see this special html
element that tells you to run this python code from the web, do it".
Then have FF load up a python interpreter, sandbox it somehow (that
is, limit it to only a safe subset of its std lib), it runs the code
within its region of the browser window, and Bob's your uncle.

People would go bonkers for that.
 
C

Chris Rebert

There is no solution to this problem from a Python perspective. Do
what everyone does right now: [snip]

It still surprises me that no one has implemented the solution for
this yet.

Maybe it's harder than it seems, but it *seeems* like it's just a
matter of telling Firefox, "hey, when you see this special html
element that tells you to run this python code from the web, do it".
Then have FF load up a python interpreter, sandbox it somehow (that
is, limit it to only a safe subset of its std lib), it runs the code

The "sandbox it somehow" part is significantly harder than you seem to
believe it would be. Python tried previously with the rexec and
Bastion modules, but they were found to be irreparably flawed and thus
were removed.
However, Google App Engine seems to have found at least a partial
solution, but they're keeping it to themselves as far as I know, and
it's server-side rather than client-side anyway.

Cheers,
Chris
 
F

Fuzzyman

There is no solution to this problem from a Python perspective. Do
what everyone does right now: [snip]
It still surprises me that no one has implemented the solution for
this yet.
Maybe it's harder than it seems, but it *seeems* like it's just a
matter of telling Firefox, "hey, when you see this special html
element that tells you to run this python code from the web, do it".
Then have FF load up a python interpreter, sandbox it somehow (that
is, limit it to only a safe subset of its std lib), it runs the code

The "sandbox it somehow" part is significantly harder than you seem to
believe it would be. Python tried previously with the rexec and
Bastion modules, but they were found to be irreparably flawed and thus
were removed.
However, Google App Engine seems to have found at least a partial
solution, but they're keeping it to themselves as far as I know, and
it's server-side rather than client-side anyway.

PyPy allows *true* sandboxing, as does IronPython through AppDomains.
I wouldn't recommend either for 'in the browser' use though.

You can do client side programming in the browser with Silverlight.
It's great fun to program, and very flexible, but limited to Safari,
IE & Firefox on Mac and Windows. Moonlight is making good progress
which will bring Silverlight to Firefox on Linux - and eventually more
browsers and platforms.

Michael Foord
 
A

Aaron Brady

There is no solution to this problem from a Python perspective. Do
what everyone does right now: [snip]
It still surprises me that no one has implemented the solution for
this yet.
Maybe it's harder than it seems, but it *seeems* like it's just a
matter of telling Firefox, "hey, when you see this special html
element that tells you to run this python code from the web, do it".
Then have FF load up a python interpreter, sandbox it somehow (that
is, limit it to only a safe subset of its std lib), it runs the code

The "sandbox it somehow" part is significantly harder than you seem to
believe it would be. Python tried previously with the rexec and
Bastion modules, but they were found to be irreparably flawed and thus
were removed.

Suppose you compiled a version with no file type and a reduced os
module?
 
F

Fuzzyman

There is no solution to this problem from a Python perspective. Do
what everyone does right now: [snip]
It still surprises me that no one has implemented the solution for
this yet.
Maybe it's harder than it seems, but it *seeems* like it's just a
matter of telling Firefox, "hey, when you see this special html
element that tells you to run this python code from the web, do it".
Then have FF load up a python interpreter, sandbox it somehow (that
is, limit it to only a safe subset of its std lib), it runs the code
The "sandbox it somehow" part is significantly harder than you seem to
believe it would be. Python tried previously with the rexec and
Bastion modules, but they were found to be irreparably flawed and thus
were removed.

Suppose you compiled a version with no file type and a reduced os
module?

How would it be able to import? (I realise there is an answer to that
question, but it would require more changes than you might think.)

Python uses Python - so pulling bits out tends to break things...

Michael Foord
 
S

Steve Holden

Aaron said:
There is no solution to this problem from a Python perspective. Do
what everyone does right now: [snip]
It still surprises me that no one has implemented the solution for
this yet.
Maybe it's harder than it seems, but it *seeems* like it's just a
matter of telling Firefox, "hey, when you see this special html
element that tells you to run this python code from the web, do it".
Then have FF load up a python interpreter, sandbox it somehow (that
is, limit it to only a safe subset of its std lib), it runs the code
The "sandbox it somehow" part is significantly harder than you seem to
believe it would be. Python tried previously with the rexec and
Bastion modules, but they were found to be irreparably flawed and thus
were removed.

Suppose you compiled a version with no file type and a reduced os
module?

"Cars are dangerous". "Yes, but suppose you made them completely
elastic". Sheesh. The developers are way less dumb than you seem to believe.

Suppose you did compile a version with no file type and a reduce os
module? Perhaps you would like to do some research into *why* rexec and
bastion were dropped from the implementation. Or read Brett Cannon's
work on "safe" execution of arbitrary Python. That way you would stop
making fatuous suggestions that don't help anybody.

regards
Steve
 
J

J Kenneth King

Tokyo Dan said:
If your were going to program a game in python what technologies would
you use?

The game is a board game with some piece animations, but no movement
animation...think of a chess king exploding. The game runs in a
browser in a window of a social site built around the game. The social
site has login, chat, player stats, list of active games, etc. AND
there is also be a desktop client that accesses the game server via
the same communication mechanism (like an AIR-based desktop client/
app) as the browser-based version - I guess using JSON/RPC.

Ever see chess.com?

I don't know what they're using in the backend, but the client is
entirely javascript.

You could probably roll your own python javascript compiler to suit your
needs. It could probably even build up your own DSL for writing these
games.

It's a worthwhile project and I think there might be support for it from
other developers.
 
F

Fuzzyman

Ever see chess.com?

I don't know what they're using in the backend, but the client is
entirely javascript.

You could probably roll your own python javascript compiler to suit your
needs. It could probably even build up your own DSL for writing these
games.

It's a worthwhile project and I think there might be support for it from
other developers.

There's a project called Pyjamas, and PyPy also has a Python to
Javascript compiler.

Imagine debugging it though - ouch. Just write some Javascript
already. ;-)

Michael Foord
 
T

Terry Reedy

Jean-Paul Calderone said:
No, PyPy includes an RPython to JavaScript compiler. RPython and Python
are
different languages.

My impression from a few years ago is that RPython stands for Restricted
Python and that it was/is? a proper subset of Python. Has this changed?
 
T

Tokyo Dan

Ever see chess.com?

I don't know what they're using in the backend, but the client is
entirely javascript.

You could probably roll your own python javascript compiler to suit your
needs. It could probably even build up your own DSL for writing these
games.

It's a worthwhile project and I think there might be support for it from
other developers.

"You could probably roll your own python javascript compiler..."
There's already one. I'm surprised that you don't know about it:
"Pyjamas" st http://pyjs.org . Also see Pyjamas-desktop" at http://pyjd.org
 
J

Joe Strout

Kay said:
There is no solution to this problem from a Python perspective. Do
what everyone does right now: use Flash for the game and manage your
site with Python if you like the language.

I know this has been discussed before, and the difficulties are many,
yadda yadda etc... But suppose we reduce the scope: just the core
Python language, maybe a VERY few of the standard modules (e.g. math and
string), plus some pygame-like classes to move sprites around, play
sounds, and check keyboard and mouse state.

Or to look at it another way: Python is used as the scripting language
in many commercial games. Why couldn't we make a browser plugin (in
C++, for example) that implements a "generic" game, i.e. moving of
sprites and playing of sounds and so on -- and that uses Python as its
scripting language?

Not that I have anything against Flash; I've started learning it just
last week, and apart from the nasty C-derived syntax, it's quite nice.
It has a good IDE, good performance, great portability, and it's easy to
use. It just surprises me that after all these years, the Python
community hasn't done something similar.

Best,
- Joe
 
S

Steven D'Aprano

Not that I have anything against Flash; I've started learning it just
last week, and apart from the nasty C-derived syntax, it's quite nice.
It has a good IDE, good performance, great portability, and it's easy to
use. It just surprises me that after all these years, the Python
community hasn't done something similar.

It's bad enough that every time I go to a website using Flash, my browser
is running untrusted code in my browser, but at least Adobe has spent a
bucket-load of time and money making it (almost) secure. I sure as hell
don't want arbitrary Python code running in my browser.

Oh, and even Adobe hasn't got it completely right: IBM research Mark
Dowd has demonstrated an incredible vulnerability that allows a
single Trojan to exploit Flash in either IE or Firefox while leaving
the Flash runtime operating normally. And it can bypass Vista
security. Although Dowd doesn't explicitly mention other OSes, I see
no reason to believe the same technique wouldn't work on Linux.

http://www.matasano.com/log/1032/this-new-vulnerability-dowds-inhuman-
flash-exploit/


This is not your regular buffer overflow vulnerability. Read it and weep.
 
A

alex23

If your were going to program a game in python what technologies would
you use?

pyglet[1], pygame[2], or pycap[3].
The game is a board game with some piece animations, but no movement
animation...think of a chess king exploding. The game runs in a
browser in a window of a social site built around the game. The social
site has login, chat, player stats, list of active games, etc. AND
there is also be a desktop client that accesses the game server via
the same communication mechanism (like an AIR-based desktop client/
app) as the browser-based version - I guess using JSON/RPC.

You could always make Firefox + the PyXPCOM[4] extensions a
requirement for use, then just code up the UI in Python where you'd
usually use JavaScript. The desktop client could be based on XULRunner
[5], then both the web & desktop versions should be pretty much
identical.

1: http://www.pyglet.org/
2: http://www.pygame.org/
3: http://www.farbs.org/pycap.html
4: http://pyxpcomext.mozdev.org/
5: https://developer.mozilla.org/en/XULRunner
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top