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

James Paige Bob at HamsterRepublic.com
Wed Mar 26 08:00:06 PDT 2008


On Tue, Mar 25, 2008 at 10:41:16PM -0700, Brian Fisher wrote:
> 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

Fixed.

> ...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.

Hmmm. In the ImageAsset browser, ! appears last, not first... also, I 
can't see how the other assets are sorter... it certainl ain't 
alphabetically.

> 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?

I am not sure what is best for the default case, but there are 
situations where I want to add an unassigned asset, and then choose that 
asset through the editor interface, but I cannot get to the interface 
because the unassigned asset raises an exception. Catch 22


> >  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.

Hmmm... Still a bit confused. I guess I would have to see the code.

> 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

It is better to just load what you know you will need, and worry about 
loading performance problems only when they actually occur.

---
James



More information about the Dev mailing list