swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Heatbug Pixmap, Importation and Redhat question...


From: Benedikt Stefansson
Subject: Re: Heatbug Pixmap, Importation and Redhat question...
Date: Fri, 15 Aug 1997 17:05:43 -0700

address@hidden wrote:

> All,
> How was the Heatbug Pixmap created?

The pixmap is contained in ant.xpm it is an array holding information in
XPM format (X Pixmap).

Although I have no familiarity with this format it seems to include a
header (size of pixmap in pixels and number of colors), definitions of
symbols and then a "pixmap" using these symbols. There doesn't seem to
be any documentation in the Swarmdocs on the XPM format, the XPixmap
class uses some low level X sorcery which I'd rather not know to much
about.

If you look at the code in HeatbugModelSwarm.m.pixmap, it reads this
array and creates an XPixmap object to process it. The pointer to the
XPixmap instance is then passed to each individual heatbug. In
Heatbug.m.pixmap instead of drawing itself on the raster in a particular
color the heatbug now sends the pixmap to the raster.

> I want to create some more
> different ones to give the heatbugs a visible lifecycle (BabyBug,
> matureBug, deadbug) etc.

I want, I want. It's always the same with you kids. You'd have to create
new pixmaps (figure out the format) for each representation of the bugs,
have ModelSwarm wrap each of these files in a seperate XPixmap instance,
and send the bugs info on which pixmap to send to the raster in each
case (e.g. if age<maturity use baby.xpm, if age>maturity use mature.xpm
etc.)

> Is it possible to have heatbug import HeatbugModelSwarm.h so it can
> create a heatbugModelSwarm within Heatbug?  It seems to me that it
> would be some sort of endless loop A imports B, and B imports A,
> repeat.
> If I wanted to do this would this work: Have a
> heatbugProtoModelSwarm which both heatbugModelSwarm and Heatbug
> could import, this way I could avoid any possible "endless loops"?

You can make each individual agent/heatbug into a ModelSwarm. Question
is why you would want to do that in the first place. If you just need a
reference to the model in each bug, define a -setModel: m method and
have the model send each bug a pointer to itself.

If you want to elevate each bug to the status of an independent
sub-Swarm you don't need to _import_ the model or create a
"ProtoModelSwarm". Just create a new class called BugModelSwarm with the
behavior in it that you want (i.e. all the bug does and then whatever
else you need). Then in the top level ModelSwarm you create multiple
instances of a BugModelSwarm instead of Bug. And call it a bug as
before. The only advantage of raising a bug to the level of an
independent Swarm is that you can use the scheduling mechanism in each
bug, and then merge (activateIn) these schedules into the top level
ModelSwarm.

> Has anyone else using Redhat on a PC (with a two button mouse) had
> trouble getting the probe heatbug thingy to work in Heatbugs.  I
> stop a
> simulation, attempt to click on a bug, and the computer just beeps
> at
> me...am I doing this wrong?  I even went in and changed the code to
> select the right and left buttons, but it still wouldn't work...

I've used numerous installations of RedHat (4.0 or greater) on different
PCs to demo Heatbugs and the probe thingy always works. Are you sure
that you are clicking the _right button_ on a bug? They may be hard to
hit with the cursor since a bug is just the size of a pixel, so try a
few times, the beep is the correct behavior when you hit the background
instead of a bug.

Regards,
-Benedikt
--
----------------
Benedikt Stefansson                 address@hidden
Department of Economics, UCLA       Fax. (310) 825-9528
Los Angeles, CA 90095-1477          Tel. (310) 825-1777


                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.
                  ==================================


reply via email to

[Prev in Thread] Current Thread [Next in Thread]