Building Hexagon Sphere Using Animal Crossing-Inspired Trick
Nice shader.
UNSUNG, the developers behind the upcoming turn-based tactical roguelite Tile Crawl, recently shared a little insight into how they managed to turn a bunch of hexes into a globe for the game, using an approach inspired by Animal Crossing.
Tile Crawl's run maps were already built around hexes, so the team wanted the planet that serves as the game's meta-progression to look the same. They didn’t want to use pentagons and set out to somehow cover the entire sphere with equal-sized hexes, despite the fact that, geometrically speaking, that's impossible.
Apparently, it's just a plane with objects placed on top of it. The trick is that the vertices are recalculated in a shader based on the camera's position. To look consistent, all the objects need to use the same bending setup or the same shader code with matching values.
"Okay, so this gives us a bent plane that looks like a sphere. Next challenge is actually allowing it to rotate properly; rotation is achieved by just moving the plane in the X and Y axes while the camera stays static. To achieve looping of the planes, I am spawning 8 more planes with copies of the objects and then teleporting them as I am crossing the edges (this part for sure can be done way, way better with some vertex magic or just fewer clones).
Next challenge is that shadows are broken as vertices are recalculated but normals are not; to calculate a new normal, we need to get two neighbors of the vertex, then bend them with the same logic and use the results to calculate the new normal. This allows us even to have proper shadowing from clouds above.
Last thing to do is clicking the nodes on the map. As objects are actually in very different spots from visuals, just raycasting from the mouse won't work. So I'm using one big sphere collider to detect the mouse position on the sphere, then recalculate it backward to where it would be on the plane and find the closest node in radius.
There are still some things left to do (VFX support is quite bad, and there are some artifacts with water waves on the edges of planes). But in my opinion, already looks quite good and stands out."
Tile Crawl mixes spatial, puzzle-like battles with free exploration, but there's a catch: you can only carry six items, and every use wears them down. Wishlist it here.
We regularly feature breakdowns from indie developers sharing how they built different parts of their games. For example, you can check out how Jarl Frode implemented 2D grass rendering with compute shaders, or how Quad Head shipped a multiplayer game with Godot 4.6 using C#.
And if you're looking for even more deep dives, we have a whole interview section where we chat with developers about their projects, development process, custom tools, and, of course, marketing.
Don't forget to subscribe to our Newsletter, join our 80 Level Talent platform, Discord, and follow us on Twitter, LinkedIn, Telegram, and Instagram, where we share breakdowns, the latest news, awesome artworks, and more.
Are you a fan of what we do here at 80 Level? Then make sure to set us as a Preferred Source on Google to see more of our content in your feed.
Keep reading
You may find these articles interesting