Game Development Community

Foliagereplicator idea

by Ron Frazier · in Technical Issues · 05/28/2006 (7:10 pm) · 2 replies

Well Ive run into a problem recently with the foliagereplicator. Im designing with the high end pc user in mind so I want to place grass and other billboard type foliadge and ive succesfully placed close to 1million objects without slow down. (you could probably go really high do to draw distance, but I digress).

Now the problem is that I can place grass anyware in the world but I want to restrict it to a specific terrain texture (so grass grows on grass and not on my rocky mountain face)

Now I beleave I could add an mFieldData string in the foliadge replicator to reference to a user defined terrain texture BUT Im not a programmer so im not shure how to perform this. Im using the multiangled foliage replicator (gives potential for a nicely 3d rendered grass effect).

I think It would go something like this
//arround line 426
addField( "AllowOnTurText", TypeBool, Offset( mFieldData.mAllowOnTurText, fxFoliageReplicator ) );
//arround line 465
if (!( mFieldData.mAllowOnTerrain ||
mfieldData.mAllowOnTurText || mFieldData.mAllowOnInteriors ||
mFieldData.mAllowStatics ||
mFieldData.mAllowOnWater))
{
//arround 679
// Check Illegal Placements, fail if we hit a disallowed type.
if (((CollisionType & TerrainObjectType) && !mFieldData.mAllowOnTerrain) ||
((CollisionType & InteriorObjectType) && !mFieldData.mAllowOnTurText) || ((CollisionType & InteriorObjectType) && !mFieldData.mAllowOnInteriors) ||
((CollisionType & StaticTSObjectType) && !mFieldData.mAllowStatics) ||
((CollisionType & WaterObjectType) && !mFieldData.mAllowOnWater) ) continue;
//arround 1734
stream->writeFlag(mFieldData.mAllowOnTurText); //arround 1811
mFieldData.mAllowOnTurText = stream->readFlag(); // Allow on TerrainTexture. END C code

Now I dont know much about programming but Im pretty shure If you say where It can be placed I should assume It cant be plased on unspecified textures. MY biggest problem Is How does the code know where the turrain texture is if I dont tell it where the texture is on the turrain And How do I include a browse option to select the texture to that coincides with the turrain texture list.

Please can some coder who is smarter than me at this check this out. Im moding the multiangle foliage replicator in the example code resource center.

#1
05/31/2006 (11:13 am)
You have a start, in that you reference a data field called mAllowOnTerText that specifies that the grass may/may not be allowed on certain terrain textures. What the above lacks is any code pertaining to how the foliage replicator can tell if it's placing the billboards on that texture or not. There is a resource out there that modifies player speeds based on the texture they're running on, and that's a good starting point for being able to find out just how to tell if the spot you're on is a certain texture.