Game Development Community

Collision detection lost when building project

by Dan Roy · in Torque Game Builder · 01/23/2007 (10:46 am) · 5 replies

I've got a game that works great, until I build it from the TGB editor. I'm on windows. When I build, my main avatar show up at a different spot on the screen than he should, and there are suddenly no collisions detected or enforced. Before I build for distribution from the editor, everything works great.

My only thought is that the things my avatar would collide with are objects i placed in the editor that are on the furthest back layer, so they're not visible. could torque be pruning these upon build? I've made sure it doesn't prune any image files, but it could be pruning the object. ?

Thanks for any help, I'm trying to get this out the door asap.

#1
01/23/2007 (8:55 pm)
Update: even world limits no longer function after building a project with the level editor. very frustrating.
#2
01/23/2007 (10:27 pm)
"build project" is not pruning any objects, as far as i can tell. i moved the collision blocks to the front layer and they're definitely there, just no interaction with the player.

also, world limits work if i set them very late (or repeatedly). if i simply set them after everything else is loaded, they don't stick (and they don't stick when set from the editor). it's like everything is getting overrided at some point.

this is so weird. the game works perfectly when i launch it from the editor. :(
#3
01/23/2007 (11:40 pm)
I was able to get the game working by moving a bunch of functionality from the level editor (where i had originally specified it and it worked) to scripting. specifically, I had to move the bolded lines of the following code into script from the editor. could this have anything to do with me resetting the $player.config? still, the behavior should have been the same in the level editor and after "building project." This whole experience makes me wary of doing anything in the level editor. maybe i'll just stick to script.

function player::onAvatarChosen(){
   if($bPlayerGood){   
      $player.config = heroDatablock;
   }else{
      $player.config = villainDatablock;
   }
   $player.playAnimation($player.StandDownAnimation);
   
   MoneyCounter.setValue("$" @ $player.money @ ",000");
   DiamondCounter.setValue(" " @ $player.diamonds);
   XPCounter.setValue("Salesmanship:" @ $player.salesmanship);
   XPBarCounter.setValue("Experience: " @ $player.xp @ "/" @ $player.xpBar);
   
[b]
   $player.setPosition("82 -31");
   $player.setCollisionActive(true, true);
   $player.setCollisionPhysics(false, true);
   $player.setCollisionCallback(true);
   $player.setCollisionPolyCustom(4 ,0.59, 0.95, -0.51, 0.96, -0.67, 0.17, 0.77, 0.17);
[/b]
}
#4
01/24/2007 (2:54 pm)
If your player.config contains values for those attributes then they will most certainly be clobbered. It's not really the level editor that is clobbering your values. It is either the packaging utility or just an architecture you've built that is not stable under certain conditions. Ceratinly using a global to store an important persistent game object is something I personally consider to be very unstable. To do such a thing you've got to be very aware of the lifetimes of attached objects and the intricate interactions between scripted calls when changing levels. If something is working before packaging and not after then I suggest trying a manual package. Search the forums for a post (I think by Matt Langley) about how to do a manual build.
#5
01/24/2007 (3:35 pm)
Thank you! i'll look into that.