Commit Graph

47 Commits

Author SHA1 Message Date
Ray Greenwell 3fc47c0b9b Comment clarification.
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@462 c613c5cb-e716-0410-b11b-feb51c14d237
2007-10-23 01:23:34 +00:00
Michael Bayne 60b3eabc16 Disconnect the client side when we disconnect on the backend so that we don't
end up differing in opinion about whether or not we're connected.


git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@456 c613c5cb-e716-0410-b11b-feb51c14d237
2007-10-18 00:57:56 +00:00
Ray Greenwell 18ac5a065f getOccupants() -> getOccupantIds(), which is more accurate and consistent
with SeatingControl's getPlayerIds().


git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@453 c613c5cb-e716-0410-b11b-feb51c14d237
2007-10-17 21:09:48 +00:00
Michael Bayne d136386348 Note that endRound() should not be called immediately prior to endGame(),
rather endGame() should be called and the last round is never officially
"ended". This ensures that GameObject.roundId is left in a sane state at the
end of the game in case of a rematch.


git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@445 c613c5cb-e716-0410-b11b-feb51c14d237
2007-10-09 23:47:37 +00:00
Michael Bayne 74665f1663 Added EZGameControl.restartGameIn(seconds).
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@416 c613c5cb-e716-0410-b11b-feb51c14d237
2007-08-23 23:19:51 +00:00
Ray Greenwell 8233be01e7 Added filter(text) to the EZGame API. Untested.
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@394 c613c5cb-e716-0410-b11b-feb51c14d237
2007-07-31 06:51:20 +00:00
Michael Bayne 1c92282772 Freak not out if someone adds a click handler to something and removes said
thing from the stage in their click handler.


git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@330 c613c5cb-e716-0410-b11b-feb51c14d237
2007-06-25 23:57:19 +00:00
Michael Bayne b87eacd9d6 Allow a game to delay its start until all of its players are actually ready
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
2007-06-25 20:36:16 +00:00
Ray Greenwell bdef34eb69 Exposed a method to allow users to batch property set requests into a
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
2007-06-18 19:33:02 +00:00
Ray Greenwell fb24ff77cc T time!
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@310 c613c5cb-e716-0410-b11b-feb51c14d237
2007-06-05 04:00:12 +00:00
Ray Greenwell e066a12dee Actually, let's make that take a prefix argument, and only return properties
that begin with that prefix.


git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@309 c613c5cb-e716-0410-b11b-feb51c14d237
2007-06-05 03:48:15 +00:00
Ray Greenwell f85af6ffab Added getPropertyNames(), which used to be unnecessary because you could get
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
2007-06-05 03:44:47 +00:00
Par Winzell c98100eb8f Fix artifact from a time when I was putting this into WhirledGames only.
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@284 c613c5cb-e716-0410-b11b-feb51c14d237
2007-04-27 23:35:03 +00:00
Par Winzell fd4b2183ef Let EZGames listen for user chats and pass them on as events to the user code. I'm a little uncertain if we need to do things with e.g. the bundle in the chat message object?
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@283 c613c5cb-e716-0410-b11b-feb51c14d237
2007-04-27 23:32:43 +00:00
Ray Greenwell eab2ae7d91 Set gameconfig to an empty object until populated by the backend.
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@273 c613c5cb-e716-0410-b11b-feb51c14d237
2007-04-09 20:45:03 +00:00
Robert Zubeck 636620c56e Adding a missing bit of info about the round API.
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@244 c613c5cb-e716-0410-b11b-feb51c14d237
2007-03-14 01:08:33 +00:00
Ray Greenwell 3825cf2e68 Allow EZGames to have custom configuration options specified as XML.
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@240 c613c5cb-e716-0410-b11b-feb51c14d237
2007-03-13 00:50:14 +00:00
Ray Greenwell 565c700d61 Clarify, although can this be what is meant? There does not appear to be
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
2007-03-12 22:23:00 +00:00
Ray Greenwell df483cd566 You can't use that! It's the square of an imaginary number!
(0 should mean no-value)


