Game Development Community

engine crashes with out of bounds array access error

by Jeff Howard · in Torque Game Engine Advanced · 07/18/2009 (11:26 am) · 9 replies

My engine has just started crashing during Phase 2 Mission Loading. (I'm running TGEA 1.7.1 with AFX on Windows XP.) The log gives me this error message:
"Fatal: (c:\torque\afx112_core_tgea171_sdk\engine\source\core\tvector.h @ 544) Vector<T>::operator[] - out of bounds array access!"

Here is the function which contains line 544 of tvector.h, which the error message refers to:
template<class T> inline const T& Vector<T>::operator[](U32 index) const
{
AssertFatal(index < mElementCount, "Vector<T>::operator[] - out of bounds array access!");
return mArray[index];
}

I'm not sure what is causing this message. I just recently implemented the AiGuard resource, which was working fine in spawning AiBots. I re-loaded my mission a few times the next day (again without crashes or in-game errors) and suddenly the engine crashes every time after the "loading objects" progress bar finishes.

Based on a forum search, it looks like possible issues with the tvector.h code have come up occasionally, but the C++ code that people are describing is far above my head (and beyond anything that I was trying to modify, at least not on purpose).

http://www.garagegames.com/community/forums/viewthread/23430
http://www.garagegames.com/community/forums/viewthread/60834

I'd really appreciate any help in resolving this error, since I'd hate to have to regress to an earlier build and lose my most recent work.

#1
07/18/2009 (11:47 am)
Nevermind. I rebooted my machine, and after the system reboot Torque loads without problems. Problem solved. :)
#2
08/27/2009 (5:56 am)
I get this error too. It happens very often by the way. On TGEA 1.7.1
#3
08/27/2009 (6:05 am)
It's happened to me recently, in Torque 3D -- and I don't know why... anyone have some insight to share about this? In my case I was doing some tricky things with projectiles.
#4
08/27/2009 (9:28 am)
in my case it happens only if I have some objects created as StaticShapeData. Changing them to ItemData solves the problem and the engine stop crashing. But I need them as StaticShapes because I need to collide in them via their Collision Meshes. Items don't have that feature.
I am doing this is TGEA 1.7.1
#5
08/27/2009 (4:50 pm)
I found the problem with my object. In fact the problem wasn't that it was StaticShape. The problem was in the model setup before to be exported from 3ds max. Not it works fine as both StaticShape and Item.

The problem with the model setup was in my hierarchy. I had setup my model via skin (Bones , detail2 linked to the root Bone Node and my mesh2 just skinned) and in the same file I had setup my Col-1 (Collision mesh) in the "old" known method via base01, start01, Collision-1...

After I deleted all the Collision hierarchy (base01, start01, Col-1 and Collision-1) it stopped giving me that error.

There is an interesting thing that happened. If I pass the object through unMessDTS.exe I get the error again. Very strange... Anyway unMessDTS.exe is used to fix the problems in a DTS :)
May be this happens because I use EditableMeshes for bones in my scene instead of bones objects. I don't know.
#6
09/18/2009 (3:35 pm)
any more news on this issue?
Ive just finished porting the "enhanced weapons" resource to T3D, and I get this same error (Vector<T>::operator[] - out of bounds array access!)
in this "template<class T> inline T& Vector<T>::operator[](U32 index)"
but only when shooting certain things.
#7
09/18/2009 (5:06 pm)
Does the 'enhanced weapons' resource do anything with particles? This error is basically when a container (vectors, lists, simsets, etc) aren't managing their contents properly. It could potentially be something like the particles not being deleted after use and overflowing, thats just a guess though.
#8
09/18/2009 (5:27 pm)
mmm, yes, it does use particles,
I'll do a trace and see if its the particles....

EDIT: no, its not the particles, its the projectiles....
#9
10/28/2009 (11:48 pm)
anyone figure this out? I have this problem after using the serverside melee resource in T3D. It only happens when I load certain player models, including the "villager" model from Dexsoft. However the original meleeorc, plus all the stock T3D models load fine. I'm debugging now and it seems to occur during the preload, but that's as far as I've gotten tonight. Compiling a new debug exe and tackling it again tomorrow.

Any ideas?