Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
30.5 Days
Nov 19, 2006

kewlpc posted:

He's talking about 2D sidescrolling terrain with destruction, a la Worms, not 3D terrain.

The question was how to do pixel-perfect terrain destruction like in Worms, where a bomb "eats" the terrain, then the terrain collapses. That was answered already.

But I think now he's wondering how to actually draw it. Tiling alone isn't enough, since you'd need a tile for each possible way each piece of terrain could be destroyed, which would require a huge amount of video memory, defeating the whole point of tiling in the first place.

Honestly, the easiest way is to forgo using the 3D hardware and just do it all via software blitting. Then you can store your whole level as one big image in memory and destroy it as you go. But then you don't get to have pretty explosions, free alpha blending, etc.

What I'd do is decide if having the terrain collapse after the bomb eats away at it is necessary. If not, you can still use the 3D hardware as a fast 2D blitter:

1)When an explosion occurs, eat away the terrain in the destruction bitmap. Use the destruction bitmap for collision detection.

2)Save the center point and radius of the explosion in a list.

3)Draw your background

4)Draw explosions (even ones that have already happened) into the stencil buffer. Just draw a circle, using the center point and radius from your list.

5)Draw the terrain using tiling, but with the stencil buffer check turned on. Wherever an explosion has taken place, the terrain won't get drawn.

You should probably prune the explosion list periodically, looking for things like one explosion that completely overlaps another, to reduce overdraw in the stencil buffer.

This is good, but I would really recommend a mesh deformation solution instead. Reason being that you still have to couple your modifications here with something to fix up the collision detection. With mesh deformation, you give your character sphere or capsule colliders, and you can do collision detection against the terrain (as an arbitrary mesh) no problem.

EDIT: I understand we're talking about a 2d game, but with an orthographic view matrix, you can still do it with a 3d renderer.

Adbot
ADBOT LOVES YOU

30.5 Days
Nov 19, 2006
Given what they let slip in the blog post, it seems like they've been quietly shaking down cloud companies (playfab, etc.) and improbable told them to take a hike because there's not an actual requirement in the EULA that they pay. So now there is one. I suspect that unity didn't want anything in the EULA because it would cause people to say, "hey it's weird that you're charging all these cloud hosting companies money just to provide unrelated platforms for your engine".

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply