(map)features

(map)features

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Post Reply
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

(map)features

Post by knorke »

I want to make some features but I know nothing about them.
I tried just using a unitdef with isfeature=true but then the unit just dies/disappears on being spawned. (i was expecting it to be turned into a feature that uses the 3dmodel of the unit)

So how do they work?
Is there a documentation on all the possible tags? (or list at least)

Can the engines default trees be used for new featues? (like bigger trees?)

Can features have a deathexplosion?
(search says "yes, with featureplacer" <- does that just spawn a CEG on FeatureDestroyed callin?)

Trees fall over when knocked down. Is that possible with all features? (i have not seen it)

Appearently features have a teamID. (http://springrts.com/wiki/Lua_SyncedCtr ... e_Handling)
What is that used for? (like LOS or whatever else)

What does Spring.SetUnitToFeature ( boolean tofeature ) do?
(from name i was thinking it turns a unit into a feature but it does not take a unitID as parameter. seems to do nothing as far i could tell)

When a feature burns, how is defined what effect is used and where is it spawned? Can burntime+damage be controlled?
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: (map)features

Post by jK »

knorke wrote:What does Spring.SetUnitToFeature ( boolean tofeature ) do?
Nothing. Don't use it, it's likely to get removed in 0.83
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: (map)features

Post by knorke »

ok.
i saw it used
http://www.google.com/codesearch/p?hl=e ... y/main.lua here (line 358 & 1034) so thought maybe it does something.
Being able to transform units into features (with pieces remaining at current position) would be pretty nice for wrecks though.
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: (map)features

Post by Kloot »

SetUnitToFeature is just an ugly global switch that can be used to block units turning into features when they finish being built (like *A DT's do, which have the isFeature tag).
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: (map)features

Post by Beherith »

Feature s3o center pos defines burn center, radius defines burn size.
Afaik features have teamID so you can leave teamcolor on wrecks.

Features being knocked over is currently only for engine trees, but we could work together to try and make jK's awesome shader system work with features - then it could be added easily.

Default engine trees cant be changed, as their display lists and lod levels are made on engine load.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: (map)features

Post by smoth »

Steal one of my features use it as a base.

Features are just objects on a map they have no scripts or behavior beyond dead/alive

Not that I know of I cannot offer to help docu because I am super busy right now.

The engine trees are hard coded. I once looked at extending them that all died with the community going aspie about my first patch

Yes they can with lua but anything with explosions in fp is a unit

Only engine trees

Features use teamid for team color on corpses

No idea, never used it

Only engine trees catch fire, if you lua it you can control burntime and damage


Please do a numbered lis in the future it makes phone based replies easier
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: (map)features

Post by Forboding Angel »

smoth wrote:Only engine trees catch fire, if you lua it you can control burntime and damage
Not true, look at the evorts riverdale remake. Those trees catch fire.

Edit: I guess this question belongs here...

Is it even remotely possible to redirect the default "Tree on fire" effect to a ceg?
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: (map)features

Post by CarRepairer »

knorke wrote:I tried just using a unitdef with isfeature=true but then the unit just dies/disappears on being spawned. (i was expecting it to be turned into a feature that uses the 3dmodel of the unit)
No, all it does is make the unit die instantly. Give the unit a corpse with an object field that's the s3o you want (like objectname in the unitdef), you might need some other tags in there for it to work, not sure.
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: (map)features

Post by Beherith »

Code: Select all

struct FeatureDef
{
	CR_DECLARE_STRUCT(FeatureDef);

	FeatureDef()
		: collisionVolume(NULL)
		, id(-1)
		, metal(0), energy(0), maxHealth(0), reclaimTime(0), mass(0),
		upright(false), drawType(0), model(NULL),
		resurrectable(false), smokeTime(0), destructable(false), reclaimable(true), autoreclaim(true), blocking(false),
		burnable(false), floating(false), noSelect(false), geoThermal(false),
		xsize(0), zsize(0) {}

	S3DModel* LoadModel() const;
	CollisionVolume* collisionVolume;

	std::string myName;
	std::string description;
	std::string filename;

	int id;

	float metal;
	float energy;
	float maxHealth;
	float reclaimTime;

	/// used to see if the object can be overrun
	float mass;

	bool upright;
	int drawType;
	S3DModel* model;
	std::string modelname;

	/// -1 := only if it is the 1st wreckage of the unitdef (default), 0 := no it isn't, 1 := yes it is
	int  resurrectable;

	int smokeTime;

	bool destructable;
	bool reclaimable;
	bool autoreclaim;
	bool blocking;
	bool burnable;
	bool floating;
	bool noSelect;

	bool geoThermal;

	/// name of feature that this turn into when killed (not reclaimed)
	std::string deathFeature;

	/// each size is 8 units
	int xsize;
	/// each size is 8 units
	int zsize;

	std::map<std::string, std::string> customParams;
};
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6241
Joined: 29 Apr 2005, 01:14

Re: (map)features

Post by FLOZi »

User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: (map)features

Post by zwzsg »

The teamID of feature is also used to know if they should be seen through fog of war, I think.

Feature are not units with isFeature. Feature use their distinct FeatureDef, stored in /Features/corpses/*.tdf or /Features/All Worlds/*.tdf. Also one feature TDF can contains the definition of more than one feature.

isFeature is for dragon teeth, or any other player-built feature. It makes a unit instantly die and turn into its 'corpse' when construction completed. So, when you are building a core dragon teeth, it is the 'live' unit CORDRAG from /Units/CORDRAG.FBI, and when done it becomes the 'dead' feature DragonsTeeth_core from /Features/All Worlds/DragonsTeeth.tdf.

The FeatureDef are kinda like UnitDef, but not with the same tags.

The UnitDef field 'corpse' can be used to point to a feature that the unit will turn into when killed.
The FeatureDef field 'featuredead' can be used to point to another feature that the feature will turn into when killed.
Also there's a field to make the feature turn into something else when reclaimed, but I forgot is this one is still supported by Spring.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: (map)features

Post by knorke »

thanks, very helpfull answers.
a field to make the feature turn into something else when reclaimed
seems it was featurereclaimate or maybeseqnamereclamate
http://www.google.com/codesearch/p?hl=e ... cd=1&ct=rc

but I did not see those in the source flozi posted so maybe removed/never existed.

I think ill quickly forgett about that "corpses"/"all worlds" folder and only use the corpse= tag, seems better.
The teamID of feature is also used to know if they should be seen through fog of war, I think.
Yes, just noticed there is even an option in modrules.lua that uses it:
featureLOS = {
-- 0 - no default LOS for features
-- 1 - gaia features always visible
-- 2 - allyteam/gaia features always visible
-- 3 - all features always visible
-- default 3
featureVisibility = 1;
},
Last thing that makes me wonder a bit why my feature takes multiple hits to be destroyed even though it has damage=1
(tried maxdamage=1 too, just to be sure)
engine source says:

Code: Select all

fd->maxHealth   = fdTable.GetFloat("damage", 0.0f);
adding the feature to armordefs does not change it.
Features being knocked over is currently only for engine trees, but we could work together to try and make jK's awesome shader system work with features - then it could be added easily.
Not sure if we talked in lobby already but did you see:
http://springrts.com/phpbb/viewtopic.ph ... start=7617
(on its death, feature is replaced with a unit that plays a "fall over" animation)
Don't know how the shader system works so cant comment on that but for now its good enough for me :)

Btw /give featurename works, though featurename is not autocompleted on tab like for units. (thanks forb)
Post Reply

Return to “Game Development”