pygame rpg

Rainer Deyke root at rainerdeyke.com
Tue Sep 4 00:08:25 EDT 2001


"Josh" <polopunk209 at hotmail.com> wrote in message
news:d0a9c74e.0109031913.57e629eb at posting.google.com...
> i'm working on a top down rpg using pygame. does anyone have any ideas
> on making graphics for games like this? it will not scroll in real
> time. there will be a "level" on the screen, and when you walk off the
> screen, a new "level" is blitted. also, do you have any ideas on where
> i could look for some source code on a project similar to this? any
> suggestions are appreciated, and thanks in advance.

In my most recent Python rpg project, I was able to redraw the entire screen
at a steady 30 fps.  Nice for background animations.  Unfortunately I had to
move much code into extension modules, resulting in ugly unmaintainable
code.

Anyway, the key is to minimize inner loops in Python.  At 640x480, with
32x32 tiles, you can have 300 tiles on the screen at once - more if you have
multiple layers.  SDL (the backend on pygame) can easily handle that load,
but Python itself can't.  So, create a new surface as big as the visible
playing area and render your tiles (or whatever you're using) onto that
surface.  Then you can render the whole screen by blitting that background
surface first, and then blitting characters/items/monsters/animations on
top.


--
Rainer Deyke (root at rainerdeyke.com)
Shareware computer games           -           http://rainerdeyke.com
"In ihren Reihen zu stehen heisst unter Feinden zu kaempfen" - Abigor





More information about the Python-list mailing list