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.


Reply via email to