Thursday, 22 January 2009

online javascript game, in python

Last time I spoke about pypy, which allow (among other things) to translate python code into other languages.

This week I wrote a small video game (inspired by the famous boulder dash game) in rpython and used pypy to create an online version of the game out of it.

You can play the game here.
The sources can be found here.

The game as it is now is not really fun, but I only wrote it as an example of using pypy.

What I like with this approach is that I can develop in rpython, and even run the game using python interpreter, and only before I publish it use pypy to create the javascript version.

I could also create a C version using the same code for the game engine (only the graphic functions would have to be rewritten for each backends.)

This open the door to a lot of interesting applications.

On a side note, the pypy javascript translation is really not optimised. For example, let's try to guess what this generated function does :

function (){
var v1086,v1087,self_145;
var block = 0;
case 0:
self_144 = this;
self_145 = self_144;
block = 1;
case 1:
v1086 = 'H';
block = 2;
case 2:
return ( v1086 );

I don't want to spoil the fun of figuring this out by giving the answer...


Kiara said...

How I wish I can also make even a simple game. I am a great fan of Download Games or Video Games. Wish I know how to make source code, thanks for sharing your simple game.

Unknown said...
This comment has been removed by a blog administrator.
northbetsportsbook said...

the only replay value lies in loading from a saved game because you bit it, I have no interest, since replay ability is huge for me.

Unknown said...

Xbox One Modded Controllers

This is perfect for those who love their old 360 controllers, or had a real expensive modded 360 controller and now don't have to worry about buying another, or want to use a PS4 Dual shock 4 controller or want that extra edge by playing with a keyboard and mouse. Naturally you have full access to all of the mod packs too so you can now play with a fully modded controller on your Xbox One Modded Controllers - including our latest addition to the mudpack range, CALL OF DUTY GHOSTS V1.0 - again supplied free of charge and will be out very soon (Until it is released you can use the Call of Duty Series v1.7 Game Pack to work with COD Ghosts on the Xbox One)

Unknown said...

truck driving games
I thought it was going to be some boring old post, but it really compensated for my time. I will post a link to this page on my blog. I am sure my visitors will find that very useful.

Unknown said...

Modded Controllers Geniusmods is a leading manufacturer of modded controllers for Xbox 360, Playstation 3, Xbox One, and Playstation 4. Our modded controllers feature superior technology, as well as creative cosmetic designs. Geniusmods started manufacturing Xbox 360 modded controllers in 2007, and has been growing ever since. Our GM Master Mod contains all the latest mod functions, including drop shot, rapid fire, quickscope, jump shot, fast reload, and much more. Our rapid fire mods are the fastest possible for all the latest games, including Call of Duty Ghosts, all Gears of War and Halo games, and much more. To learn more about why Geniusmods is a leading producer of modded controllers, just check out our reviews as well as featured articles in the media.