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

[pygame] Building a scene engine - some questions



OK....I've been working on an engine for Pygame that
lets the programmer easily create a game using
multiple tile-based scenes, all running in real-time,
but with only one visible at a time - so that things
can happen in real time far outside of the player's
view, a feature even most commercial games
forego(instead working with only one contiguous area
at a time). I'm also trying to keep things as simple
as possible so that extending the engine to do
scrolling views, multiple views etc. will be fairly
easy. Once I'm happy with the engine itself I'll also
throw in a map editor, and release it to the world
with a nifty example game.

The problem I'm working on now is this:

My test example has a single sprite that can move
around the scene its in with the arrow keys, and
change scenes by pressing "s." It accesses the event
queue directly from Pygame. Sounds good so far, right?
Except that the engine processes the sprites one scene
at a time, so when the player moves from scene 1 to
scene 2, he instantaneously hits "s" in the new scene
and ends up back where he started in scene 1. 

I already have a few solutions, but I thought it was
an interesting problem.

The one I'm more concerned about is how to deal with
saving and loading games. Everything within the engine
is currently chucked into a "controller" object, which
then branches out into graphics, scenes, the scenes
containing sprites etc., and with lots of different
kinds of sprites. The initial startup is handled by
building the scenes and graphics from scratch -
loading up the tilemaps and "presprites" and then
constructing scenes from them. But once things are in
motion, I don't know what I might do. The world could
just restart with the default settings changed, but
that defeats a lot of the potential dynamism - dead
bodies should stay in the same place, pushed boulders
should stay pushed etc. My tendency would be to reach
for pickle, but if I just naively pickle my sprites,
won't they save their image data too and bloat the
save file beyond recognition? I'd love to hear from
someone with more experience in this sort of thing.

I'd also like to know if there are any feature
requests :) Because the engine itself is basically an
extended sprite manager that puts top-level powers
into the hands of each sprite, I can add a lot of
functionality and things like dialogue boxes without
adding bulk to the core of it, even now when I haven't
quite finished it.


	
		
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/