Game Development Community

Approximating a concave curve by using several tiles

by Robert Serocki · in Torque Game Builder · 04/26/2006 (11:03 am) · 3 replies

I hesitate to relate this since similar issues have been addressed in other threads, but this is different enough that I figured I'd ask anyway.

In Photoshop, I made an arch designed to act as the upper portion of a pinball game simulation, like a broad upside down U. I used a grid guidance system to see how it would look sliced up into tiles, then numbered each section of the grid that contained sections of the concave curve, in order to match up the sections again.

I used ImageReady to slice the image into a grid and export the results as many different image files. After getting rid of tiles unrelated to the curve, I had roughly 45 tiles.

I used the level editor to snap the tiles to the grid and made collision polygons for each curve section / tile, by tracing over the curve, resulting in a flat surface for each part of the tile that the 'ball' was meant to come into contact with. Sometimes, this resulted in polygons that were almost cubes, but with a section sliced off diagonally. Sometimes, the polygon would be a little chip in a corner.

To test this out, I had a 'ball' (which used a roughly circular polygon shape rather than a real ball collision polygon) with a y velocity set to -10 go up into the arch, starting out next to one end, which was perfectly vertical. The 'ball' would go along fine and then do something like have its y velocity set to 0 and start coasting in away from the curve on the x axis.

From looking at the discussions of similar issues, it would seem I would be able to intimidate the 'ball' into not doing this by having collision callback functions for each tile, and check to see where the ball was coming from in order to decide on a realistic direction for the ball to head off in. I might be able to lay sections of polygons over the seams, if that would help.

My question is, would it be better for me to wait until a future T2D release to try this? Am I going about this the wrong way? Time is not of the essence to me with this, so I could conceivably work on another project if what I'm trying to do will be simpler with a later release, but if my wishes are unrealistic and I'll need to either have other polygons covering the seams or else provide custom callback functions for every tile on the curve, that would be useful to know as well.

- thanks in advance

#1
04/26/2006 (12:01 pm)
I think some of the physics in TGB are either a little wonky, or too complicated for my brain. Last night I fiddled about with a little demo in a similar vein. I set a ball to bounce a tilemap that just use square polys on the tiles. After messing about a bit, the ball would zip about all over the place, and eventually fall through my tiles, despite there being no gaps in the collision polys.

Beta 3 is due to be released the end of this month, so fingers crossed some of these things get crossed off the snagging list.
#2
04/26/2006 (4:58 pm)
I think the physics is pretty rock solid already in TGB. It's just got a lot of options to fiddle with to get the desired effect. Be sure to read the Informal Technical Overview.pdf

@Robert- you shouldn't have to script the collision response. The beauty of it is you turn on collision response, and set the material property, then you just apply a force to your sprite and wham-o you got a physics simulation.

@Philip- try turning down Restitution (bounciness) and slow down the velocity. I think if you hit light speed, sprites can have some quantum effect and tunnel through other objects :-)
#3
04/28/2006 (3:57 pm)
I appreciate the response, Alex, but if I weren't having issues such as I described above, and if a problem with seams were not reported at http://www.garagegames.com/mg/forums/result.thread.php?qt=40989 I wouldn't have asked. I'm already aware of the physics simulation possible and made a breakout game using them. I was using only the physics engine in the curve project when the ball would zing off in an unexpected direction, which is why I wondered what I could be doing wrong. I'll wait for the next release.