View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

Questions on Sp2002 P6 Milestone

Questions on P6?

I've read the posts about doInOrder: from Wonderland, and that's fixed my animations so far. But I had a question about how to get it to work with Speech as well. Here goes:

    runTour              -   runs a selected tour
travelTo: aBuilding - travels from the current building to
travelPath: aPath - travels a path

travelTo: and travelPath: both return an OrderedCollection of animations. When I'm hopping between buildings, this works fine. But when I try and do a runTour, I get into some issues. Basically, a tour is an OrderedCollection of MapTourStops (speech associated with a building to stop at). So I call Dijkstra's search on successive MapTourStops in the collection and pass this returned path into travelPath, which then returns a list of animations for that segment of the trip.

This works well. But now my question is "how can I stop the processor until the doInOrder: has completed? :-) I remember something from lecture about this (about a week ago) when covering the sound stuff, but I am kinda hazy about it. Thanks! Chris Verges

TeamFudge is having the same problem. Help. Please. Now. NOW. Peter Zalewski

Suggestion: Read the book. Second suggestion: See Delay. Mark Guzdial

I took a look at Delay...not quite what I wanted, but it might help me with the sound part of it. What I'm doing to fix the animation is just spinning (looping) until the camera's position vector is located at the final place I want to go to. It's a slight hack, but it works. :-) (I hope...can't render on the laptop.) I'm going back through the lecture slides about Speaker/Sound. Chris Verges

So I'm probably just missing it, but under category Speaker-TTS, the Speaker object's say: method takes in text that it renders into a sound and plays. But SoundPlayer's waitUntilDonePlaying: method takes in a Sound. CONFUSION say: doesn't return a Sound, so how...? Chris Verges
Chris, see my note at the bottom of this page. Mark Guzdial

Wonderland is slow, so we decided to try to optimize it just a little.
In WonderlandActor, add this line of code to the top of the renderOn: method:
hidden ifTrue: [^self].

This will make it not try to render objects that are supposed to be hidden. What we're wondering is WHY this code wasn't already in there. Are there side effects that we don't know about? Is there some purpose to rendering a hidden object?
Regardless, this will make it possible to load ALL the images into Wonderland and still be able to move around if most of them are hidden.


I have no clue how you found this, but this is quite possibly the coolest thing. I was actually able to render the map for the first time! :-) Still, much more code to finish. Thank you for this piece of advice, though. Chris Verges

I asked Jeff Pierce's reaction to this and there's his reply. Mark Guzdial

If you're fine with the whole no-children-rendering thing, and you want a far-clip sphere in there also, try adding this line under that other suggested one:
((self distanceTo: (myWonderland getDefaultCamera getPosition)) > INSERT_DISTANCE_HERE) ifTrue: [^self].

gotta insert your own distance there, I used 50 which fairly decently matches the scale I'm using. This will introduce "popping" but for me that's an acceptable sacrifice to get the framerate up above 1 fps. Note that this might screw up on roads that are really long, as their "position" might be further away than you'd like for other objects. You can try splitting up the roads into separate pieces to alleviate this.
Andy Campbell

Is there text-to-speech synthesis in Squeak? I've seen references to outside projects floating around the web, but it seems that if Squeak has Wonderland, it would have TTS.

see the class "Speaker" - it also happens to be under the class category "Speech - TTS". There are cool examples of this being used with "gestural voice". Check out the section in the textbook "multimedia nuts and bolts". Webb
We'll be going through the case study Playwriting Workbench (which is in the book) in which text-to-speech is used. Mark Guzdial

I downloaded the free .mdl files refered to in the documentation on the web site. When I load an .mdl (ex. bunny.mdl), I cannot see my new Actor. I can use the editor and point the camera at it, and the camera does more, but it is invisible. I tried the GL and the Direct 3D Squeak, both had the same problem. If anyone knows what might cause this, please let me know.
Did you try the fix I uploaded on the Fall 2002 Announcements page? Mark Guzdial

Is there a way to define a shape in Wonderland given a list of points or something of the like?

Randy Rockinson
Not that I know of. Mark Guzdial

For the Tour API - must it be run from the Workspace, or can it be done from the GUI, with lists and such.

Lists would be much more user friendly and would eliminate possible spelling mistakes.

Brian Byrne
Yes, it would be more user-friendly. But let's make the developer's life a little easier on this one. Mark Guzdial

