Thursday, February 16, 2017

Mesh Mosh

I followed a tutorial on the Unity tutorial page to generate caves using cellular automata, the marching squares algorithm, and the flood fill algorithm. This is to make a map structure to encapsulate each level. I can toggle how dense the map fills with walls vs open area, effectively changing it from small chambers and passages to a wide open cavern. Then I  fed in the points along my river, made with Bézier curves, into the passage carving functions to carve out the river, effectively making the cavern/cave structure like a canyon the river is passing through. Within each level, the canyon may split and have separate areas for interesting encounters. Here's some screen shots of the process where I turned off all the other special environmental objects, like watering holes, shops, the castle, the bath house, the dam, etc.






If you can't tell, in the bottom left photo, I forgot to turn off a trigger to spawn a bunch of dudes, so a lot of them just appeared inside the walls or wherever. The bottom right is from the same instance of the game, so you can kinda get a sense of scale.

The other big reason I did this was that creating a mesh is way more optimal than having the million game objects for environment that I had before. I've actually turned the river into a mesh as well, because the river was a bunch of smaller objects laid along the curve. One mesh will be much better. The trouble that has caused is needing to calculate the direction of the current based on the location of the flying units and also the visuals need reworking. I didn't absolutely love the overlapping ellipses, but I thought it was minimalistically pretty.

I also changed the blog to Blog of Flock of Dogs and blogofflockofdogs.blogspot.com, because it's funny. And now, when I type into the address bar "flo..." it autocompletes to my website and if I type in "blo..." it will, I imagine soon, autocomplete to this blog.

No comments:

Post a Comment