2013/05/15

miniDooM: Hopping Sectors, Part 2

And we're back!

Intent on fulfilling my threats promises, here is an animated .gif showing some more progress. Details after the break.



The animation shows, in no particular order:


  • Doomie in movement! It's not apparent, but the head and body are actually two independent pieces. What's missing is the hands (and any items held in them).
  • Sector Lines: Inspired by how the original DooM handled it's map system, the sector edges handle collisions, area transitions, and a few other things. Up in the animation you can see the following:
      - YellowSolid edges.
      - Green: Non-Solid edges.
      - Cyan: Edge normals, that is, where the "wall" is facing.
      - Blue: Edge's starting point, as they are actually vectors, with the normal pointing to the right.

    No, I didn't forget about the red lines...
  • Collision Groups: One of the reasons why I chose this arrangement is to simplify collision calculations. The idea is that sector edges are organized in groups based on their normals (in other words, based on where the "walls" are facing). When an object moves, it only checks if collisions happen with edges in a group that would collide with it's movement vector. In other words, if an object moves to the left, collision will only be checked with edges facing to the right.

    In the animation this is represented by the Red edges. When the Doomie moves into a given direction, the edges being checked for collision (that is, those part of the appropriate collision group) are being painted red.

    Note that the diagonal edges light up more often, as they are part of two collision groups at once.


Next steps are as follows:

  • Merge the Sector and Tilemap code, so tilemaps are generated based on the sector's collision layout (Right now I have manually made them match, but they are unrelated pieces).
  • Improve the collision group sorting. The idea is to have the collision groups sorted front to back, or, in other words, organized based on position to avoid detecting a collision with an edge that is behind another edge. More on this (including a proper explanation) later.
  • Draw more tiles! Keen eyed viewers might have noticed the existence of diagonal edges, but no diagonal tiles. That is just me being lazy and not drawing the corresponding tiles. The sector edges in this animation, though, represent all the possible collision angles I have planned for the scenery.
    Please note that all edges are proportional to the tile's size. Although it would be possible to create a sector system with arbitrary edge lengths and angles (essentially what DooM does), I prefer to limit myself, partly for simplicity, partly to get to use tiles.
  • And the exceptionally keen-eyed might have noticed that when moving diagonally, the Doomie has a distinct lack of proper frames (essentially reusing the vertical animation). Yes, again, got to get around to drawing them.
    On the other hand, in order to have a Corpsie around, all I need to do is switch the heads! 



No comments:

Post a Comment