Game Development Community

Anybody seeing characters suddenly fall through the terrain

by David Dougher · in Torque Game Engine Advanced · 10/01/2006 (12:00 pm) · 18 replies

Now this is our code, our model, and our terrain so it might not be a GG bug at all but I wanted to see if anybody else has experienced a similar issue.

It is a bit unusual. We place a character on a large terrain we created with L3DT. The model is a reduced scale terrain of part of the island of Maui. The character runs around successfully on the terrain with no apparent issues.

We then have the character begin running up the highest peak. The peak height is set to about 8000 m. At about 7,800 m. (Personal guess - I just know I was getting close to the top) the character suddenly falls through the terrain.

Any attempt to place the character on the terrain using F8 (Fly mode) and then F7 (Drop character at camera) and the character falls straight through the terrain every time.

If I "fly" back down to about 1000 meters - give or take - I can then drop the character on the terrain successfully and it behaves totally normally.

The process can be repeated over and over.

About the author

Owner - Pariah Games, Adjunct Professor - Bristol Community College, Mentor - Game Design - Met School Newport, Mentor - Game Design - Met School Providence


#1
10/01/2006 (3:54 pm)
Now I don't know if this is a problem w/ Atlas2 as it was w/ TGE, but if you scaled a character model smaller than .25 it generated odd collsion issues. It's not a bug, it's just the minimum resolution of the collision code in order to reduce computational ticks for the vast majority of TGE users.

This may or may not be your problem, but you did mention scaling. Keep in mind that there may still be a minimum level of scaling that TSE can account for.
#2
10/01/2006 (5:38 pm)
It was a really good thought, but our current model is scaled 1 1 1. I had to double check because at one point we did scale the model down for game purposes but the artists have since created a new generation of players that are modeled to the height we needed. And as I indicated before it works perfectly at lower terrain heights. And cuts off sharply when you reach a certain point. Very odd.

I will run some tests tomorrow with a plain vanilla GG engine and character and our terrain and see if the problem still occurs.
#3
10/02/2006 (8:10 pm)
Let me know if you find any specific issues, or can get it to repro with TSE HEAD. It could be a U16/S16 type mismatch/overflow or any number of other odd issues!
#4
10/04/2006 (5:45 pm)
I'm having it happen with HEAD, updated about ten minutes ago. It happens with both vehicles and players (which I lifted from the TGE starter.fps (the version ported by Jaimi)). Interestingly, the car, when dropped onto terrain, kinda does a little bounce/rollover when it hits the terrain, and then falls through it and lands on the dif underneath.

This problem does NOT occur in the stock terrain_water_demo.

My terrains are both 1024x1024. Both are scaled down significantly (once to 0.2 0.2 1.2, the other to 0.1 0.193789 0.505173). Hmmm, just scaled one of them to 1 1 1 and it still happened. Both are rotated 1 0 0 0 as well.

Any thoughts?
#5
10/04/2006 (5:48 pm)
Probably time to put some logging stuff in the atlas collision code, and see what sort of data it's returning in those situations. I'd highly recommend making a journal of the problem so you can make sure that it's a) deterministic and b) if it is, be able to replay identical run throughs to more accurately identify the issue.
#6
10/04/2006 (5:52 pm)
Uh oh. I think I don't know what you mean by making a journal. I'm not quite sure about the deterministic part, either. I have a feeling I comprehend part b, but not sure how to technically do that (if you mean completely 100% identical).

*blush*
#7
10/04/2006 (5:53 pm)
I should point out that I'm not a programmer, if that's not obvious.
#8
10/04/2006 (6:02 pm)
You'll probably have to find a programmer to help then. We're just going into our community weekend stuff, which means most GG people are gonna be AWOL until wednesday of next week or so... afterwards, if you haven't had any luck, I can look into this in more detail with you.
#9
10/04/2006 (6:11 pm)
Hey no problem, not urgent for me, just corroborating an apparent bug.

I did have a programmer, but he's AWOL, so I'll just have to struggle on for the time being :-)
#10
10/07/2006 (11:22 pm)
Have managed to narrow this down quite a bit. Terrains don't like to be scaled, not one bit. Any scaling by any amount in any direction will make it un-collideable.

Had it happen with a 1 1 1 terrain that was sized 1024 as well. But several terrains I tried that were 128 and 256 were 100% collideable at 111, and 100% non-collideable with any scaling applied whatsoever.
#11
10/09/2006 (7:57 am)
A bit of follow up on my own researches.

The results have been mostly negative but in an interesting way. I used a simple routine to give me the location of the character from the console and set off up the terrain. The character consistently fell through the terrain at a height of about 670. Above that I could not stay on the terrain, below that the character was rock solid.

Ah-ha! I thought. Let's see if we can generalize the problem. So I checked the initial height the terrian was created at 0, 0, 400. Close to 1024, but no cigar...

Hmmm maybe something to do with the ceiling? Checked the mission height ceiling - that's set to 700. Hmmm. Pretty close. Raise it to a thousand and retest. Nope fall through in exactly the same place.

