[MUD-Dev] Material state transformations

Zach Collins {Siege} zcollins at seidata.com
Wed Jul 2 08:42:06 CEST 2003


On Wed, 2 Jul 2003, Yuri Bazhukov wrote:

> I am very interested, in material transformations from solid to
> liquid, from liquid to gaseous form. I think it will be very good
> to implement it, because it adds some variety to game. I found
> some difficulties in implementing it, and want to ask community
> about ways to implement it.  The main problem is determine
> characteristics of transformed object.

Did you want to have an algorithm solve this for you, or do you want
to avoid entering different sets of characteristics for each state
of a material?  An algorithm would be a hard solution, since it has
to take into account what each material is made of; in the end,
you'd probably end up feeding it charts of data anyway, your own
periodic table at least.

Here's a simple data structure as I might do it:

  class Resource:
    # type data
    material = material type
    freezing_point = temperature
    melting_point = temperature
    sublimation = time for one unit to sublimate (or None/0 if it
                  doesn't), negative measurements mean that
                  condensation is the norm
    solid_data = array
    liquid_data = array
    gas_data = array
    # universal per-object data
    temperature = current temperature
    # per-object data for variable-sized objects
    amount = measurement
    tot_solid = percentage
    tot_gas = percentage (remainder percentage is assumed to be
              liquid)
    # per-object data for fixed-size objects
    currently = current state

Any utility functions can then be attached, for example
change_state(), which might check the environment's temperature and
how long since state was last checked, then adjust the object's
temperature and state to reflect its environment.

--
Zach Collins
_______________________________________________
MUD-Dev mailing list
MUD-Dev at kanga.nu
https://www.kanga.nu/lists/listinfo/mud-dev



More information about the mud-dev-archive mailing list