[crossfire] Transports

Mark Wedel mwedel at sonic.net
Tue Jan 31 02:18:03 CST 2006


  Below is my propose implementation for tranports (boats, horses, wagons, etc). 
  Look it over and let me know any questions/improvements, etc.



Tranports are objects that help the player move.  These should not be confused
with EXITS, which instaneously transport a player from one map to another.

Instead, tranports may let the player move faster, give them move types they
don't have, etc.  A simple example of this would a horse.  It doesn't let the
player move anyplace he normally couldn't go, but lets him get there faster.
Ships would be another case - the player normally can't move accross water,
but with a ship, he can.

Meaning of various object attributes (KV means the value is stored in the
key/value list, and thus the get_ob_key_value() and set_ob_key_value()
routines need to be used.

move_type       The move type this object has.
move_allow      Normal meanings - useful for things like boats so people
                 can actually get on the boat.
speed           How fast the object moves
weight_limit    How much this object can carry.
weight_speed_ratio (KV)
                 This value is taken as a percentage which is multiplied
                 against against the weight this object is carrying (the
                 player) - this is then divided by weight_limit to determine
                 the effective loading to determine effective object speed, eg:

                 speed = base_speed - (base_speed * pl->weight *
                         weight_speed_ratio) / (weight_limit * 100)

                 Thus, if weight_factor is 0, this object will move the same
                 speed no matter how loaded it is.  If it is 100, then
                 if the transport is fully loaded, it moves at a crawl.
                 In a sense, this somewhat mimics the player movement
                 speed.  Large transports, like boats, should likely be
                 largely unaffected by weight (maybe have this value at
                 10), where something like a horse would have a relatively high
                 value.

base_speed(KV)  This is only needed if weight_speed_ratio is set - it is used
                 to know what the base speed to use in the calculation (since
                 speed is getting clobbered).  If this is not set and
                 weight_speed_ratio is set, the archetypes speed will be used.

passenger_limit(KV)
                 How many players this transport can hold.  Thus, boats can
                 transport a party (this being set to 6) while horses could
                 only transport a single person.  If this is not set, a default
                 of 1 will be used.

face_full
                 It may be desirable to have different faces to denote what
                 the tranport looks like if someone is on it vs not (mounted
                 horse vs just a horse).  This is used to denote what it will
                 look like when loaded.  If the tranport becomes empty, it will
                 fall back to the archetype face.

anim_full       Like face_full above, but for animated objects.

Usage/implementation details:
To activate a transport, the player will stop onto it and 'board' it.  When this
is done, the transports op->contr will point to the player, and a
pl->transport pointer will be set up.  An 'unboard' command will be needed
to leave the transport (thoughts on a better way to deal with this?)
I don't think apply will work because that will be needed to get stuff in/out
of it like a container.

For transports that hold multiple people, the first person to apply the
transport becomes the captain.  It is this person that decides where the
transport goes.

Transports to some extent will appear as containers - thus you could load
stuff onto(into) the transport without having to be able to carry it all -
imagine wagons that carry 10,000.

When aboard a transport, the player will be in the inventory of the transport.
Thus, the players movement/speed doesn't play any role.  In this
implementation, transports don't attack or defend, and thus don't take damage.
If something damages items on the space (say spikes), it will damage the
player(s) and not the transport.  Thus, transports can't be used to avoid
traps and the like.

  Thoughts/questions?



More information about the crossfire mailing list