How do I create a terrain with tiled textures?

Blitz3D Forums/Blitz3D Beginners Area/How do I create a terrain with tiled textures?

Do not yet understand the use there of FindSurface(mesh, brush) in the function "Function Create_Map(tilex,tilez,tile)"

"samples\birdie\Brush Tiles" creates a mesh with one surface per tile graphic, which is better than one surface per tile, but it does so in a convoluted way using FindSurface() and redundant brushes:

First it creates a brush for each grid square - I'm not sure how brushes are stored internally, but the program actually calls CreateBrush() 1024 times. Next, it cycles through the grid squares again, to create triangles. It attempts to find an existing surface which has already been painted with the same brush properties; if it cannot find one it creates a new surface and paints it. Herein lies the trickery: FindSurface() finds a surface painted with the same brush *properties* as the brush you pass it - even though you may have 900 brushes, one for each tile of grass, any one of these will return the surface you created for the first tile which used a similar [congruent?] brush. The resulting mesh will consist of 8 surfaces, one for each brush (i.e. terrain type).

P.S. Your Battlefield Editor looks nice, keep up the good work! :D