[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Pygame, pyglet, 2d, 3d, and performance (reflexions/discussion)

On Feb 13, 2012, at 12:25 AM, Santiago Romero wrote:

My problem is that I like and prefer the "romantic-classic" pure 2d approach. The pyglet/cocos idea of actors, scenes and 2d-3d modelling is not as nice for me than the classic "oldstyle" approach... but that 3d approach really works and their 3D-2D games work in high resolutions at full speed and in pygame you can suffer creating a hires multilayer scrolling game at 60 fps...

So with old style, do you mean pushing pixels to an display surface?

I'm also a bit from the old school, used and like sdl with pygame earlier, but we've been quite happy to make a 2d game with cocos2d now (began as a pygame proto, was then ported to iphone with cocos). But then again, our team is not that much about writing drawing code etc. but we are quite happy to use something like a particle engine for effects etc. Though it sure is nice that can do some basic image processing in cocos2d too for some effects (simple coloring and hilites etc). I do find pygame + numpy surfarray stuff still nice for some image app things otherwise.

Check as an example the Raspberry Pi (http://www.raspberrypi.org). A 25US$ Linux computer with ARM@700Mhz with OpenGL GPU that will run a fullhd pyglet game at fullspeed (thanks to its very powerful GPU) but won't run a pygame hires game because of lack of cpu power... The same happens in other devices like tablets and mobile phones with android.

Besides the initial Pygame SDL proto and the current iOS port, we also have an experimental cross plat impl of that game / engine made with very cold school style, without GL, which runs on very weak (and old, say Android 1.6 :) hardware. That one just puts pixels to a 2d array in memory, in a cross-platform lib. Works so that then on some platform you just need a frontend that blits the frames of the game to a display. There's a SDL frontend for laptop/desktop things and a Java one for Android. So could dev on normal Linux, run on Android, and give a Windows build of some proto for people to test etc. That was made 1,5 years ago, quite early days of Android (2.1 or 2.2 or so?) .. when also versions <2 were around.

It is very light and fast, for low resolutions. One thing to note is that it's native code (written in a lisp/scheme variant which is generated to c source for compiling to an efficient binary). But there still is a lot of blitting and it does run fast. (the lang is Owl-lisp, http://code.google.com/p/owl-lisp/). We haven't tested that with high resolutions, especially not with weak HW (say something rasperry pi league + HD display .. might crawl?).

So, please, let's discuss about it: success cases, ideas, and opinions in both ways: nowadays, 640x480 / 800x600 is "low res" and games must be able to run at higher resolutions (even in HDMI output at FullHD) and in low-cpu-but-good-gpu systems like tablets, but that implies using OpenGL and abandoning the classic-oldstyle libraries like pygame :-(.

Some do have used OpenGL with Pygame for ever, with PyOpenGL etc. I think .. though I guess it's mostly down to just input etc then. Perhaps still nice that the event system etc is familiar, and SDL is there for audio etc, though e.g. events sure are nice in e.g. pyglet (too) I find.

But I figure you mean the drawing style, and indeed I wouldn't start to make a FullHD thing, on a mobile device even, with just CPU blitting. It may well be possible, depending on the style etc. For e.g. just smooth scrolling has seemed obvious that the use of GL is a good idea. OTOH if you have more still background where things happen only in parts of the whole at the time, I think it could well.

Some people are enthusiastic about WebGL as it allows them to make *2d* games powerfully with the browser techs.

Perhaps you should fall in love with writing shaders and blast off with your pixel pushing skills there? :)

About graphics, no matter how you draw to the display, 2d pixel art has of course the same scaling issue on the visual side. We have found that nice hand drawn pixel tiles, made kind of for the iPhone resolution, can be nice on e.g. iPad any even large displays too .. when the style is pixel art. We hope others find that too when we launch the game :) But certainly vector-style / 3d models is often be practical with that.