Help with morph and world refresh

Andreas Raab andreas.raab at gmx.de
Sat Apr 5 19:43:59 UTC 2003


> This is what I'm trying to do now because I always fall in 
> the trap that I end up with concurrent objects executed in
> various implicit thread. I got the same problem with the
> animation for the turtle. The problem is that I want plain
> normal code to be able to be executed and not just a 
> subset of well identified methods.

Which is precisely the reason why I choose the scripting semantics in Tweak
the way I did ;-) You might want to have a look at the attached objects -
small examples for what you describe. In both cases, the "control method"
looks like this:

makeSquare [
	<on: #mouseDown>
	self go; go; go.
	self turnLeft.
	self go; go; go.
	self turnLeft.
	self go; go; go.
	self turnLeft.
	self go; go; go.
	self turnLeft.
].

> > The best way to
> > handle this is by assocating time with the object directly 
> > so it can evolve over time
> 
> Do you mean something similar to stepTime telling to a scheduler the 
> frequency to be executed?

Not exactly a "frequency" but rather a duration a certain operation takes. I
have attached you a "continuous" version of the same bot to illustrate the
difference (look at the forward and turn methods). Where in the discrete
case we merely wait "inbetween the action" for some time (e.g., "nothing
happens over time") we continuously evolve the object in the latter (e.g.,
"everything happens over time") - the operations (move, turn) itself take
time, the object doesn't just jump from one place to the other. Note that
this means we can effectively display the world at any time we want - as the
object itself defines what its state "at the time of display" is. That's
what TeaTime does. 

BTW, please don't confuse my little example here with real TeaTime - it
merely illustrates the effect. The mechanics of TeaTime are vastly different
from my example (as the example here is really implemented in terms of
"nothing happens over time") but it shows the same effect.

> I know. I got exactly the same problem with my turtle morph (multiple 
> turtle running in parallel with user interaction and world update)but 
> the solution was rather complex. I would like to avoid to fall into 
> that complex solution again
> So what would be solution? in the turtle I do not remember the number 
> of approaches I tried like having one thread per object, object 
> yielding .....

Well, why?! Use Tweak/Croquet of course! ;-)))

Cheers,
  - Andreas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ContinuousBot.sqp
Type: application/octet-stream
Size: 1989 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20030405/530ce3a2/ContinuousBot.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DiscreteBot.sqp
Type: application/octet-stream
Size: 2027 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20030405/530ce3a2/DiscreteBot.obj


More information about the Squeak-dev mailing list