Need to check if the terrain height is really an issue. So I had a second smaller sized terrain created which retained the steepness - bit tougher climb, but so what. Arghhhh! No trouble getting higher than 670. In fact, it got all the way to the top of the terrain - about 780.

So, now I look at what else is happening. Big terrain means lots of triangles. IF the triangles are being generated from the bottom to the top in terms of height then MAYBE at some point there is a problem in generating the triangle and the system stops working. A smaller terrain means fewer triangles and you don't see the issue. But that would also mean that with a very bumpy terrain you would see the problem at a lower height.

Might be chasing a red herring here - could be something completely different, but to those who have seen this problem how rugged is your terrain? Do you ever have a situation where the terrain will support your character?

For the record, the terrain I have the problem with is scaled 1 1 1, so there may be more than one problem - or - there may be more than one way to create it.

Next step will be getting the character near to the height where the problem occurs and single stepping through the code and checking for a sudden switch in values...
#12
10/09/2006 (5:13 pm)
Are you generating the terrain in a debug mode build? There are a TON of extra asserts and validation done that could help identify if something is breaking during export.
#13
10/10/2006 (7:07 am)
I didn't generate the terrain. Another person on our team has that responsibility. But I'll drag them into the conversation, and perhaps get them to regenerate the terrain in debug as you suggest. At the moment building a new system - the old one fried - so it will be a little while until they can get you the info you want. However, they may have some additonal info to add to the conversation even before they rerun the terrain creation...

The terrain was initially created using the latest version of L3DT and some GIS data of Maui. I have the failing terrain file if you want it but it's pretty big - about 15Mb.
#14
10/10/2006 (10:32 am)
There's no easy way for me to validate - it'd be easier for you to recompile TSE and regen. (You did note the original settings you used to create the terrain right?) The only step that matters it the geometry creation step - none of the texture generation or atlas file combination steps will give useful debug output (probably).
#15
10/10/2006 (2:32 pm)
Ben, the terrain that David is talking about was generated using a debug build of TSE downloaded directly from the GG CVS. You have seen the terrain that David is talking about. It is shown in the forum post www.garagegames.com/mg/forums/result.thread.php?qt=50642. The method to generate it is shown in the first post in that thread. There were no asserts although there were some warnings. From memory there were the typical "min/max exceeded, there may be paging issues" during chunk file generation (what does this mean?). I will regen this terrain to document any warnings noted in the log.

I can provide any other details of interest let me know what is of interest.
#16
10/10/2006 (3:43 pm)
Hmm. Wild. Rechecking w/ the latest from CVS might make the problem go away - there were a few minor issues that I fixed relatively recent - if not, then you're gonna have to see what triangles it thinks it is colliding against, if it's returning the right ones, etc.

I'm unfortunately too deep in some major engine work right now to promise time debugging the situation, although I can definitely outline what is needed to track the issue down and resolve it.
#17
10/10/2006 (8:05 pm)
'fraid not for me. I'd be glad to do anything to help, if you can point me in the right direction.
#18
10/11/2006 (7:31 pm)
I reran the terrain generation where the character is falling though the terrain. The log file from the geometry chunk and atlas files is shown below:

path: ~/data/terrains/
calb: nxATCDDoSetInputFile
spec: *.raw
path: *
ifn: game/data/terrains/Maui800.raw
ofn: game/data/terrains/Maui800_geo.chu
size: 1024
sqare size: 10
error metric: 6
tree depth: 3
NX::AtlasCreateDlg: running terrain import
NX::AtlasCreateDlg: game/data/terrains/Maui800.raw
NX::AtlasCreaetDlg: vertical scale = 0.0124359
PlatformMemory: allocating new page, total bytes allocated so far: 56312480 (total bytes in all pages=67108864)
Generating chunked geometry (depth=3, baseMaxError=6.000000)
   o Calculating activation levels...
      - done.
   o Propagating activation levels...
      - done.
   o Writing file header...
      - done.
   o Generating empty TOC...
      - done.
   o Generating meshes...
AtlasActivationHeightfield::generateNodeData - Max exceeded! May have paging issues!
AtlasActivationHeightfield::generateNodeData - Min exceeded! May have paging issues!
AtlasActivationHeightfield::generateNodeData - Max exceeded! May have paging issues!
      - done.
=== Chunk Statistics ===\
\===== Level    Count    Avg. Size
            0          16      12508.437500
            1           4      49483.250000
            2           1      118118.000000
========================================
                chunks:         21
           input verts:    1048576
          output verts:      62696

       avg verts/chunk:       2986
          output bytes:        805
      bytes/input vert:       0.00
     bytes/output vert:       0.01
        real triangles:     516186
