[Dev-sig] Economic/Transport Simulations

Claude Felizardo cafelizardo at gmail.com
Tue Aug 21 19:40:28 PDT 2007


On 8/21/07, Emerson, Tom (*IC) <Tom.Emerson at wbconsultant.com> wrote:

> As I mentioned previously, I'm approaching this in an "object-oriented"
> way.  I'm headed more towards a "toolkit" for creating eco/transport
> sims than about creating any one specific sim, so ideas are welcome at
> this point.
>
> OK, What I'm about to describe is getting "quite complex" even though
> I'm only describing 3 basic objects:
>
>    1) resources
>    2) containers
>    3) consumers

[snip]

how about a top level class called a widget.  a widget has an id, a
description and a location. you can tell it render itself on the
screen.  some widgets may contain other widgets.  A widget might have
a quantity which can change over time to indicate spoilage or
ripening.

a gizmo is a widget that can consume existing widgets and/or create
new ones after a specified time.  It might simply transform existing
widgets.  a refrigerator gizmo would tell it's contents to spoil at a
slower rate.  gizmo's can be ordered to perform a sequence of actions
such as produce widget A every 50 ticks or after receiving 30 units of
widget B.

a vehicle widget is a container that has the added behavior of being
able to change it's location.  If given a destination it would take
into account the "distance" and "speed" to calculate it's new
location.  A path would be a series of way point widgets.

Or you could do it the other way and have a path widget between two
location widgets.  It's description might include one or more way
point widgets so you could draw a windy road along a bay or though the
mountains.  Vehicle widgets entering a road widget would have it's
destination set to the other endpoint.  At each tick, the road widget
would instruct each vehicle to advance toward it's destination which
is used as an offset so when the road is told to render itself, the
vehicle widgets would be displayed in the correct place.

gizmos can talk to each other using events or rules, etc.  So you
could program a truck to take a road to a factory, pick up a load,
travel another location, unload and go back to factory.  lather.
rinse. repeat.  Or, upon reaching a location, a truck would announce
it's arrival and sleep.  At a factory, the arrival event would trigger
it to load the truck.  At a warehouse, the arrival event would trigger
an unload.  The truck would just respond to load and unload commands
and then follow next road.   You could specify default rules that
could be assigned to gizmos so they can can have their program updated
automatically.

Sounds like a scripting language would make things more flexible.  XML
anybody?  you could specify text description, location, image, speed,
triggers, actions, rules, etc.

claude


More information about the Dev-sig mailing list