Re: [Pipmak-Devel] new features in Pipmak
Status: Alpha
Brought to you by:
cwalther
From: Christian W. <cwa...@gm...> - 2008-10-05 10:32:48
|
Aidan Gauland wrote: > 1. > Problem: Running Lua code immediately after a certain sound stops playing. > > Specific instance: In node 122, I want to make the a button pulse to a > heartbeat sound, which is started by moving the mouse over a hotspot, and then > started again when the sound stops playing. I could use Pipmak schedule, but > I'd have to hard-code the duration of the sound file, and, besides, that would > leave a little more room for accumulated time-sync errors. > > Possible Solution: Giving sounds something like the onenternode handler for nodes. That sounds like a good idea. To implement it, however, it seems that you'd have to poll OpenAL whether the sound is still playing, and you could just as well do that directly from Lua (sound:playing() method). How about adding a "duration" method to sounds, so that you could query the duration and use pipmak.schedule? That should be trivial. Neither of these approaches would be accurate enough for seamless concatenation of sounds, due to Pipmak's synchronous frame-by-frame design. For that, you'd have to queue the sound buffers into the same OpenAL source, while currently every Pipmak sound has its own source (so that sounds can play concurrently). > 2. > Problem: Restoring engine settings from variables in the state table (specific > to a particular Pipmak project file). > > Specific instance: I have a settings node (121), but the settings don't > persist between sessions (i.e. they're lost when you save and resume a game). > > Possible Solution: Adding a handler equivelant to onopenproject that is run > when opening a saved game. That should be easy to add, but can you elaborate a bit on how you'd use it? I'm not convinced there's no bug involved or there isn't an easier way of achieving your goal. Engine settings should be restored automatically from saved game files (if they aren't, that's a bug). For your own custom settings, how is restoring them to the state table not sufficient, what exactly would you need to do in that hypothetical "onloadsavedgame" handler? -Christian |