|
From: Jeffrey W. <je...@ca...> - 2004-01-03 03:38:23
|
I agree with the idea of containers. However, the exact implementation
of this is a bit unclear to me. I've seen some games that use
dimensions, PlanetSide or MechWarrior for example. A soldier is capable
of carrying 2 units x 4 units. A pistol would be 1u x 1u, and a rifle
1u x 2u. A larger vehicle would be capable of carrying 15u x 10u. A
large object that a soldier cannot carry would have dimensions larger
than a soldier's capacity, 3u x 2u for example. This enforces the
restrictions on who can carry what and also enforces the maximum
capacity of a unit.
How this is implemented is up to the programmers, but that's an idea for
the container system.
-mindstorm
-----Original Message-----
From: xen...@li...
[mailto:xen...@li...] On Behalf Of
ma...@pr...
Sent: Thursday, January 01, 2004 10:26 AM
To: red...@pr...;
xen...@li...
Subject: RE: [Xenocide-programming] Carriable Items on Xenocide
Hello Xenocide Programmers,
I liked RK's idea about containers. It might complicate things a bit,
but
what if ICarrier interface will server the only one purpose - the
container
management?
For example, each object which is ICarrier will have number of
containers
able to hold ICarriable objects. ICarrier will provide methods to
enumerate
the containers as well as to access them by number or name.
So soldiers will have many containers (hands, pockets, backpack, mouth
:),
etc.); transports will have one container for all their cargo; armed
crafts
will have containers for their weapons.
And here is the point: each container will have an object
ContainerConstraint. This object will describe the containers and will
be
responsible to provide yes/no for requests to put the item in the
container.
ContainerConstraint will have following variables for example:
- size (width and height, or something more sophisticated if container
is
not rectangular);
- max number of items;
- max weight of items;
- type of items (craft weapons only or any handheld weapons only, etc.)
The container itself will keep values of current content, so there are
no
such varialbles like current number/weight of items in the
ContainerCOnstraint object.
So, in RK's example below hand->addObject() method would call
ContainerConstraint object to verify that Object is acceptable.
Regards,
Mamutas
-----Original Message-----
From: xen...@li...
[mailto:xen...@li...] On Behalf Of
red...@pr...
Sent: Tuesday, December 30, 2003 9:57 PM
To: xen...@li...
Subject: RE: [Xenocide-programming] Carriable Items on Xenocide
Hi mamutas and all,
How about this. We have ICarriable for objects that can be carried, and
ICarrier
for those that can carry. In that way we can make a nice system, suppose
this:
class ICarriable
{};
class ICarrier
{};
class Soldier : public ICarrier
{};
class Aircraft : public ICarrier
{};
ICarrier should be able to present a simple but unified view for
carrying
items.
For instance Aircraft's dont mind the size of the stuff you put on them
as
long
as the weight do pass over an specified ammount. On the other side
Soldiers
do
mind the real proportions and the specific place in where you put them.
That
makes the interface pretty difficult. One solution is to think that
carriers
have containers, and those containers specify the limits on size.
However,
the
carrier itself specify the limit on weight. You can either enumerate the
containers or give them a symbolic name (like "righthand" or "backpack"
) to
be
accesible from a scripting language. So for instance to move the rocket
launcher
from the backpack to the hand you do the following.
ICarrierContainer* backpack = this->getCarrierContainer ("backpack");
// Get the object via its code or whatever.
ICarriable* object = backpack->takeoutObject ( ... );
ICarrierContainer* hand = this->getCarrierContainer ("righthand");
if (hand->isEmpty ())
{
// The ... is the parameters to specify how to add them, I must say
// that I dont have a clue how to specify those parameters to unify
both
// types of carrier objects.
hand->addObject (object, ... );
}
else // we dont do anything, or rollback the action :D ;
Other solution is to have different type of interfaces and that those
use
the
same type of ICarriable objects (as we have now), one is IStore (where
position
in the store is not relevant, only total size or weight and the other is
ICarrier (used to be called Wearable) where not only size and weight are
relevant but position too.
Any though will be welcomed, cause I am stuck on this.
Greetings
Red Knight
Quoting Mamutas Plaukotas <ma...@pr...>:
> Here is what I think:
>
> We need two interfaces (sorry, but I cannot come up with good names :(
)
> 1) IsCarryable (the item which can be carried). That is an 'Ability'
> interface which defines that the object can be carried, for example
weapons
> or corpses. Some objects cannot be carried, like phones, dishes, food
items,
> etc., although they are small enough, but there is no need to carry
them.
> 2) AbleToCarry (an object which can carry objects implemented
IsCarryable
> interfaces). Those could be aircrafts, units, general store
facilities,
etc.
> That interface will be 'Behaviour' in my opinion.
>
> Regards,
> mamutas
-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for
IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys
admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
_______________________________________________
Xenocide-programming mailing list
Xen...@li...
https://lists.sourceforge.net/lists/listinfo/xenocide-programming
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.556 / Virus Database: 348 - Release Date: 12/26/2003
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.556 / Virus Database: 348 - Release Date: 12/26/2003
-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for
IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys
admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
_______________________________________________
Xenocide-programming mailing list
Xen...@li...
https://lists.sourceforge.net/lists/listinfo/xenocide-programming
|