KCroquetParticipant subclass: #HolodeckSimpleDemoParticipant instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Grid-Holodeck'! !HolodeckSimpleDemoParticipant methodsFor: 'as yet unclassified' stamp: 'strick 4/1/2007 16:32'! createHarness " we really haven't changed the Harness any yet, so a GridHarness will do. " ^ GridHarness new! ! !HolodeckSimpleDemoParticipant methodsFor: 'as yet unclassified' stamp: 'strick 4/1/2007 16:31'! entry ^entry ifNil: [self entryWorld: HolodeckSimpleDemoWorld. entry]. ! ! "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! HolodeckSimpleDemoParticipant class instanceVariableNames: ''! !HolodeckSimpleDemoParticipant class methodsFor: 'as yet unclassified' stamp: 'strick 4/1/2007 16:26'! descriptionForPartsBin ^ self partName: 'Holodeck Simple Demo' categories: #('Strick') documentation: 'not yet' sampleImageForm: self defaultForm.! ! !HolodeckSimpleDemoParticipant class methodsFor: 'as yet unclassified' stamp: 'strick 4/1/2007 16:29'! worlds ^ { self. }! ! WisconsinWorld subclass: #HolodeckSimpleDemoWorld instanceVariableNames: 'things gridConfig' classVariableNames: '' poolDictionaries: '' category: 'Grid-Holodeck'! !HolodeckSimpleDemoWorld methodsFor: 'as yet unclassified' stamp: 'strick 4/1/2007 15:36'! initialize "CONFIGRUABLE CONSTANTS" | space flr sky | gridConfig := GridThingsConfig new parcelRadius: 50 gridScale: 5; yourself. "space" space := HolodeckSimpleSpace new. space initializeWithThingsConfig: gridConfig. space registerGlobal: #mainEntry. "light" self makeLight: space. "floor -- must be local flr, not inst var floor, because Wisc wants to send #contents to floor" flr := self makeFloor: space fileName: 'lawn.bmp'. flr extentX: 100 y:0.5 z: 100. "sky" sky := TSkyBox new initializeWithFileName: 'GRS'. sky step. "get going" space addChild: sky. ^ space! ! "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! HolodeckSimpleDemoWorld class instanceVariableNames: ''! !HolodeckSimpleDemoWorld class methodsFor: 'as yet unclassified' stamp: 'strick 4/1/2007 15:14'! islandID ^TObjectID readHexFrom: '1f2f349874e53ebe785f681585222222'! ! GridThingsSpace subclass: #HolodeckSimpleSpace instanceVariableNames: 'myFarRef mcRef' classVariableNames: '' poolDictionaries: '' category: 'Grid-Holodeck'! !HolodeckSimpleSpace methodsFor: 'as yet unclassified' stamp: 'strick 4/1/2007 17:01'! initialize super initialize. myFarRef := Processor activeIsland asFarRef: self. mcRef := Island doInOcean: [ | mc | mc := MatterCompiler new spaceRef: myFarRef. Island default asFarRef: mc ]. ! ! TGroup subclass: #Matter instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Grid-Holodeck'! !Matter commentStamp: '' prior: 0! Matter are the objects manipulated by the MatterCompiler. Matter are puppets for objects in the InterMetaGrid. Matter is a TGroup; some other TFrame objects (TCube, etc.) will be the contents of the group, for rendering.! !Matter methodsFor: 'as yet unclassified' stamp: 'strick 3/31/2007 14:09'! translation: vect3 super translation: vect3. self signal: #positionChanged with: self position! ! Object subclass: #MatterCompiler instanceVariableNames: 'spaceRef objects httpPrefix urlPrefix mcId after eventLoop' classVariableNames: '' poolDictionaries: '' category: 'Grid-Holodeck'! !MatterCompiler methodsFor: 'private' stamp: 'strick 3/31/2007 17:07'! instantiate: description | id objRef | id := description matterId. objRef := MatterRef new ref: (spaceRef island new: description matterClass); yourself. self thingsRef addChild: objRef. "objRef ref future position: description position. --etc" objects at: id put: objRef. ! ! !MatterCompiler methodsFor: 'private' stamp: 'strick 3/31/2007 14:21'! random24 ^ ((TObjectID new: 4) unsignedLongAt: 1) bitAnd: 16rFFFFFF! ! !MatterCompiler methodsFor: 'http' stamp: 'strick 3/31/2007 16:51'! doCommand: words | ts objId field value | ts := words at: 1. objId := words at: 2. field := words at: 3. value := words at: 4. after := ts. Transcript cr; show: words. [ field = 'k' ] ifTrue: [ "we abuse the 'kind' message for instantiate. " self instantiate: (MatterDescription new matterClass: MatterCube; yourself). ]. [ field = 'l' ] ifTrue: [ "location and rotation" | args obj | args := value findTokens: $, . " args is 'x,y,z,r,s,t' for location then rotation " obj := objects at: objId. obj ifNotNil: [ obj translationX: args first y: args second z: args third. ] ] ! ! !MatterCompiler methodsFor: 'http' stamp: 'strick 3/31/2007 14:48'! httpCallSync "<< (MatterCompiler new httpGridGet) contents (self findTokens: String crlf) collect: [:s | s findTokens: Character space] HTTPClient httpGet: 'http://sybil.yak.net:30306/sync?auth=MatterConverter:primhog&mc=1&max=12&after=0' a RWBinaryOrTextStream 'T01175337085000 11112 k cube T01175337085001 11112 s 0.5,0.5,2.0,1,0.03,0 T01175337085002 11112 l -15,-20,2,0,0,0 T01175337085003 11113 k cube T01175337085004 11113 s 0.5,0.5,2.0,1,0.06,0 T01175337085005 11113 l -15,-10,2,0,0,0 T01175337085006 11114 k cube T01175337085007 11114 s 0.5,0.5,2.0,1,0.09,0 T01175337085008 11114 l -5,-20,2,0,0,0 T01175337085009 11115 k cube T01175337085010 11115 s 0.5,0.5,2.0,1,0.12,0 T01175337085011 11115 l -5,-10,2,0,0,0 ' >>" | u | u := 'http://sybil.yak.net:30306/sync?auth=MatterConverter:primhog', '&mc=', mcId asString, '&after=', after asString, '&max=12' . ^ HTTPClient httpGet: u ! ! !MatterCompiler methodsFor: 'http' stamp: 'strick 3/31/2007 15:20'! startEventLoop self stopEventLoop. eventLoop := self fork: #synchronizeFromGridEventLoop at: Processor userSchedulingPriority + 2.! ! !MatterCompiler methodsFor: 'http' stamp: 'strick 3/31/2007 15:17'! stopEventLoop eventLoop ifNotNil:[eventLoop terminate]. eventLoop := nil.! ! !MatterCompiler methodsFor: 'http' stamp: 'strick 3/31/2007 15:20'! synchronizeFromGridEventLoop "<< self new synchronizeFromGrid >>" | commands | true whileTrue: [ [ commands := self httpCallSync contents findTokens: String crlf. commands size > 0 ] whileTrue: [ commands do: [ :s | self doCommand: (s findTokens: Character space) ]. (Delay forSeconds: 1) wait. ]. (Delay forSeconds: 10) wait. ]! ! !MatterCompiler methodsFor: 'initialize' stamp: 'strick 3/31/2007 16:39'! initialize super initialize. objects := Dictionary new. mcId := 1000000 + self random24. urlPrefix := 'http://sybil.yak.net:30306/get?auth=MatterConverter:primhog'. after := 0.! ! !MatterCompiler methodsFor: 'accessing' stamp: 'strick 3/31/2007 17:01'! spaceRef ^ spaceRef! ! !MatterCompiler methodsFor: 'accessing' stamp: 'strick 3/31/2007 17:01'! spaceRef: aSpace spaceRef := aSpace! ! !MatterCompiler methodsFor: 'accessing' stamp: 'strick 3/31/2007 17:04'! thingsRef ^ spaceRef get: #things! ! Matter subclass: #MatterCube instanceVariableNames: 'cube' classVariableNames: '' poolDictionaries: '' category: 'Grid-Holodeck'! !MatterCube methodsFor: 'as yet unclassified' stamp: 'strick 3/31/2007 16:35'! initialize super initialize. cube := TCube new. self addChild: cube. ! ! Object subclass: #MatterDescription instanceVariableNames: 'matterClass matterId' classVariableNames: '' poolDictionaries: '' category: 'Grid-Holodeck'! !MatterDescription methodsFor: 'accessing' stamp: 'strick 3/31/2007 13:40'! matterClass "Answer the value of matterClass" ^ matterClass! ! !MatterDescription methodsFor: 'accessing' stamp: 'strick 3/31/2007 13:40'! matterClass: anObject "Set the value of matterClass" matterClass := anObject! ! !MatterDescription methodsFor: 'accessing' stamp: 'strick 3/31/2007 16:37'! matterId ^ matterId! ! !MatterDescription methodsFor: 'accessing' stamp: 'strick 3/31/2007 16:37'! matterId: anId matterId := anId! ! Object subclass: #MatterRef instanceVariableNames: 'ref mc' classVariableNames: '' poolDictionaries: '' category: 'Grid-Holodeck'! !MatterRef methodsFor: 'initialize' stamp: 'strick 3/31/2007 13:28'! mc ^ mc! ! !MatterRef methodsFor: 'initialize' stamp: 'strick 3/31/2007 13:27'! mc: aMatterCompiler mc := aMatterCompiler! ! !MatterRef methodsFor: 'initialize' stamp: 'strick 3/31/2007 13:25'! onPositionChanged: newPosition "talk to matter compiler"! ! !MatterRef methodsFor: 'initialize' stamp: 'strick 3/31/2007 13:29'! ref ^ ref! ! !MatterRef methodsFor: 'initialize' stamp: 'strick 3/31/2007 13:25'! ref: aRef ref := aRef. self startScript: #onPositionChanged: when: {aRef. #positionChanged}.! !