keyboard0 input device unacquired.
DirectInput deactivated.
Activating DirectInput...
keyboard0 input device acquired.
DInputDevice::processAsync -- keyboard0 input device's event buffer overflowed!
keyboard0 input device unacquired.
keyboard0 input device acquired.
importOldAtlasCHU - opened 'game/data/terrains/Maui800_geo.chu' for conversion.
AtlasDeferredFile::ensureStreamWritable - switching file into writable mode... This may cause a crash if you have other copies of Torque accessing it!
importOldAtlasCHU - created new Atlas file 'game/data/terrains/Maui800_geo.atlas'
importOldAtlasCHU - Atlas file initialized, converting...
importOldAtlasCHU - Headers read, remapping chunks...
importOldAtlasCHU - Importing geometry chunks...
importOldAtlasCHU -    level 2 chunks...
PlatformMemory: allocating new page, total bytes allocated so far: 56695168 (total bytes in all pages=75497540)
importOldAtlasCHU -    level 1 chunks...
importOldAtlasCHU -    level 0 chunks...
PlatformMemory: allocating new page, total bytes allocated so far: 64795812 (total bytes in all pages=83886216)
AtlasFile::waitForPendingWrites - Waiting for pending output to finish.
AtlasFile::waitForPendingWrites - Done!
importOldAtlasCHU - Done
AtlasFile::waitForPendingWrites - Waiting for pending output to finish.
AtlasFile::waitForPendingWrites - Done!
Exporting client prefs
Exporting server prefs
Exporting client prefs
Exporting server prefs
CDROP: 1538 local
AtlasFile::waitForPendingWrites - Waiting for pending output to finish.
AtlasFile::waitForPendingWrites - Done!
keyboard0 input device unacquired.
Cur. D3DDevice ref count=1
GFXTextureObject Usage Report - 23 extant TOs
---------------------------------------------------------------
 Addr   Dim. GFXTextureProfile  Profiler Path
 839ec3c  ( 256,  256)  GFXFontTextureProfile    MainLoop -> PlatformProcessMain -> ProcessInputEvent
 3607520  ( 512,  512)  GFXDefaultRenderTargetProfile    MainLoop -> TimeManagerProcessMain -> ProcessTimeEvent -> RenderFrame -> CanvasRenderControls -> GameRenderWorld -> SceneGraphRender -> TraverseScene
 35ffbb4  (   4,    4)  GFXDefaultStaticDiffuseProfile    MainLoop -> TimeManagerProcessMain -> ProcessTimeEvent -> ServerNetProcess
 35ffaf0  (   4,    4)  GFXDefaultStaticDiffuseProfile    MainLoop -> TimeManagerProcessMain -> ProcessTimeEvent -> ServerNetProcess
 35ffa2c  (   4,    4)  GFXDefaultStaticDiffuseProfile    MainLoop -> TimeManagerProcessMain -> ProcessTimeEvent -> ServerNetProcess
 35ff968  (   4,    4)  GFXDefaultStaticDiffuseProfile    MainLoop -> TimeManagerProcessMain -> ProcessTimeEvent -> ServerNetProcess
 35ff8a4  (   4,    4)  GFXDefaultStaticDiffuseProfile    MainLoop -> TimeManagerProcessMain -> ProcessTimeEvent -> ServerNetProcess
 35ff7e0  (   4,    4)  GFXDefaultStaticDiffuseProfile    MainLoop -> TimeManagerProcessMain -> ProcessTimeEvent -> ServerNetProcess
 35ff71c  (   4,    4)  GFXDefaultStaticDiffuseProfile    MainLoop -> TimeManagerProcessMain -> ProcessTimeEvent -> ServerNetProcess
 35fede0  ( 256,  256)  GFXDefaultStaticDiffuseProfile    MainLoop -> TimeManagerProcessMain -> ProcessTimeEvent -> ServerNetProcess
 35fecd4  ( 228,  228)  GFXDefaultStaticDiffuseProfile    MainLoop -> TimeManagerProcessMain -> ProcessTimeEvent -> ServerNetProcess
 35febc8  ( 256,  256)  GFXDefaultStaticDiffuseProfile    MainLoop -> TimeManagerProcessMain -> ProcessTimeEvent -> ServerNetProcess
 35feabc  ( 256,  256)  GFXDefaultStaticDiffuseProfile    MainLoop -> TimeManagerProcessMain -> ProcessTimeEvent -> ServerNetProcess
 35fe92c  ( 512,  512)  AtlasClipMapTextureProfile    MainLoop -> TimeManagerProcessMain -> ProcessTimeEvent -> ServerNetProcess
 35fe868  ( 512,  512)  AtlasClipMapTextureProfile    MainLoop -> TimeManagerProcessMain -> ProcessTimeEvent -> ServerNetProcess
 34e15c8  ( 256,  256)  GFXFontTextureProfile    
 34d9eb0  ( 256,  256)  GFXFontTextureProfile    
 1e3f590  ( 256,  256)  GFXFontTextureProfile    
 1dcd768  ( 256,  256)  GFXFontTextureProfile    
 1d75be8  ( 256,  256)  GFXFontTextureProfile    
 1d543f0  ( 256,  256)  GFXDefaultStaticDiffuseProfile    
 1c4b00c  ( 256,  256)  GFXFontTextureProfile    
 1c49f58  ( 256,  256)  GFXFontTextureProfile    
----- dump complete -------------------------------------------
GFXPrimitiveBuffer::dumpExtantPBs - no extant PBs to dump. You are A-OK!