rather than assuming that as soon as they construct the EZGameControl, they're
ready to play. That's not totally unreasonable, but with this new explicit
mechanism, games can also "rematch" (or just replay if it's single player) by
having all clients call playerReady() again after the game has ended.
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@328 c613c5cb-e716-0410-b11b-feb51c14d237
dobj transaction. Thanks to mdb for the idea of accepting a function to run
for the batch, rather than exposing startTransaction() and commitTransaction()
directly.
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@317 c613c5cb-e716-0410-b11b-feb51c14d237
the data Object (actually a proxy to it) and do a for or for-each on that,
but we removed that when we made 3 different kinds of sets.
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@307 c613c5cb-e716-0410-b11b-feb51c14d237
a way to start a new round other than by setting a nonzero delay when ending
the previous round.
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@239 c613c5cb-e716-0410-b11b-feb51c14d237
this was the right thing to do. Go ahead and log the innards-laden stack
trace, we'll be glad when there's a bug in our innards.
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@229 c613c5cb-e716-0410-b11b-feb51c14d237
will see a stack trace originating in the EZGameControl, hopefully
with a useful message.
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@228 c613c5cb-e716-0410-b11b-feb51c14d237
Doing this on the client, while theoretically possible, is more complex. We
have a server, we use it to provide commonly needed services, the assignment of
a single client to control the game is a commonly needed service. This also
matches the way other services like turn change and game start and end are
implemented.
A side note: the client-side code was not properly handling disconnected
players, which the server code properly handles.
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@224 c613c5cb-e716-0410-b11b-feb51c14d237
It acted as a proxy for the distributed ez properties, such that you could
set properties in the object and they'd magically go out over the network.
Like so:
var data :Object = _gameCtrl.data;
data.scores = [ 0, 0 ];
data.startingPlayer = (Math.random() > .5) ? 0 : 1;
Of course, you could read props too and even iterate over them in a for
or for-each loop.
But, with the addition of testAndSet() and setImmediately() it was decided
that this direct access was ripe for confusion. Also, because there was
not a *second-level* proxy for every array property, it didn't send
individual array element updates over the network. I suppose I could write
an array proxy and create one for every array property set, but jeezgod
let's not get too crazy. Let's just keep it EZ and make people use our
nice well-documented methods.
If we want to add a method to EZGameControl for iterating over all
properties, we can. That might be useful...
There is one small concern, which is that now we're handing off our
internal storage Object to usercode, so someone would have to modify
their copy of EZGameControl and then they could... mess up their own game.
Whatever.
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@221 c613c5cb-e716-0410-b11b-feb51c14d237
- every time we check for the host's existence, if the host doesn't exist
or abandoned the game, the client will try to claim their role automatically
- unified both event types into one "host changed" event
- fixed bug that ignored negative player ids
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@218 c613c5cb-e716-0410-b11b-feb51c14d237
Clarify that it applies to occupants, not just players.
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@213 c613c5cb-e716-0410-b11b-feb51c14d237
Of course, the flash documentation says that function.apply() returns
void, but luckily this is not the case. DO NOT TRUST THEIR DOCS, they are
riddled with errors.
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@210 c613c5cb-e716-0410-b11b-feb51c14d237
Made it protected, added a second function for 'friend' access.
We could use a custom namespace for this, too.
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@206 c613c5cb-e716-0410-b11b-feb51c14d237
essentially calling setImmediate() when they call set(), since set() used
to be immediate.
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@197 c613c5cb-e716-0410-b11b-feb51c14d237
- Moved property testing, so that it happens before any propertySet events are
dispatched. In the previous version, testing happened while processing the
set event on the server - but since by that time client events have already been
sent, it introduced the possibility of short-lived inconsistencies between client
and server data models.
- Introduced a separate EZ API call for test and set - not only does it perform
the test, but unlike regular set, it does not cache the new value ahead of time.
Instead the new value will have to arrive from the server, at some future point.
- Trimmed PropertySetEvent and other handlers back down - they don't need to
carry any of the test info around, after it's already been performed. Also
cut redundant testing on the clients.
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@195 c613c5cb-e716-0410-b11b-feb51c14d237
it's atomic in the sense that a single server event will test the variable,
and only set it if the previous value was null (i.e. didn't exist).
This allows for a level of elementary synchronization between the clients.
The new function on EZGameControl is:
_gameCtrl.testAndSet (propertyName, newValue[, index])
I hoped to generalize this to test against arbitrary values, but that's
significantly harder, since properties accept numerous types as values,
and those can have different representations on the client and the server.
So it remains a check against null until we need to generalize it. :)
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@193 c613c5cb-e716-0410-b11b-feb51c14d237
Undocumented, I'm sure we'll change some things around soon.
Fixed a few bugs, too.
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@190 c613c5cb-e716-0410-b11b-feb51c14d237
- switched everything to be based on playerId instead of index
(which doesn't make sense for a party game.)
- started adding new functions
- backwards compatible with all old games!
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@186 c613c5cb-e716-0410-b11b-feb51c14d237
and retrieving a set of language-specific letters. This is just a transient checkin, since
it only pushes data both ways through the ActionScript/Java interface ("small step for
mankind, huge step for me" kind of a thing ;). Word lookup logic will be coming next.
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@181 c613c5cb-e716-0410-b11b-feb51c14d237
It may be well worth adding an isConnected() method that can be used to test
whether the EZGame stuff is connected or whether we should just show
demo graphics or something.
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@141 c613c5cb-e716-0410-b11b-feb51c14d237
They can add their keyboard listeners directly to the GameControl object
to receive global key events.
There are strange focus weirdnesses on the flex side- sometimes you have
focus with no focus highlight and sometimes you don't have focus and you
do have the highlight. Punting, rather than spending more hours on this.
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@138 c613c5cb-e716-0410-b11b-feb51c14d237
Now, instead of implementing "Game" and having the EZGame object assigned
to you, you create it yourself using your top-level component.
You must register listeners manually, and keyboard focus is currently an
issue that I'm working on.
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@137 c613c5cb-e716-0410-b11b-feb51c14d237