Game Development Community

Constructor DIF collision detection

by Gerald Fishel · in Torque Game Engine Advanced · 12/03/2008 (10:42 pm) · 11 replies

Hi all,

Okay, so I'm trying to work with Constructor to make a simple DIF for TGEA. I created a box, then used CSG hollow to hollow it out, then I made another box and did CSG subtract to make a doorway into the hollowed box. Then I textured it, exported it to DIF, then loaded it in the game.

It seems to render okay, but I can walk through all of the walls except for the back wall. If I shoot at the wall the projectile will hit the wall, but the player can walk through.

I had the same problem when I created the hollowed out box manually with 6 boxes instead of CSG Hollow.

So, is this an issue with Constructor, or is it an issue with TGEA, or am I just doing something wrong in Constructor?


Thanks,
Gerald

#1
12/03/2008 (11:52 pm)
I'm also having similar problems even though I'm using the latest 1.0.51 patch.
#2
12/04/2008 (6:27 am)
If you turn off HSR, or make all of your brushes "detail" brushes, do you still see the problem?
#3
12/04/2008 (6:40 am)
Hi Jaimi,

I'm not sure what HSR is (could be because its too early to think), but I just tried making all of the brushes detail brushes and the problem persists.

Best Regards,
Gerald
#4
12/04/2008 (6:57 am)
Can you send me the csx file and the dif? I haven't seen this before. Maybe if I run it in the debugger I can catch some warnings or errors.
#5
12/04/2008 (7:58 am)
Hi Jaimi,

You can grab the files from here:

www.coderfile.com/testdif.zip


Some additional notes:

1) The walls that I can walk through also do not show dynamic shadows cast on them.

2) I noticed that if I delete one of the side walls, then re-export, then the other side wall works as expected.


I'll probably start stepping through a debugger here shortly too. I'll let you know if I see anything that makes sense before I hear back.

Best Regards,
Gerald
#6
12/04/2008 (8:52 am)
Okay, I was able to simplify the file a bit and just leave one brush which I am able to walk through. THe new file is here www.coderfile.com/testdif2.zip

I noticed that if I move the box closer to the X origin that it works fine. But if I move it outside of about -8 X on the one side, or outside of about 12 X on the other side, that it doesn't handle collisions. But if I move it inside of those ranges, it does. Then if I add a new box further outside of those ranges, this box will handle collisions on the inside side but not the other side, and the new box that I created outside will not handle any collisions.

Very weird.
#7
12/04/2008 (9:18 am)
I think I found the problem, or at least another major symptom of the ultimate problem.

In Interior::read we have this code:

for(i = 0; i < NumCoordBins * NumCoordBins; i++)
   {
      stream.read(&mCoordBins[i].binStart);
      stream.read(&mCoordBins[i].binCount);
   }

When I load the DIF with just the wall that I can walk through, all of the binStart and binCount items are 0. Since that is the case then Interior::getIntersectingHulls is never going to return any intersecting hulls. I don't really know enough about DIF to go any further than that, but it does appear that the problem is probably with Constructor rather than TGEA.

Hope that helps shed some light on what's going on.

Best Regards,
Gerald
#8
12/19/2008 (8:48 pm)
Just a quick follow-up on this.

I managed to get it to work, though I'm not sure exactly what did the trick. As a result of a comment by Tom Brampton on one of my other topics I decided to try moving the map2dif_plus_tgea.exe from the TGEA Tools folder to the Constructor folder and setting the export options to use it instead of map2dif_plus_tse.exe that came with Constructor. Then when I exported the DIF the collision detection worked as expected.

So I said AHA! Constructor is using the wrong map2dif.

So just to validate that the map2dif was indeed the problem, I set the export options to use map2dif_plus_tse.exe again, and exported the DIF again... and it worked correctly again!

And then I though well... maybe for some reason it was using the old TGE map2dif_plus previously. So I set the export options to use tgea_plus.exe.... and it still worked fine.

Very weird indeed.
#9
12/19/2008 (10:12 pm)
Hi Gerald - Sorry I missed this post, I don't have time to keep up with the forum as much as I used to. The internal exporter ("export as dif") doesn't use an executable, it's all in the application. Are you using that version, or one of the old legacy exporters, or the map2difplus exporters?
#10
12/19/2008 (10:55 pm)
Hi Jaimi,

No problem.

That's truly mad then lol. I tried for days to get it working with no luck a couple weeks ago. I am using the Export as DIF option, and I just deleted all of the map2dif*.exe files from the Constructor folder to verify that it's not using them now, and it's not. I had previously tried all of the options, including the (map2dif plus TGEA) option, and continuously had the same problem.

Then in another thread Tom mentioned something about Constructor requiring a different version of map2dif, so I figured I'd play with it some more today. First thing I did was create a box and subtract another box from it, and export it, and I could walk right through it like before. Then I moved the map2dif from TGEA over, went to Export->Edit Export Configurations, and changed the filename there from map2dif_plus_tse to map2dif_plus_tgea, and exported it again using Export As DIF, and suddenly it started working.

Even now I just downloaded the testdif that I uploaded previously. I put the .DIF in my game data folder, and loaded it up, and had the same problem as before. Then I loaded the .csx in Constructor and exported it, and it worked fine.

I also just tried deleting Constructor and installing it again, and exporting the DIF again, and it's still working.

I have no clue what was going on, but it seems to have just fixed itself.

If I run into the problem again I'll let you know.
#11
12/20/2008 (11:37 pm)
Well after getting it to work I decided to shelve my other level creation project and try to use Constructor, since it would theoretically save me time and possibly allow me to extend level editing features to my users easier without them having to purchase an expensive modeling package.

So I did a rough modeling of my first level building, exported it to DIF, loaded up the game, and walked right through it again.

After cussing at my computer for a while, I loaded up the test file that I posted earlier, exported it, and it worked fine. So then I loaded my new file again, exported it, and it worked too.

So there's still a problem there, but it's a bit more intermittent now than it was before. Without the source code I probably can't track it. I know what's missing from the final .DIF from my earlier debugging, but no idea what might be causing it.

Now I'm thinking I need to go back to plan A, or possibly plan C and just develop my own custom level editing tool, since this is bound to lead to loads of frustration. But before I do that I'm wondering something else.

Are there any plans to ever provide the source code for Constructor either as a separately purchasable package, or otherwise?

Best Regards,
Gerald