Is it possible to get a WonderlandCameraMorph into a SystemWindow?
I have tried
w getDefaultCamera getMorph "returns a WonderlandCameraMorph"

But SystemWindow wont accept that in addMorph:
I try:
foo := SystemWindow new.
w := Wonderland new.
foo addMorph: (w getDefaultCamera getMorph)

and i keep getting a "argument expected ->" error in the workspace.

Any help?
Brian Byrne

Works fine for me. "argument expected ->" occuring generally means that you're sending a message such as #addMorph: that requires 1 argument and not giving it any. Shaggz
Want to tell what version of the image you are using? Or where in that code above i am missing the argument? (its clearly right there.)

3.3alpha, changeset 4816. You're not missing anything in that code. perhaps what you have here isn't exactly what you are executing? Or maybe something horrible has happened to your old image. Have you been fiddling around with the compiler, just for fun? Kidding! Shaggz Be aware that wonderland is somewhat broken under modules, but this will work up until the module changeset (4665 i believe), without modifications.

Brian Byrne
(Update - my laptop (my development system ;) and my home system have a different image file, home being a more recent version(the home system works, the laptop doesnt). is there a way that we can request to the TA that grades our project to run a certain image, that we know works with our code?)
You can try, but the defined correct image is the one in the Readme First page. Mark Guzdial
The problem with that is that the alphas, A) dont work, B) dont exist (anymore)....
Besides, i thought we were supposed to be using the gamma when it came out (so long ago)

ah...progress. seems current enough Shaggz
You can also do a demo for your TA - the code you turned in on your image. Sami Deen

On a different topic, here's a good reason to avoid deleting your changes file:

makeActorFrom: t1
| t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13 t14 t15 t16 t17 |

hmmm.... Shaggz

Anyone else having huge memory leak issues with Wonderland? It crashes the VM for both myself and atleast one of my partners, and it crashes hard. As soon as you try to load any new models into the wonderland environment, it starts taking up memory like a rocket (literally runs up to the 512 ceiling in my computer in about 2 minutes) and then the VM crashes. I've patched squeak and added the .st file that we were told to add. Any ideas?

Matt Greenberg
Is it a memory LEAK (i.e., you do something, undo it, and you have less memory than you started) or just using up lots of memory? Mark Guzdial

Yeah, I've been having trouble with that. Even when I quit the Wonderland editor, there's still an instance of it floating around somewhere. However, there's no variable that's referencing it. I haven't figured out how to delete/kill them yet (they aren't in my trash). Anyone know how to do that? Nathan Owens

It might be workspace variables, i.e. you type "x := blahdblah" in a workspace without declaring "x" as a temporary variable. To get rid of these, you can either reassign something to each such "x" (nil is a common choice), or you can close the workspace. -Lex Spoon
Open an inspector on the object you can't get rid of, then use the yellow-button menu to bring up an inspector of all the objects POINTING to the original object. Then you can figure out where the connection is. Mark Guzdial (p.s., this one was discussed in class, too.)

When I start Wonderland, all the starting objects (ground, bulb) are black. I can load in more models, but those are all black as well. Any idea to fix this? I did do the fix on the annoucements page.

Eric Yang
did you possibly use the "load code updates" when it said "this code update is going to turn 3d black. if you absolutely need 3d, dont do this, otherwise well be releasing a new vm shortly to fix this"?
Brian Byrne

I had a similar problem when using the 3.0 VM. I then used the 3.1beta GL or D3D VM from the 'Read Me First Page' and it worked fine. James Burghardt
Is hardware rendering on? If hardware rendering is on, but your hardware isn't doing the rendering (due to wrong VM, bad H/W, whatever), everything will show up black. Mark Guzdial

What is the official image that the TA's will be grading this project on since there seems to be Wonderland issues between different versions?
Stephanie Smiegowski

I suppose it's still changeset 4599. However, I'm not opposed to using a newer one. With Wonderland, I strongly recommend using the newer vm's that support open-gl/d3d. So much faster! Shaggz

is there anyway to make sure that the camera finishes one movement before it does something else? for example, right now our tour just "jumps" right to the last stop. it travels to all the stops, but very very quickly.

any help is greatly appreciated.

