Block Breaker: breaking blocks & pathfinding

Breaking away blocks now actually works! I had to implement some pathfinding to pull it off: I’ve used vertices as nodes and edge lengths as path costs, to find the block with the smallest enclosing, from a given start and end vertex (the intersection points). It does the job quite nicely now:

BlockĀ Breaker

I’ve ported this game to C++, using Haaf’s Game Engine, partly because it ran too slow in Python (after quite a bit of shooting around, of course), and partly because I needed a solid debugger for further progress. The whole project is now quite a bit past it’s prototyping stage anyway: I know what kinds of issues I need to solve, and I know how I can solve most of them:

  • removing any leftover edges in the old shape – a few comparisons between the two blocks should tell which edges have become obsolete
  • making some other edges border edges – again, just a few comparisons
  • making sure the new block doesn’t have it’s edges inverted – in some cases, new blocks have inverted edges, and I don’t know yet how I’ll solve this
  • determining when a loose path should become part of the new block – this one is more tricky, but I think comparing angles between edges should suffice
  • determining the surface of the new block – tricky, I think I’m going to triangulate the shape and take the sum of the surfaces of the resulting triangles
  • determining the center of the new block – again, tricky, but triangulating the shape and taking the average center should do the job
  • and finally, some debugging here and here…
Block Breaker: breaking blocks & pathfinding

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s