git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@238 c613c5cb-e716-0410-b11b-feb51c14d237
2007-03-12 22:20:39 +00:00
Michael Bayne 5b77f2f95d Added support for handling games with multiple rounds.
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@237 c613c5cb-e716-0410-b11b-feb51c14d237
2007-03-11 07:59:23 +00:00
Ray Greenwell 69bed52e99 Was writing an email to query for opinions on this, then decided that
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
2007-03-06 19:20:17 +00:00
Ray Greenwell d38c43cd5b Throw an error if something booches talking to EZGame. The user
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
2007-03-06 19:04:11 +00:00
Ray Greenwell 384cc76cfe Don't make endGame varargs. Shoulda done this a while ago.
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@226 c613c5cb-e716-0410-b11b-feb51c14d237
2007-03-06 00:20:25 +00:00
Michael Bayne d77b8363f7 Added a server managed notion of which client is controlling the game.
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
2007-03-04 20:05:58 +00:00
Ray Greenwell 70b9c7e43b It's a shame, because it's cool, but GameData isn't really needed anymore.
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
2007-03-02 08:38:45 +00:00
Robert Zubeck 628e90b347 Updates to host coordinator:
- 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
2007-02-27 00:39:20 +00:00
Ray Greenwell 4df07f7ced That would be occu-PANTS!
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@217 c613c5cb-e716-0410-b11b-feb51c14d237
2007-02-26 23:07:20 +00:00
Ray Greenwell a5ba21f2bb Bugfix, getCookie was bumped to _v2 recently.
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
2007-02-26 22:11:40 +00:00
Ray Greenwell 03876838b3 Gah, my bad: we've got to return the value from the friend function.
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
2007-02-24 00:42:24 +00:00
Michael Bayne 33f55d5a8d Header patrol. Please be sure to use the header in lib/SOURCE_HEADER when
creating new source files.


git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@209 c613c5cb-e716-0410-b11b-feb51c14d237
2007-02-24 00:37:33 +00:00
Ray Greenwell f19a973e27 The larger point is, we shouldn't throw an uninformative NPE.
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@208 c613c5cb-e716-0410-b11b-feb51c14d237
2007-02-24 00:13:22 +00:00
Michael Bayne 200042c87e Return null if get() is called before we have our game data, rather than NPE.
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@207 c613c5cb-e716-0410-b11b-feb51c14d237
2007-02-23 23:29:43 +00:00
Ray Greenwell 9eedd5678c Making callEZCode() 'internal' booched it for WorldGameControl.
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
2007-02-22 03:53:44 +00:00
Ray Greenwell 9e8dce3619 EZGame API breakup. Possibly a little more to come.
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@205 c613c5cb-e716-0410-b11b-feb51c14d237
2007-02-22 03:44:12 +00:00
Ray Greenwell e8ada1ac88 Added setImmediate(), made it so that old un-recompiled games are
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
2007-02-19 21:55:10 +00:00
Robert Zubeck 83e02730cf Fixes for property setting via atomic test-and-set:
- 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
2007-02-19 19:40:09 +00:00
Robert Zubeck bdfcd156ab For EZ property sets, added a setter that performs an "atomic" test-and-set:
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
2007-02-15 21:55:49 +00:00
Ray Greenwell ee871c3f2f Occupant events.
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
2007-02-14 23:50:33 +00:00
Ray Greenwell e5d5480e9b EZGameControl updates:
- 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
2007-02-14 01:59:29 +00:00
Robert Zubeck 400389ca03 Adding two dictionary-related functions: checking a word against a dictionary,
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
2007-02-12 23:32:37 +00:00
Ray Greenwell e6c3bc3dd2 Fixed doc.
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@167 c613c5cb-e716-0410-b11b-feb51c14d237
2007-02-10 01:32:35 +00:00
Ray Greenwell 29bec533d8 Documented the events currently being dispatched.
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@147 c613c5cb-e716-0410-b11b-feb51c14d237
2007-01-12 23:10:30 +00:00
Ray Greenwell a6de2c9bc6 Added isConnected().
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@144 c613c5cb-e716-0410-b11b-feb51c14d237
2007-01-10 19:51:49 +00:00
Ray Greenwell 6d2ecb8f67 Don't generate a TypeError if we're not in an EZGame environment.
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
2007-01-08 23:37:11 +00:00
Ray Greenwell 08d317b329 Added rescued documentation from the old EZGame class.
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@140 c613c5cb-e716-0410-b11b-feb51c14d237
2007-01-06 01:58:43 +00:00
Ray Greenwell 00e2c45f01 Mostly kinda fixed up keyboard issues for EZGames.
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
2007-01-06 01:44:05 +00:00
Ray Greenwell 3b08974f73 Revamped EZGame to work over the security boundary.
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
2007-01-05 18:59:08 +00:00