raegan :)
camera understands #move:distance:speed: - maybe you are doing your movement another way. Perhaps the Alarm class can help you? oh! after playing with it I see what you mean I think. Scheduling these movements with Alarm is one solution.Webb

.You can also set a duration for any movement. Mark Guzdial.

I have a function called "drawRoad: aRoad withName: aString" that creates a plane and shows it in the Wonderland based on aRoad's position, etc. The problem that I'm having is that when I do "roadActor turn: #up", the roadActor won't turn but it works when I do it in the workspace.


Joe, do you get an error? What is the error? Mark Guzdial

Why can I add the Bunny.mdl but the Cube.mdl and Box.vfb just hang? They will just sit there and not add nor give any errors. Planes seem to work fine but I had wanted to get cubes working and I do have the updated MakeActorFrom code.
Stephanie Smiegowski

Well, I've heard from several people that the patch only fixes textured objects. Untextured objects (such as cubes and boxes) still don't load properly. Mitch Halpin

I'm having similar problems. No simple shapes/actors will load (squares, cubes, etc.). Is there any way to fix this or do we have to work around it? Trevor Paddock
Folks, this has been discussed in class several times now–perhaps we've been missing lecture? Mark Guzdial

Is there a way to get a handle to the bounds on the Wonderland itself? The script editor in the wonderland instance has bounds but I can find a way to set the bounds of the wonderland scene morph.

w _ Wonderland new. ((w getCameraList at: 1) getMorph) extent: (x@y). the default extent is (150@150). Shaggz

My group is having trouble with loading the texture on the plane. The actual image shows up, however it is consistently upside down, and by then flipping the plane....up become down and left become right. Anyone esle getting this problem? Brian Pashel
Did you try flipping the image before setting the texture? Mark Guzdial

The first time I use the "Speaker" class to say the description of a landmark, everything worked fine. However, when I execute the same code again, it gave me a error "The specified device is already in use. Wait until it is free, and then try again." How do I "fee" a device after I'm done using it to make it available again at a later time?

Johnny S. Yen
Knights Who Say 'Squeak'
I've heard of something like this – it's platform-specific. What's your OS? Try a different VM? Mark Guzdial

Ahhhh...! Thanks! That fixed the problem! I was running WinNT at CoC using image gamma-4743. I just tested the exact same code on a Win2000 machine and everything worked perfectly. Do we need to specify to our TA that our program doesn't work on a WinNT machine?

Johnny S. Yen
Knights Who Say 'Squeak'

When we are controlling the camera, we seem to be giving points to the camera too fast. how do we get it so the camera to either queue up our requests or wait until finishing one before processing the next?
Brian Byrne

You might be able to use doInOrder. It's at the bottom of the Quick Reference. Hank Wilde

.Like Hank said. Mark Guzdial.

The solution to this problem as suggested in class still isnt working for me. I am using a while loop, but the while loop is blocking the camera so the animation array is never equal to zero. How do I overcome this?

Randy Rockinson
See the PlayWriting Workbench chapter for how to allow Wonderland to go on within a loop. Mark Guzdial

Is there an elegant way to control WonderlandCameraControls? That class extends ImageMorph, but overrides extent: such that the component resizes again, but it forgets to change the size of its image. This means that the mouse active field is different from the image, which is confusing. Now, if it isn't added as a submorph of our main morph, this isn't a problem, but then the user is responsible for knowing how to activate a controller on a camera. I can't make my own controller because there's no setControl on WonderlandCameraMorph, no setMorph on WonderlandCamera, and no setDefaultCamera on Wonderland. So if I did a local fix to the problem, anyone else that asked for the controls would get the old stuff again. Suggestions?
Michael L. Mitchell
Bigger question: Why are you trying to control the WonderlandCameraControls? If you want to provide navigation support, do your own widget and send messages to the WonderlandCamera. Mark Guzdial

I'm having trouble trying to display text in Wonderland. I've tried DisplayText's forms on a plane, but that just displays a black plane. Is there some class in Wonderland that makes displays text? Or, am I overlooking something? Suggestions?
Nicholas Gibbs
Are the depths the same? Converting all to black makes me wonder about that. Mark Guzdial

i know this was asked in class today, but i seem to have done a poor job at writing it down.. so.. how do you get the camera to only do one thing at a time? that is.. if moving through a series of points, move to one, wait til done moving, then start moving to the next one, instead of doing it all at once. someone said there is a collection or something you can check the size of? i can't remember exactly.
nevermind, the doInOrder seems to be working now.. strange
ellie, how did you get the do in order to work?

