[?] Timers & Stepping (was: Morphic IV docs MorphicWorlds)

Norton, Chris chrisn at Kronos.com
Sat Mar 18 01:28:16 UTC 2000


Hi Folks.

First of all, I'd like to thank Jim Benson for the great Morphic tutorials
he's been posting.  Very entertaining Jim!  And I've learned some stuff too
(this is always a Good Thing).  Please keep submitting these -- your running
dialog has been sparking ideas my brainpan.  :-)

And now on to the subject of the evening:  Timers

I have found it both useful and problematic that the World (PasteUpMorph)
controls all of the time-related activities of my morphs.  On one hand, it
is very useful for a World to control the stepping events for its subMorphs.
This makes for cool drawing demos (the car & the steering wheel),
ClockMorph, etc.  But on the other hand, on slower machines, I find that
rich Worlds (Worlds with lots of step driven automation) tend to slooooowwww
down as you add more and more morphs to them (try creating a dozen or so
blob morphs on a World -- I dare you!).  This becomes a problem for me,
because I am (trying) to create a Morphic game that has lots of animated
morphs (currently step driven).  The more morphs I add to my World, the
slower the response time of my game pieces!

At first blush, I thought I'd just have to turn the game pieces into drawn
artifacts.  In other words, I would have to stop using Morphs to represent
my game pieces and instead try to manipulate a gameboard bitmap (like the
Game of Life that Dan Ingalls posted a short time ago).  And then I shook my
head.  I WANT them to be Morphs.  Morphs are great!  They know how to draw
themselves and they have all kinds of other useful logic.  There has got to
be a better way to solve this problem...

At this point, I remembered VSE's Timer class.  In VSE, Timer is a subclass
of EventManager.  You can create Timer instances at will and your model can
update your GUI based on timer ticks.  They sound a lot like the stepper
mechanism in PasteUpMorph.

Question:  Does it make sense to implement a generic Timer class so that the
World, and other interested parties, might instantiate their own timers to
trigger events to other objects?  I think this may help me solve my problem
(but I'm not sure; I've never written an animated game before).

Thanks for your thoughts!

---==> Chris





More information about the Squeak-dev mailing list