Sounds like a regression bug then, since this wasn't how it behaved last time I tried using submitDelta().
The way I got it to work for my code wasn't just that I condensed the data update into a single value, it was that this allowed me to call submitValue() instead of submitDelta(). Sounds like a pretty ugly bug. Maybe you can do something similar as a workaround for now? Best, --Justin On Jan 15, 8:23 pm, HaiColon <[email protected]> wrote: > I'm actually submitting four things with each call to submitDelta(), > but I only get two callbacks instead of four so this can't be directly > related. But it's interesting to see that combining two values into > one worked for you, hopefully this additional info will help the Wave > team to find the bug. > > Here's the link to the bug report I filed if anyone wants to track > it:http://code.google.com/p/google-wave-resources/issues/detail?id=623 > > The bug report also links to this thread for additional information. > > On Jan 16, 1:25 am, jhouk <[email protected]> wrote: > > > Hi Chris, > > > I don't suppose the delta that you're submitting is two values? I > > found to my surprise when working with submitDelta for the first time > > that my gadget got a callback from Wave for each value submitted in > > the delta, instead of the entire delta object getting passed back to > > the gadget in a single callback. > > > Since the data I was submitting in my case was tightly coupled, I > > combined the data into a single JSON string value and submitted it in > > a single submitValue() call instead and it worked great. > > > Hope this helps, > > --Justin > > > On Jan 14, 10:02 am, HaiColon <[email protected]> wrote: > > > > I'm currently writing a multiplayer Match 3 style game for Google Wave > > > (Match 3 = If three or more blocks/gems/whatever of the same color are > > > aligned horizontally or vertically, those blocks are destroyed, giving > > > you points. The blocks above the destroyed blocks fall down and the > > > now empty space at the top is filled with new random blocks, giving > > > the illusion of an endless supply of new blocks falling down. A game > > > move can swap one block with another one that has to be 1 block to the > > > left, the right, up, or down of it and the move has to cause the > > > destroying of blocks or the move is invalid). > > > > With every move made I do a submitDelta, submitting the game move. > > > What's happening now is that first, Wave sends the last state that was > > > sent through a prior call to submitDelta() (the game move before this > > > one) and then it sents the new state that was submitted with > > > submitDelta() just now, thus sending every submitDelta() twice. I > > > verified with wave.log() that my code only sends one update so I'm > > > 99.9% sure that it's not a bug in my code. > > > > Is this the intended behavior, or a bug? And if it's intended, why is > > > that so? :) I can't really think of any reason why this would be > > > intended behavior but I may well be wrong. > > > > To circumvent this behavior, I added a timestamp to every submitDelta > > > () call and my code checks the timestamp and doesn't apply the changes > > > it receives if it already received a state change with this timestamp. > > > This seems to be working fine. Here's a video I made just now of the > > > game in action with this workaround > > > applied:http://www.youtube.com/watch?v=bdrBIW50N4k > > > > Also, could someone shed a bit of light onto how Gadget state works > > > exactly? From looking at the debug log in Wave, it seems that with > > > every submitDelta, everything you ever stored in the gadget state is > > > sent over the network, instead of just the parts you just submitted > > > with submitDelta. Is this true? For my game this is a bit overkill. I > > > have to store a few hundred (maybe thousand) pre-generated random > > > colors for new blocks (those that replace destroyed blocks) so that > > > every Wave user of the gadget sees the same new blocks in his Wave > > > client when blocks are destroyed after a game move. I only need this > > > list of colors transferred once every time you open the wave that > > > contains the gadget, so sending it only once would suffice. It does > > > look like Wave sends this list of random colors with every game move > > > though, even if I don't access it with wave.gadgetState().get > > > ("randomColors"). I hope I'm wrong about this ^^ > > > > Thanks in advance for any information about this. > > > > Cheers, > > > Chris
-- You received this message because you are subscribed to the Google Groups "Google Wave API" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-wave-api?hl=en.