well i just have something like:
wonderland doInOrder{ 
   camera pointAt: 2@2@2. 
   camera moveTo: 2@2@2. 
   camera pointAt: nextPoint.  
   camera moveTo: nextPoint. 

can't say i know what i changed that made it work from when it was being wierd though...

Ok, Thanks ellie

Once we finish mucking about in the wonderland script editor and get some stuff that we actually want to keep, like in methods that run sometime, where does that stuff go? I'm having hella trouble getting any kind of commands to execute in a regular workspace which is slightly troubling to me, considering we can't tell the TA to go into the script editor, paste a bunch of stuff and hit alt-d for every line...

Are you talking about the commands like "place: inFrontOf object: myObject"? If you are, try sending "place: #inFrontOf object myObject". What type of commands are you trying to execute (might want to give some examples) Nathan Owens

You've tried the examples in the slides and you can't hide the script editor? You're referencing getNamespace (note the lowercase "s")? Mark Guzdial

How do you make an actor -always- face the camera? When using pointAt or alignWith, we are having to do it over and over each time things change within the wonderland "world". Cristi Jones
See the Bunny demo inside of Squeak – it's possible to set up a constraint so that, for each frame, the head is always pointed at the camera – in the same way that the demo makes the head always point at the cursor. Mark Guzdial

If I had an actor named 'plane', I can say: plane doEachFrame: [ plane pointAt: camera duration: rightNow ]. This works, whether you want to do it this way is up to you. Andrew Thigpen

I had a problem with loading the .mdl files into Wonderland. The .st file that was uploaded to the announcement page causes squeak to crash. If I try to do it without filing the code in, I can load the .mdl file into wonderland but I can't see it. If I file the code in, squeak freezes when I try to load a .mdl file. I'm using the 3.2a-5299 image and the squeak-gl.exe vm. The only thing I can think of is maybe the vm might not work well with wonderland, but I can't find a newer vm on the site. Any suggestions?

-Kyle Bumpus

some of the mdl files are broken. I know all the shapes are broken. I've spent 4-5 hours trying to fix a few shapes, but didn't have any luck. In the end, I found it wasn't worth the effort to get the mdl files to work. Nathan Owens

.3.2a-5299 includes a fix beyond what I put on Fall 2002 Announcements. You shouldn't need my code. Have you tried the Direct 3D VM? Are you having problems with ALL the MDL files? I have problems with some of them, but ToySoldier, Shark, PurpleDinosaur, etc. work fine for me. Mark Guzdial.

I have tried both the direct 3d VM and the opengl vm. I am having trouble with all mdl files. The one in particular I want is Box.mdl
Kyle Bumpus|

.Now that's weird. Even the Shark doesn't work? That's an extremely simple .mdl. Have you tried another machine? It's possible that your hardware 3-D accelerator is fried. (Unless code directly references, it sits there idle most of the time.) What's your memory like? I've had Squeak seem like it's frozen when it's trying to page in enough memory. Mark Guzdial.

When we are supposed to be able to go to any given building from another... Do we need to move along the streets to get there, just 'walk' over there in a straight line, or just jump to that building?
Stephanie Smiegowski
You should "walk" down the road, you decide the path. Definitely not fly there. Mark Guzdial

when starting a tour, do we need to find a way to 'walk' from our current position there over the roads, or can we just go directly there or what are the requirements on that?
Joe Waldschmidt
To start a tour, yes, it's acceptable to just go there ("teleport"). Mark Guzdial

I know this was asked in class, but I thought I had solved the problem...I had not.... So, could you repeat what you said about making the Speaker not talk over itself when calling it more than once. Right now I'm travelling an OrderedCollection of 'stops' which have buildings to visit and text to read at each building. Only, before it finishes reading the text for one building, it starts to read the text for the next. Thanks
Kathryn Leland
Read the chapter on the Play-Writing Workbench and look for the discussion on Active Sounds. Mark Guzdial

I'm having trouble showing text in Wonderland. Right now I'm creating a TextMorph and using that as texture on a WonderlandActor. However, the WonderlandActor shows up black. Why is that? Is there another way to show text in Wonderland?

Nevermind, it was because the background was translucent.

Eric Yang

We can get doInOrder to work on specific wonderland commands that we code in.....
a _ bunny move: forward.
b _ bunny turn: right.
w doInOrder: {a.b.}.
..... but we are having trouble getting it to work on an ordered collection....
"(same a and b from above)"
oc _ Ordered Collection new.
oc add: a.
oc add: b.
w doInOrder: { oc do: [:aWonderlandCommand|aWonderlandCommand] }.
.... the theory behind it being that you do the collection of wonderland commands in order.

Any ideas how you would do this? Because doInOrder: doesn't allow non-wonderland code inside of it, and it's kinda hard to loop through a collection of tour stops if wonderland won't let you.
Sarkis Einarsson
Sarkis, why are you putting the argument to doInOrder: in the last case inside of curly braces? You're building an array with "oc do:..." as elements of it. Look at the syntax of what you're doing. Mark Guzdial

I know you said that classVariables are bad but can we have one to cache images easily so the load up time can be reduced?
Marc Calahan

Why could you NOT have one? If you think it would help to speed things up, go for it. Just make sure it gets populated when the TA runs it on a fresh image for the first time. Otherwise you get so many errors...(been there, done that). Chris Verges

Using the Speaker command with appropriate messages produces sound fine if you run it by itself. However, if you try to do something like this...
a _ camera move: left.
b _ bunny move: right.
c _ Speaker child say: 'blah'. "whatever the syntax is - can't remember off top of my head"
world doInOrder: { a. b. c. }.

...Then you will get an error because doInOrder only works over animations. The problem is on your tour, you want to execute a, b, and c for every stop. It's easy enough to make a collection of the a's and b's which are all the wonderland commands; however, how do you get the sounds in there?

If you try...
doInOrder: { a1. b1. }.
Speaker child say: 'blah'. "again ignore syntax if this is wrong"
doInOrder: { a2. b2. }.
Speaker child say: 'blah'.

...Then wonderland is gonna execute the two doInOrder's at the same time and not produce the proper animations.

And if you try...
doInOrder: { a1. b1. a2. b2. }.

...Then you are gonna get the animations in the right order, but won't be playing your sounds between the sets of animations.

Any ideas?
Michael Winburn
.Yup, that's one of the main issues in P6! Synchronizing media is hard. Some options: Build an animation subclass that serves as a dummy operation for the Speaker. Use the techniques described in the PlayWriting Workbench chapter for unblocking other processes and the World so that they can process. Use an explicit loop that awaits the end of an animation, then start the sound and wait for the end of that, etc. Mark Guzdial.

Hey would it be ok to only include about 30 buildings in this code? Why I ask, well from p5 you know we have the data and working of all 190 of them, but for speed reasons the machine would not be bogged down quite as much if only include 30. We have a GUI interface, so it would be easy to find which buildings we include?
Also when you said "We will execute GTCampusMap demo1. Your demo must include at least two tours covering at least three buildings each. Your API must be easy enough to use and documented well enough that we can define another tour in testing." Why? Demo1 is not a tour according to this, so why not just have GTCampusMap execute the map, and have the default tours already loaded in?

I can't say for certain since I'm not a TA, but if they call "GTCampusMap demo1" why not just load GTCampusMap like normal, but add into your tourList (or whatever you're using) two default tours that they can run from? That seems like the simplest solution that falls within what they asked us to do.
I'm not sure if it would be kosher to just include 30 buildings. I am for testing purposes, but on the production release, I'm going to include all of them. You're right – it takes waaay too long to render initially. Dunno how to help you on that question. Chris Verges

When we type GTCampusMap demo1, we expect for you to offer us the choice of at least two tours. That's the idea. It should be easy to specify these tours. You can have only 30 buildings, but you'll lose of the 10 point associated with "Can see all buildings."
Is anyone trying to HIDE the buildings that aren't the current region of the map? Wouldn't that speed rendering? Mark Guzdial
The answer is yes dramatically. we only show things that are within 15 units of the user Marc Calahan

Let me go into a little more detail.

I'm getting more and more questions on this, so let me offer a bit more detail on my answer above.

Generally the problem is: How do I synchronize two (or more) different media types? SOMEBODY (i.e., Some Object) has to handle the synchronization. Options:

Hope this helps!
Mark Guzdial

Link to this Page