Newbie hints and a non-3D demo application on Croquet Islands and TeaTime

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Newbie hints and a non-3D demo application on Croquet Islands and TeaTime

Georg Köster
Hi all,

here is the Demo I built with Croquet 1.0.18. I avoided the 3D parts including CroquetHarness by reading the code and extracting the parts that are needed to  use islands all by themselves, without the harness.

I like 3d, but that's not the most interesting part of Croquet. The architecture has a far wider applicability we believe.

You might have a look and tell me what you think. If you believe it useful, I can add non-local network connectivity (currently excluded for the sake of simplicity).

It has a UI ;-)

It has a Readme class to start off from. Search for SWD in classes and find it.

It has tests (which fail randomly) - but mostly work, even more so if run separately!

NEWBIE HINTS:
+ Read SBE 2.9 Saving and sharing SmallTalk code
+ Forget, just FORGET reusing a saved image. Always always copy the original and start Croquet with the fresh copy. I had weird problems with a semi fresh copy - just a warning. 
+ Don't trust Croquet written Documentation: Fly over docu, read code, compare with docu. Future calls for example don't return Promises (in the sense of TPromise) but TFarRefs.
+ Read the TFarRef class.
+ Look at SWDMaster>>create to get an idea of the infrastructure setup
+ Read furthermore the CroquetHarness class if you're interested in the 3D stuff
+ Careful with using a variable named 'island', as it exists already in Object and has an accessor that won't be autogenerated for your variable! Hard to debug showstoppers inbound if you do!
+ Network communication 'facets' are a way of installing a hook for remote calls. They are also installed to receive the responses for a remote call!
Remote calls work like this:

 1. Install response facet (for example named 'loginResponse') in local facet map. The facet contains a promise.
 2. Send message over connection containing the destination facet, for example 'loginFacet', and referencing the response facet 'loginResponse' (these references are strings or object id strings, or encrypted hashes of strings too, if security is used (see how SimpleController builds its facet map on init))
 3. Wait on the loginResponse facet's promise
 [4.] From incoming message: The message references 'loginResponse', so the event thread finds the corresponding facet object in the facet table, and sends a message to an object contained in the facet object. Here the promise on which one can wait on the receiver side is resolved (notified, its waiting thread is awakened). So here the receiver can continue. Then the response facet is deleted from the local facet map. The response facet had referenced the code and data that ran for the response and is not needed any more.
 5. Waiting thread makes use of result - maybe, not necessary in some cases. All work might have been done by network event thread.

This is pretty rough, but I wanted to stay short. Maybe somebody on the list can comment? It took me a lot of time to dig through all the inheritance to get this.
Basically as a newbie I had quite a tough time to understand the code. I real killer was the Object>>island message - my Master and participant had exactly that is the name for the island... quite difficult to find for a newbie.

I am a student at www.hpi.uni-potsdam.de and started with Squeak few weeks back. Short resume: Get tough newbies, this is the programming environment most difficult to start working on available. Afterwards you're surprised at the many good ideas you find. Nevertheless, the starting is too tough. Just mind getting the code out of it!

Just my 2 cents and the result of a lot of head banging, so wanted to share this for my followers and for the general dev-reader to comment on!

Best regards,
Georg

SWD-Croquet-Demo.st (34K) Download Attachment
SWD-Croquet-Demo-Tests.st (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Newbie hints and a non-3D demo application on Croquet Islands and TeaTime

Georg Köster
The TPromise fixes in the attached file are also needed. Sorry for the omission!

Georg

PS: I'm using a wait with timeout instead of blocking infinitely for login, but that fails with the stock TPromise class because of an already filed bug.

On Jan 14, 2008 3:00 AM, Georg Köster <[hidden email]> wrote:
Hi all,

here is the Demo I built with Croquet 1.0.18. I avoided the 3D parts including CroquetHarness by reading the code and extracting the parts that are needed to  use islands all by themselves, without the harness.

I like 3d, but that's not the most interesting part of Croquet. The architecture has a far wider applicability we believe.

You might have a look and tell me what you think. If you believe it useful, I can add non-local network connectivity (currently excluded for the sake of simplicity).

It has a UI ;-)

It has a Readme class to start off from. Search for SWD in classes and find it.

It has tests (which fail randomly) - but mostly work, even more so if run separately!

NEWBIE HINTS:
+ Read SBE 2.9 Saving and sharing SmallTalk code
+ Forget, just FORGET reusing a saved image. Always always copy the original and start Croquet with the fresh copy. I had weird problems with a semi fresh copy - just a warning. 
+ Don't trust Croquet written Documentation: Fly over docu, read code, compare with docu. Future calls for example don't return Promises (in the sense of TPromise) but TFarRefs.
+ Read the TFarRef class.
+ Look at SWDMaster>>create to get an idea of the infrastructure setup
+ Read furthermore the CroquetHarness class if you're interested in the 3D stuff
+ Careful with using a variable named 'island', as it exists already in Object and has an accessor that won't be autogenerated for your variable! Hard to debug showstoppers inbound if you do!
+ Network communication 'facets' are a way of installing a hook for remote calls. They are also installed to receive the responses for a remote call!
Remote calls work like this:

 1. Install response facet (for example named 'loginResponse') in local facet map. The facet contains a promise.
 2. Send message over connection containing the destination facet, for example 'loginFacet', and referencing the response facet 'loginResponse' (these references are strings or object id strings, or encrypted hashes of strings too, if security is used (see how SimpleController builds its facet map on init))
 3. Wait on the loginResponse facet's promise
 [4.] From incoming message: The message references 'loginResponse', so the event thread finds the corresponding facet object in the facet table, and sends a message to an object contained in the facet object. Here the promise on which one can wait on the receiver side is resolved (notified, its waiting thread is awakened). So here the receiver can continue. Then the response facet is deleted from the local facet map. The response facet had referenced the code and data that ran for the response and is not needed any more.
 5. Waiting thread makes use of result - maybe, not necessary in some cases. All work might have been done by network event thread.

This is pretty rough, but I wanted to stay short. Maybe somebody on the list can comment? It took me a lot of time to dig through all the inheritance to get this.
Basically as a newbie I had quite a tough time to understand the code. I real killer was the Object>>island message - my Master and participant had exactly that is the name for the island... quite difficult to find for a newbie.

I am a student at www.hpi.uni-potsdam.de and started with Squeak few weeks back. Short resume: Get tough newbies, this is the programming environment most difficult to start working on available. Afterwards you're surprised at the many good ideas you find. Nevertheless, the starting is too tough. Just mind getting the code out of it!

Just my 2 cents and the result of a lot of head banging, so wanted to share this for my followers and for the general dev-reader to comment on!

Best regards,
Georg


TPromise.st (5K) Download Attachment