Page 1 of 1

Trees.

Posted: 24 Feb 2007, 20:35
by Argh
I've looked at Spring's sourcecode, and I do not think that Spring's trees are hardcoded, and if they are, making them not hardcoded would be very easy. More once I've done some experiments.

Posted: 25 Feb 2007, 00:00
by smoth
Argh, AF and I told you they are... we have the code for them in the coding forum at FGJL.

Posted: 25 Feb 2007, 01:00
by Argh
I have looked at the code, and I think that you can return fake values to it. If not, it is a very small change to the current map-handling code to allow it to get and return a Feature.

Posted: 25 Feb 2007, 01:24
by smoth
correct, I believe that is the case.

Posted: 25 Feb 2007, 02:05
by AF
all you ahve todo is create a tree feature called "tree*1/2/3/4/5/6/7/8/9/10/11/12/13/14/15/16*", I'm not sure fi the engine then replaces the feature with the procedural version but I'm thinking its probably the other way round.

But indeed they are procedural. Spring create a tall cone cyclinder, applies a bark texture from the bitmaps folder then adds the trunks, how it does this depends on which trees. for tree1-tree8 it starts at the top and moves down at small but random intervals rotating around the trunk adds quads with the branch texture in bitmaps. For tree9-16, it does the same but instead fo drawing a texture it instead creates on from scratch by drawing a brwn line with a black outline down the middle, adds random green shapes around virtual branches shooting off at 45* angles in a dark green colour. tree9-16 is used in supreme battlefield.

Mapconv places these trees randomly, but they're not special trees, features in their own right, mapconv just places the features tree+random number between 1 and 16 on the map according to the algorithm specified. The same is true of geothermals.

Posted: 25 Feb 2007, 04:01
by Argh
It replaces whatever feature is called with procedural trees, not the other way around. I *think* that's a one-line code fix... still looking into this, but I have other things I need to get done tonight.

Posted: 25 Feb 2007, 12:43
by AF
Or you could just tell mapconv to not places trees and then place them yourself using a different featurename....

Posted: 25 Feb 2007, 15:22
by Argh
Yes, that's also an option. However, wouldn't it be cooler if we simply had a very large variety of random, good-looking foliage that was placed on the map every time you started a game?

I think I'm going to need to look at MapConv's source and study what it's doing to set the DRAWING_TYPE=TREE for trees, which is the sticking point.