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 17:14'! worlds ^ Worlds ifNil: [ { HolodeckSimpleDemoWorld } ] ! ! WisconsinWorld subclass: #HolodeckSimpleDemoWorld instanceVariableNames: 'things gridConfig' classVariableNames: '' poolDictionaries: '' category: 'Grid-Holodeck'! !HolodeckSimpleDemoWorld methodsFor: 'as yet unclassified' stamp: 'strick 6/24/2007 22:16'! initialize "CONFIGRUABLE CONSTANTS" | space flr sky | false ifTrue: [ Transcript cr; show: 'HSDW initialize...'. gridConfig := GridThingsConfig new parcelRadius: 50 gridScale: 5; yourself. "space" space := HolodeckSimpleSpace new. space initializeThingsWithConfig: 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. Transcript cr; show: 'HSDW initialize done.'. ^ space ]. ^ super initialize! ! "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! 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 6/24/2007 21:59'! initialize super initialize. "<<>>"! ! 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 quit hectare harness' classVariableNames: '' poolDictionaries: '' category: 'Grid-Holodeck'! !MatterCompiler methodsFor: 'private' stamp: 'strick 4/7/2007 01:57'! instantiate: description | id objRef | id := description matterId. "objRef := MatterRef new ref: (spaceRef island new: description matterClass); yourself." objRef := MatterRef new ref: (spaceRef island send: [:o| o new: description matterClass]); yourself. self thingsRef future 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 7/13/2007 23:03'! doCommand: words | objId field value objRef | words size < 4 ifTrue: [ Grid note: 'Bad command: ' , words asString. ^ self. ]. objId := words at: 2. field := words at: 3. value := words at: 4. "======= after := ts. =======" "<< Grid note: '#doComand: ', words asString. >>" field = 'k' ifTrue: [ "we abuse the 'kind' message for instantiate. " (objects includes: objId) ifTrue: [ self debug. ]. "---- should not occur, but did -----" objRef := spaceRef syncSend: #makeName:shape: withArguments: { 'id',objId. value asSymbol. }. objects at: objId put: objRef. ]. field = 'l' ifTrue: [ "location and rotation" | args | args := value findTokens: $; . " args is 'x;y;z;r;s;t' for location then rotation " args := args collect: [ :o | o asNumber ]. objRef := objects at: objId ifAbsent: [nil]. objRef ifNotNil: [ objRef syncSend: #gtPos: withArguments: { args first @ args second @ args third + (50@50@0) }. objRef syncSend: #gtRot: withArguments: { args fourth @ args fifth @ args sixth }. ] ]. field = 's' ifTrue: [ "size and color" | args | args := value findTokens: $; . " args is 'x;y;z;r;s;t' for location then rotation " args := args collect: [ :o | o asNumber ]. objRef := objects at: objId ifAbsent: [nil]. objRef ifNotNil: [ objRef syncSend: #gtSize: withArguments: { args first @ args second @ args third }. objRef syncSend: #gtColor: withArguments: { args fourth @ args fifth @ args sixth }. ] ]. ^ objRef! ! !MatterCompiler methodsFor: 'http' stamp: 'strick 7/13/2007 23:13'! httpCallSync | u z | u := urlPrefix, '&mc=', mcId asString, '&after=', after asString, '&max=12&sync=1' . hectare ifNotNil: [ u := u, '&h=', hectare. ]. "Grid note: 'HTTP <<< ', u." Grid noten: '<', after. z := HTTPClient httpGet: u. "-- Grid critical: [ z := HTTPClient httpGet: u. ]. -------paranoia---------" "Grid note: 'HTTP >>> ', z." Grid noten: '>'. "grrrr (MatterCompiler allInstances size > 1) ifTrue: [ self debug. ]. grrrrrr" ^ z ! ! !MatterCompiler methodsFor: 'http' stamp: 'strick 7/11/2007 22:24'! startEventLoop self stopEventLoop. eventLoop := self fork: #synchronizeFromGridEventLoop at: Processor userSchedulingPriority + 0.! ! !MatterCompiler methodsFor: 'http' stamp: 'strick 3/31/2007 15:17'! stopEventLoop eventLoop ifNotNil:[eventLoop terminate]. eventLoop := nil.! ! !MatterCompiler methodsFor: 'http' stamp: 'strick 7/13/2007 23:06'! synchronizeFromGridEventLoop "<< self new synchronizeFromGridEventLoop >>" | commands | "Delay forMilliseconds: (Random new nextInt: 5000)." [true] whileTrue: [ [ quit ifTrue: [^self]. commands := self httpCallSync contents findTokens: String crlf. Grid noten: ' (SIZE = ', commands size asString,') '. commands size > 0 ] whileTrue: [ "commands do: [ :s | self doCommand: (s findTokens: Character space) ]." commands do: [ :s | | words | "Grid note: 'COMMAND = ', s." words := s findTokens: Character space. words size = 4 ifTrue: [ "only set after if it advances in time" "TODO: should we ignore it, if it goes backwards? Why do we see that?" (words first > after) ifTrue: [ "Grid note: 'First=', words first, ';;;After=', after." after := words first. "Transcript nextPutAll: (after, ';')." ] ifFalse: [ self debug. ]. "Grid note: 'AFTER = ', after." harness enqueueSomeWork: ( MatterCompilerCommand new mc: self words: words). ] ]. (Delay forSeconds: 1) wait. ]. quit := true. "=================== DEBUGGING STOP =========" (Delay forSeconds: 5) wait. ]! ! !MatterCompiler methodsFor: 'initialize' stamp: 'strick 7/13/2007 22:28'! initialize super initialize. objects := Dictionary new. mcId := 1000000 + self random24. urlPrefix := 'http://sybil.yak.net:30306/get?auth=MatterConverter:primhog'. urlPrefix := 'http://127.0.0.1:30306/sync?0=0'. after := '0'. quit := false. ! ! !MatterCompiler methodsFor: 'accessing' stamp: 'strick 7/12/2007 23:49'! harness: aGridHarness harness := aGridHarness! ! !MatterCompiler methodsFor: 'accessing' stamp: 'strick 7/10/2007 15:45'! hectare ^ hectare ! ! !MatterCompiler methodsFor: 'accessing' stamp: 'strick 7/10/2007 15:44'! hectare: h hectare := h ! ! !MatterCompiler methodsFor: 'accessing' stamp: 'strick 7/2/2007 21:08'! quit quit := true.! ! !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! ! "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! MatterCompiler class instanceVariableNames: ''! Object subclass: #MatterCompilerCommand instanceVariableNames: 'mc words' classVariableNames: '' poolDictionaries: '' category: 'Grid-Holodeck'! !MatterCompilerCommand methodsFor: 'as yet unclassified' stamp: 'strick 7/12/2007 23:47'! mc: aMatterCompiler words: anArray mc := aMatterCompiler. words := anArray. ! ! !MatterCompilerCommand methodsFor: 'as yet unclassified' stamp: 'strick 7/12/2007 23:48'! perform mc doCommand: words ! ! Object subclass: #MatterCompilerStarter instanceVariableNames: 'parcels activeParcels harness' classVariableNames: '' poolDictionaries: '' category: 'Grid-Holodeck'! !MatterCompilerStarter methodsFor: 'accessing' stamp: 'strick 7/11/2007 17:58'! activeParcels "Answer the value of activeParcels" ^ activeParcels! ! !MatterCompilerStarter methodsFor: 'accessing' stamp: 'strick 7/11/2007 17:58'! activeParcels: anObject "Set the value of activeParcels" activeParcels := anObject! ! !MatterCompilerStarter methodsFor: 'accessing' stamp: 'strick 7/12/2007 23:50'! harness: aGridHarness harness := aGridHarness ! ! !MatterCompilerStarter methodsFor: 'accessing' stamp: 'strick 7/11/2007 17:59'! initialize activeParcels := Set new! ! !MatterCompilerStarter methodsFor: 'accessing' stamp: 'strick 7/11/2007 17:58'! parcels "Answer the value of parcels" ^ parcels! ! !MatterCompilerStarter methodsFor: 'accessing' stamp: 'strick 7/11/2007 17:58'! parcels: anObject "Set the value of parcels" parcels := anObject! ! !MatterCompilerStarter methodsFor: 'accessing' stamp: 'strick 7/12/2007 23:51'! start: aSpaceRef | mc name | ( (parcels notNil) and: [parcels includes: aSpaceRef] and: [(activeParcels includes: aSpaceRef) not] ) ifTrue: [ activeParcels add: aSpaceRef. mc := MatterCompiler new. mc spaceRef: aSpaceRef. mc harness: harness. name := aSpaceRef syncSend: #objectName withArguments: #(). mc hectare: name. Grid note: 'MC ', mc asString, ' SPACE ', aSpaceRef asString, ' NAME ', name. mc startEventLoop. ] ! ! 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}.! !