Hi all.
As many of you have followed (like me) the findings on how terrain works, how to model them and put them to work, I present here the results of my experiments.
General notes,
Modeling:
The model can be modeled on any program which can output X format. Make them preferably solid geometry, as other engines using ODE require so.
They have to be UV mapped and texture can be any format accepted by fpsc.( jpg,tga,dds).
Formatting for FPSC:
Make them an entity. The minimum parameters on the attached fpe are here:
;Entity Spec
;Header
desc = JDtestTerrain
; test terrain for debugging
; by Julio Debroy
; julio@demosys.com
;AI
aiinit = appear1.fpi
aimain = default.fpi
aidestroy = disappear1.fpi
;orientation
model = testmultimesh3.x
scale = 50
defaultstatic = 1
collisionmode = 0
materialindex = 2; for sound when player walks over
Actually not sure if AI is needed. Probably not. What is certain is that the final game probably need the texture parameter, because when building, the compiler does not placed the texture automatically. I had to put textures by hand on the output folders.
For test mode, as presented here works just fine.
Problems usually found:
a) No sound when walking.(not very important)
b) Player stuck to terrain on some parts.
c) Enemies falling down thru terrain. (extremely important to solve)
Some clues:
Hitman sent me a terrain object where reportedly was sound when walking over, so I analized its geometry. Enemies were passing thru but there was sound. The first terrain he sent did not work on problems aforementioned.
I was testing and found acceptable to put normal segments underneath the terrain in order for it to emit sound, but never tested with enemies. Sound is emmited in that way, because the engine founds collision with the segment underneath. Nothing to do with 3d sound. It's material index sound.
Found:
I arrived to the solid conclusion that it was a collision problem, due to the size or geometry of the terrain object. At first I was mistaken and have the theory that it was the size and quantity of triangles of the model, which, I supposed, did not trigger proper collision. I made a model with four triangles per segment unit(the size of a ground segment tile) and it worked. It had a span of 3 x 3 segment squares.
Not the triangles nor geometry:
Making a model triple the size, (9 x 9) with the same geometry, I was absolutely sure that it would work. It didn't. But if I reduced the size (scale parameter) to 3x3, it worked again.
Bad news:
It meant only one thing: The engine can not properly calculate collision for objects that span more than 3 x 3 segment units.
Additionally, per each segment unit the model must have at least 2 triangles. If it has less or too many, the physics engine gets confused and the player gets stuck.
So, young people, no terrain can have more than that size. If it is larger than that, no sound, enemies falling thru and player stuck.
Unless....
Good news:
I thought all night and finished up with a method that slices a big terrain object into squares no more than the size required. The resulting sliced terrain segments must be output as a single multimesh object. Alignment is a must, because the player can get stuck into the seams. You can use them as "terrain segments" and tile them carefully on the editor.
So, here is attached a terrain for all to beta test. It is a beach front from my already in production "Normandie beach pack", and has a clear mark of its "blocky" origin.
It has almost the vertical size of one layer, so you can use it as a ramp or in series with another layer. Is not so big, but this kind of "segmented multimesh terrain" seem the only -working- way to go at this time. You can experiment with scale parameter,but is not recommendable that it be much more larger than the present size, which I tested and still has some "stuck" spots.
Please test it and post results for all to learn.
Important note to test:
The player and enemies usually must start on a real segment. Many times if enemies are over the terrain at game start, they get stuck.
Video Bonus:
I took a video of this terrain in action. I placed three contiguous instances of the terrain on one layer and three on the upper layer. There are clacky enemies and a bazooka guy. The player (me) was too bad at play, because (plain excuses) the frame rate dropped when doing the screen capture. The video uses Divxx codec to play and has 17MB size. Hope my server endures the downloads.
Well padawans, use the force.
Video here: www.demosys.com/files/JDforcevideo.zip
May the 3d force B with U