Help with morph and world refresh

Stephane Ducasse ducasse at iam.unibe.ch
Sat Apr 5 17:47:17 UTC 2003


>
> If these are done as part of the same World cycle, then you won't see
> the display update until after the last one. You could do something
> like forcing the changes to the screen in between, but there are
> probably better ways to do it.
>
> You could try adding this for testing, at least:
>
> 	Display forceToScreen: myMorph bounds; forceDisplayUpdate
>
> This will force any invalidated regions to be redrawn visibly.
>
>>>> the bot misses to pick some diamonds: really annoying. I guess
>>>> that this is because the method can pick and pick do not contain
>>>> World doOneCycle.
>
> Does it really miss doing something, or just not show that it is doing
> it?

It really misses it. which means that

>
>> Nathanael already did that for the turtle with animation that I
>> have. But this is really complex.
>> I'm amazed to see how difficult it is to simply do a stupid small
>> program
>> in Squeak that requires animation (ok I do not use step).
>
> Animation when combined with a display that caches changes requires
> some kind of synchronization.

I learned it :) but I'm always trapped.
We did different animation for the turtle with nathanael and even him 
was
sometimes in trouble (and he excellent in concurrent programming).


>
>> Still.  I'm not sure that I can really develop your solution but
> thanks for
>> suggesting it. When I read it, I'm really frustrated by my lack of
> concurrent programming skills.
>
> Concurrent programming isn't easy in general. One of the nice things
> about the eToy system (though it certainly has a number of
> limitations) is that it presents concurrent programming in a fashion
> that is easy to get right (no explicit synchronization).
>
> In Morphic, there's a simplifying assumption that everything is
> happening in a single Process.
>
> This is the reason that most of the time step is the best choice, if
> you can use it. The display is forced to the screen at the end of
> every world cycle.

I did a complete small break out based on step and this was really 
working well.

>
>> Would the WorldState>>addDeferredUIMessage: solve my problem?
>
> Not necessarily, as these messages are processed at the beginning of
> the World's update cycle. If there are multiple messages which each
> will move your Morph you won't see the intermediate position.
>
> -- 
> Ned Konz
> http://bike-nomad.com
> GPG key ID: BEEA7EFE
>
>
>
Prof. Dr. Stéphane DUCASSE
http://www.iam.unibe.ch/~ducasse/
  "if you knew today was your last day on earth, what would you do 
different? ...  especially if,
  by doing something different, today might not be your last day on 
earth" Calvin&Hobbes

"The best way to predict the future is to invent it..." Alan Kay.

Open Source Smalltalks: http://www.squeak.org, 
http://www.gnu.org/software/smalltalk/smalltalk.html
Free books for Universities at 
http://www.esug.org/sponsoring/promotionProgram.html
Free Online Book at 
http://www.iam.unibe.ch/~ducasse/WebPages/FreeBooks.html



More information about the Squeak-dev mailing list