first steps

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

first steps

Ross Boylan
I'm trying to follow along with
but can't actually get a space to appear.  Any hints?

I copied the SimpleDemo class (to RBWorld) and stripped it down so all
it does is create the space:
        "RBWorld initialize"
        | space |

        space := TSpace new.
        space registerGlobal:#rbSpace.
        self makeLights: space.

Then I subclassed CroquetHarness and overrode
        "RBCroquetHarness new setupMaster"
        |island space spc sync |
        island := self createIsland: RBWorld named: 'Master'.
        space := island future at: #rbSpace.

        spc := space future postcard.

        spc whenResolved: [
                self addIsland: island postcard: spc value.
                sync := viewPortal future postcardLink: spc value.
                sync whenResolved: [
                        doRender := true].

I was hoping that when I executed "RBCroquetHarness new setupMaster" a
world would pop up, but nothing happened.

Reply | Threaded
Open this post in threaded view

creating new world and linking portals

Hans Baveco
In Cobalt I am trying to create a new world, add some objects to this world and add and link portals from the current world into the new world and back. All starting from an item I added to the menu in CroquetMenuProject, named #actionCurrentDev (see below). I don't want the avatar to move directly into this new world. The actual new world is created through the #initialize method of a SimpleGISWorld object (subclass of SimpleWorld), also shown below. Most of the work is done in the #setupGISWorld method, added to CobaltHarness.
The code runs ok and a portal appears, but when I point at this new portal in the default Cobalt world, the debugger pops up with the complaint that "this object has no name"..... I have no idea what that indicates. Probably something is missing in the step of the creation of the portal, but on which side & where I don't know, and the online doc isn't very helpful here (I tried to follow the Simple & RecurrentWorld examples...).
I hope somebody can explain how this is supposed to work! The creation of a new world with portals linking to it and back to the current world should be one the simplest things to achieve, I believe, but for me it currently isn't :-)
!CroquetMenuProject methodsFor: '*croquet-GIS' stamp: 'jmb 9/15/2008 15:01'!


"testing how to create a new World with portals to move in and out"

"find the current harness and space"

| harness space c worldName win portal globalID |

harness := hand world ownerMorph harness.

space := harness avatar currentSpace.

"use a counter to provide unique names..."

SimpleGISWorld updateCounter.

c := SimpleGISWorld counter.

worldName := 'GISWorld' , c printString.

"add a window with portal to current space"

win := TWindow new.

win translation: 0@0@-20.

space future addChild: win.

portal := TPortal new.

globalID := ('portalTo' , worldName) asSymbol.

" portal registerGlobal: globalID. " "don't know why, but this seems to register in the 'Squeak' island..?"

harness activeIsland future at: globalID put: portal.

portal extent: 5@5.

win contents: portal.

"next let the harness create the actual new world"

harness setupGISWorld! !


!CobaltHarness methodsFor: '*croquet-GIS' stamp: 'jmb 9/15/2008 15:21'!


| space sync island portal spc pc rportal rpc c newIslandSpaceName thisIsland |

c := SimpleGISWorld counter.

island := self createIsland: SimpleGISWorld named: 'MyGISWorld' , c printString.

newIslandSpaceName := 'gisWorld' , c printString.

space := island future at: newIslandSpaceName asSymbol.

portal := island future at: (newIslandSpaceName , 'Portal') asSymbol.

spc := space future postcard.

pc := portal future postcard.

"when I dont want this new world to become visible, I probably dont want this sync part...?"

spc whenResolved:[

self addIsland: island postcard: spc value.

"sync := viewPortal future postcardLink: spc value.

sync whenResolved:[doRender := true] " "?". "ready to render"


"the active, current Island & TSpace"

thisIsland := self activeIsland.

rportal := thisIsland future at: ( 'portalToGISWorld' , c printString) asSymbol.

rpc := rportal future postcard.

pc whenResolved:[

rpc whenResolved:[

portal future postcardLink: rpc value.

rportal future postcardLink: pc value.



! !


!SimpleGISWorld methodsFor: 'initialize' stamp: 'jmb 9/12/2008 17:06'!


| space floor win portal worldName |

worldName := 'gisWorld' , self class counter printString.

space := TSpace new.

space registerGlobal: worldName asSymbol.

self makeLight: space.

"later we wont need the floor?"

floor := self makeFloor: space fileName: 'lawn.bmp'.

floor extentX: 400 y:0.5 z: 400.

"add a window + portal, back to the space we came from"

win := TWindow new.

win translation: 0@0@-20.

space addChild: win.

portal := TPortal new.

portal registerGlobal: (worldName , 'Portal' ) asSymbol.

portal extent: 5@5.

win contents: portal! !


winmail.dat (9K) Download Attachment