THE REMOTE SPACE IS IN YOUR DISK

Many things in the life are ilusions. If you are a newbie in computer science you can be thinking that, if you create a remote portal to a remote space, inside any of your areas (PRIVATE, SOLO or MULTI) you can walk to it and see all the things the owner of this space made on it. This is true, but, you can be thinking also that you are in a remote machine that has this space, something magic!

This is not true!

You need to import to YOUR machine all the models, all the projects that was created in this space. It's like you to be creating a "virtual clone" of this space. And, if this space has a "subPortal" to the space XYZ, you need to import also all the models and projects that are in the remote space XYZ. And so on. And this is not automatic! You need to do this...

Really you will "walk" at spaces that are IN YOUR MACHINE, at your hard-disk.

If you are at a MULTI space having many avatares - not implemented for internet yet (NOV 2004) - "virtual clones" of this avatares need to be downloaded to your machine. What Croquet does is: to syncronize the position of all these "virtual clones" at all the "virtual clones" of the same space in all the machines having then.

All these downloads cost communication time and space at hard disk. So, be careful when creating a space to be linked by a Portal.

You will do an exercice, at this lesson, creating a remote Portal to the space SpR8 - it was habitated only by one "legoic" at that old lesson, but now it has some new objects (models and projects).

We are back to the "make functions" and the function: initializeDefaultSpace and the "script for Workspace".

Imagine that we, creators of the "Basic Tutorial fo Beginners", decide to create an space having all the exercices of the course. Would be interesting for the students to have a Portal to this space - when reading the lessons they can play with the examples. Better than to "install" each project at the end each lesson, like we are doing.

We need to let available for the students a file having the "make function" to create this Portal. This "make function" - that you will use to do the real exercice of this lesson, "copy-and-pasting" it, is:

makePortalToSpR8: sp

| win3D teaWorld tm url  win3D1 teaWorld1 
tm1 url2 win winR  spR8 p  pR url0  
tframe1  url1 url3 door |


"Creating a Portal-In to  SpR8 to be in your SOLO  area/space"  
p := TPortal new.


"Creating a  Portal-Out to be in SpR8"
pR := TPortal new.

"Creating a  3D window to have the   Portal-Out  in the space SpR8"
winR := TWindow new.
winR translationX: 10 y: 0  z:20.
winR contents: pR.

"Importing the remote  SpR8"
url0 := 'http://www.dmu.com/TeaLand/spaces/remoteSpR8.tea'. 
spR8 := self loadURL: url0. 
spR8 addChild: winR. 

"Importing the project writestudents1 to be in SpR8"
url2 := 'http://www.dmu.com/TeaLand/writestudents1.005.pr'. 
self loadURL: url2.  
tm1 := TMorphic new initializeOpaque: true extent: 1050@1050.
teaWorld1 := TMorphMonitor new initializeWithWorld: 'writestudents1' extent: 1050@1050.
teaWorld1 eventsTo: tm1.
win3D1 := TWindow new.
win3D1 translationX: 8 y: 0  z:-20.
"win3D1 rotationAroundY: 135.0."
win3D1 contents: tm1.
win3D1 closeContents.
spR8 addChild: win3D1.

"Importing the model legoicHal to be in SpR8"
url1 := 'http://www.dmu.com/TeaLand/spaces/legoicHal.tea'.
tframe1 := self loadURL: url1. 
tframe1 ifNil:[ 
tframe1 translationX: 10 y: -3 z: -50.
tframe1 rotationAroundY: 180. 
tframe1 boundsDepth: 3.
tframe1 initBounds.
 ].
spR8  addChild: tframe1.

"Importing the project readstudents121 to be in SpR8"
url := 'http://www.dmu.com/TeaLand/readstudents121.007.pr'. 
self loadURL: url.  
tm := TMorphic new initializeOpaque: true extent: 1050@1050.
teaWorld := TMorphMonitor new initializeWithWorld: 'readstudents121' extent: 1050@1050.
teaWorld eventsTo: tm.
win3D := TWindow new.
win3D translationX: 15 y: 0  z:-20.
"win3D rotationAroundY: 135.0."
win3D contents: tm.
win3D closeContents.
spR8 addChild: win3D.
 
"Creating a 3D window to be in your SOLO area/space"	
win := TWindow new.
win translationX: -5 y: 0  z: -8 .
"This window will contain  the Portal-In to SpR8"
win contents: p.

"Importing the image to be the door to SpR8"
url3 := 'http://www.dmu.com/TeaLand/porta1.jpg'. 
self loadURL: url3.  
door:= TTexture new initializeWithFileName:
(FileDirectory pathFrom:
             {FileDirectory default pathName. 'data'.'www.dmu.com'.
              'Tealand'.  'porta1.jpg'}) mipmap: true
				shrinkFit: false.  
win rectFront: door.
win closeContents.

"Linking Portal-In to Portal-Out"
p  linkPortal: pR.

sp addChild: win. "The space sp will be defined at initializeDefaultSpace"

CODE COMMENTS

To install this Portal (AND EVERYTHING THAT EXISTS INSIDE THE REMOTE SPACE) you need to have an initializeDefaultSpace function inside the Solo Class. (If you don't remember what the "Solo Class" is, you need to read all the old lessons again...):

initializeDefaultSpace 

| space  |
"Create a new space"
space := TSpace new.
"Make a light"
self makeLight: space.
"Make a floor"
self makeFloor: space fileName:'lawn.BMP'.
"Create the webobjects for this space here:"
"......." 
"Create Portals here:"
self makePortalToSpR8: space. 
 ^space.

And the "script for Workspace":

sL:= Solo new. 
win2D:=   SystemWindow new.
lf:= LayoutFrame new.
lf leftFraction:0.
lf rightFraction:1.
lf topFraction:0.
lf bottomFraction:1.
win2D setLabel: 'SOLO'.
win2D addMorph: sL fullFrame:lf.
win2D openInWorldExtent: 250@250. 
sL requestInitialSpace.

It's important to say that your initializeDefaultSpace normally, in the real life, will have calls to all the Portals you like to have inside your Solo area, and calls for one or more 3D models, if you like to have some inside your Solo space - a kind of "3D wallpaper".

Running this script, many files, from www.dmu.com (and other addresses if our space has subPortals to other spaces, or imported projects, or models) will be downloaded to your machine. I repeat: YOU DON'T GO TO REMOTE SPACES IN ANY MACHINE. YOU WILL DOWNLOAD "VIRTUAL CLONES" OF THESE SPACES!

Look the hierarchyic tree of files that will be created - they are simetric with the structure on the server:

TIPS:

Look some images of our exercice:

WARNING. If you don't have a powerfull computer and a fast communication line it's possible that you will not have a very responsible application. We are doing our tests at a: Notebook DELL Latitude D600 - Intel Pentium M755 2.0 GHZ - Memory: 512 MB - VideoCard ATI Radeon 9000 32MB DDR 4xAGP - Resolution 1400x1050 - Communication: ADSL 256 kbps (Download: 45 kBps, Upload: 14 kBps) - Windows XP Professional SP1


PREVIOUS LESSON NEXT LESSON
T. CONTENTS HOMEPAGE

DISCLAIMER: This material can be translated for any language, and reproduced total or partially by anybody using any type of media. But, please, don't put your name like author. And let me know if it was useful (americo@dmu.com).The use of any code, 3D model or technique published is free and doesn't need to have any reference about this source.The author is not responsible for any damage that the material can cause to your professional or sexual life.