Mark Sachs (ksleet) wrote,
Mark Sachs

  • Mood:
  • Music:

I feel like some kind of LEGENDARY MERCENARY.

Phew! All that geometry is finally coming together. This is essentially the proof of concept for "for reals" map generation in Neon Galaxy. We can construct arbitrary polygonal rooms and connect them with arbitrary winding corridors, using the polygon clipping code to do so. Then, by recording the lines that form the joints between rooms and corridors and then removing them in a post-processing pass, we can create the "real" geometry which will be used for physics and for rendering the map. I wouldn't say it was totally smooth sailing, as it turns out there were a zillion problems with the polygon clipping algorithm, but largely it all worked as expected.

There's plenty more that can be done here, but it all falls more in the area of "how can we use this?" For example:

  • Take several of those irregular polygons, put them on top of each other and clip them against each other while doing so. We now have a hollowed-out cave.
  • If the two points which make up the far end of a corridor are both inside another room, clip the corridor against the room. Now we've got a corridor that doubles back to connect to an already-existing room. (In other words, the map doesn't have to be an acyclic graph, as it is now.)
  • Given different types of rooms (rectangular, regular polygons, irregular caverns) it would make for a more convincing map if we come up with a logical way to arrange them. Suppose there's a restricted number of times that one room type can be connected to another -- three, say. Once that number of connections is used, any room connected to an existing one must also be of the same type. This would tend to group rooms of the same type together in the same part of the map.

    Indeed, there's a delightful array of options here. To be honest I've mostly just been stuck trying to think of how I want to organize them inside the code.
  • Tags: neon galaxy
    • Post a new comment


      default userpic

      Your reply will be screened

      Your IP address will be recorded 

      When you submit the form an invisible reCAPTCHA check will be performed.
      You must follow the Privacy Policy and Google Terms of use.