[Dev] SVN: james/326 Experimenting with a different method of styling a creature's animations

Brian Fisher brian at hamsterrepublic.com
Tue Mar 25 22:41:16 PDT 2008


On Tue, Mar 25, 2008 at 10:49 AM, James Paige <Bob at hamsterrepublic.com> wrote:
>  Well, the only reason I used os.path.join was because had to manually
>  check whether or not the png file existed before assigning it's name to
>  the ImageAsset's AssetRef... I don't understand why after I did
>  self.style.sprite = "folder/and/file_that_totally_does_not_exist" I got
>  a crash on display.render() instead of displaying he broken image
>  asset...
>
I don't see os.path.join affecting whether or not you can check for
file existence. On windows forward slashes are accepted just fine - I
find it annoying actually that it tries to use backslashes

...as far as what motherhamster does with a bad asset reference -
there is no registered broken/invalid image asset it seems. The !
asset is simply the first in the list and therefore serves as the
default if none is specified, which is different than being a
registered broken/invalid asset.

So should we have a broken image asset? maybe it would be something
that would be programatically created by pygame draw funcs? Would you
have seen a broken image come up or get an exception?

also, another related thing is what to do if a bad asset_id is passed
to an AssetRef - it should probably raise an exception immediately
rather than wait to have a problem when it tries to draw it, so the
exception captures the actual problem?



>  Understood... (well, mostly. explain the "advantage of being able to
>  build a used asset tree even if..."
>
2 things - first one is in a large game the asset tree can help you
preload and unload assets as appropriate for level loading or zones or
something. For instance, you could find the root level 1 object,
search all the assets it references and so on and then unload stuff
that's not used and then preload the stuff that is used with a little
level loading bar, to make sure the level run smooth.

the asset tree can also help you find art and sound and stuff you left
in the game's folders but maybe stopped using to help keep the
distribution small in the end.

Of course tools like that fail if relationships aren't reflected in a
way that the asset traversing stuff can accurately understand, so it's
good to avoid dynamic loading if you can help it, in my opinion



More information about the Dev mailing list