Archive creation for newbies

Eric Scharff eds_2 at yahoo.com
Fri Nov 18 16:32:04 UTC 2005


I am developing a simple game that is extremely
resource-intensive.  It is made from dozens of sprites,
background images, and music clips stored as PNGs, JPEGs, and
MIDs respectively.  I'm looking for advice about designing and
packaging this in Squeak.

My current idea is to have a GameResource class, which is
basically a dictionary from which I can get the files I need. 
For example, I might call

 levelBackground := GameResource formNamed: 'level1'.
 levelMusic := GameResource songNamed: 'level1'.

GameResource would cache resources internally, and load them on
demand

formNamed: name
	^GameForms at: name ifAbsent: [
		GameForms at: name put: (Form fromFileNamed: name , '.jpg').
		^GameForms at: name]

Does this make sense?

This would be great for local file access, but I'd really
instead like to bundle my change as something easily filed in. 
What I guess I'd really like is to manage my code with
Monticello, and then bundle the images.

The best answer appears to be to use a SAR file and
SARInstaller.  The SAR file would include the MCZ and the
resources.  How would I then write a preamble and postscript
that would populate the GameResource dictionaries?

This seems to be the cleanest way, but is there a better way to
do this?  I've considered using the project loading mechanism,
but have run into other problems (see the subsequent message).

Are there any good examples out there on how to do this
properly?

Thanks,

-Eric


		
__________________________________ 
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com



More information about the Squeak-dev mailing list