Jump to content
  • Advertisement
Outliner

Octagon-Square tiling for world map

Recommended Posts

I'm looking for a way to render a game world that allows for both flexibility and easy editing. Directly modelling the world by hand is too labor-intensive. Using a pure height map is great for rolling hills, but terrible for anything else. Building a mesh from a vector representation of the map would seem to be ideal, but the geometric algorithms involved are quite difficult. Using a regular square grid is appealing in its simplicity, but only being able to use 90-degree angles everywhere would be painfully obvious to the player. Hexagon grids suffer from being unable to use 90-degree angles anywhere.

My latest idea is an octagon-square grid, which consists of a regular tiling of octagons with squares to fill in the gaps between diagonal octagons. This has numerous benefits.

  • Tiles can be rotated 8 ways, so one tile can do the work of 8, while squares usually only get 4 and hexagons only get 6.
  • Broad winding features like roads, rivers, and beaches are free to wind in 8 directions without the complication of passing over a corner.
  • 45-degree angles are almost small enough to prevent players from noticing that the game is rendered on a grid, especially when viewed from a first-person angle. It is far less obtrusive than other options.

This seems like a good plan, but it's not easy to find resources on the internet to make it easier. For example, where are the pre-made octagon-square tile sets? I couldn't find anything about octagon-square tiling on gamedev.net. Am I failing to see some issue that makes this approach unpopular? Is there some easier way to get the same effect, or is there some hidden pitfall that will cause me problems?

Share this post


Link to post
Share on other sites
Advertisement

Very interesting idea, i don't know a game already using this. Maybe you can make it an element of gameplay (user can rotate some tiles, or push a square on an octagon, rotate that and push the square to another octagon... interesting puzzle mechanics). If your goal is only to hide the structure, i assume it would work well for space station enviroment.

Edit: Note that this boils down still to rectangular tiles, one larger and one smaller square, and one rectangle. Maybe you can make them by scaling just one tile to get more variation / save work.

Edited by JoeJ

Share this post


Link to post
Share on other sites

Sparse information available should indicate the idea is likely poorly thought out or been tried and failed.  Your artwork is honestly twice as complex as you have to make tiles for a square and octagon.  Calculating cell position will be more complex too in my mind.  First off, why do you need grids?  You didn't say what sort of game you're planning.

These are just a couple thoughts I had when I first read your idea honestly.

Share this post


Link to post
Share on other sites
1 minute ago, Mike2343 said:

Your artwork is honestly twice as complex as you have to make tiles for a square and octagon. 

The big savings from a square and an octagon comes from features that run diagonally. For example roads are usually restricted to horizontal and vertical when they are being rendered with tiles because a diagonal road will awkwardly cut across multiple tiles. When a road crosses a corner between four tiles it means a piece of the road ends up on all four, thereby complicating all four tiles.

With square and octagon tiling, a diagonal road can be rendered just as simply as a horizontal or vertical road because it never needs to cross a corner. A diagonal road is as simple as rotating the tile of a horizontal road by 45 degrees.

10 minutes ago, Mike2343 said:

First off, why do you need grids?

That depends on the point of view. From a game design perspective I neither need nor want grids. There are no grids in the design document. All I need is world to explore for an RPG. It's not a turn-based game where the grid defines where you can stand and how far you can move. I'm doing my best to make the grid as unobtrusive as possible so the player won't notice it, and ideally there would be no grid at all.

The reason I'm using a grid is purely technical. I don't want to hand-model the whole game world, so I'm looking for shortcuts, and building the world out of tiles should make this considerably easier. The grid is needed only because it's the best option I've currently been able to find.

24 minutes ago, Mike2343 said:

You didn't say what sort of game you're planning.

It is an RPG in the style of classic Final Fantasy where the player wanders around a map and has text-based encounters. Therefore I'm looking for a simple way to render large amounts of terrain.

9 minutes ago, Servant of the Lord said:

Oh jeesh, wouldn't it be a huge pain to draw tile textures that tile seamlessly in 8 directions?

As far as I can tell seamless tiling of textures for octagons and squares is just as easy as tiling an ordinary square grid. Think of it as cutting off the corners of the squares and then filling in the gaps with a smaller square. You can use the texture from the cut off corners in the small square and then you've automatically got seamless tiling for octagons and squares.

Share this post


Link to post
Share on other sites
42 minutes ago, Outliner said:

As far as I can tell seamless tiling of textures for octagons and squares is just as easy as tiling an ordinary square grid. Think of it as cutting off the corners of the squares and then filling in the gaps with a smaller square. You can use the texture from the cut off corners in the small square and then you've automatically got seamless tiling for octagons and squares.

But not if you rotate the tiles... ("Tiles can be rotated 8 ways").

If you have a square, unrotated, then the top needs to tile with the bottom, and the left needs to tile with the right.

If you permit rotating of the square, then the top needs to tile with the bottom rotated 0, and the right rotated 90, and the top rotated 180, and the left rotated 270.

For seamlessly tiling *rotated* octagons in eight rotations, you'd have to get every side to line up with every other side, which A) might make tiling more noticeable, and B) would be hard to make the diagonals line up with the axial lines.

Octagons are cool in other ways, if you can do it (8 movement directions is much better than square's 4 directions, hexagon's wonky movement), but I think you'd simplify your graphical work alot if you just limited octagons to rotating in 90 degree increments, rather than 45.

Maybe I'm thinking of it wrong, though.

Share this post


Link to post
Share on other sites

You also haven't considered that with the square tiles, albeit smaller, you still have the issues of getting roads/rivers to tile nicely as in mentioned in your very first post.

6 hours ago, Outliner said:

Broad winding features like roads, rivers, and beaches are free to wind in 8 directions without the complication of passing over a corner.

You still have squares, so it's not for free when the river or road crosses over said squares.  How do you plan to handle this?

You'll also likely double your required art assets to make things look good/proper.

Share this post


Link to post
Share on other sites
1 hour ago, Servant of the Lord said:

For seamlessly tiling *rotated* octagons in eight rotations, you'd have to get every side to line up with every other side.

I see what you mean. It's probably best to do the tiles in layers. For example, the road could be on the top layer and the ground the road runs across can be the bottom layer. That way we can rotate the road without rotating the ground, so the ground only needs to tile seamlessly in one orientation. There would be a seam between the ground and the road, but that is a natural place for a seam so it would probably be acceptable.

1 hour ago, Mike2343 said:

You still have squares, so it's not for free when the river or road crosses over said squares.  How do you plan to handle this?

There are only a few possibilities for what the squares need to be, assuming we only allow roads to begin, end, or turn in the octagons. We need a square with no road, a square with road going from bottom-left to top-right, a square with road going from top-left to bottom-right, and an intersection where the road comes in from all four directions. That is all the possibilities for road squares done in four assets, and one of them is just a rotation of another.

1 hour ago, Mike2343 said:

You'll also likely double your required art assets to make things look good/proper.

Double the assets when compared to what? Do you have a preferred alternative in mind?

Share this post


Link to post
Share on other sites

Locomotion and rollercoaster tycoon opted for multi-tile elements in a plain grid. While it has some restrictions in attachment points, you are pretty much free in shape otherwise.

Share this post


Link to post
Share on other sites
16 minutes ago, Alberth said:

Locomotion and rollercoaster tycoon opted for multi-tile elements in a plain grid.

That's a really interesting option that I hadn't considered. Does anyone know of any resources for how to implement such a system? There is some question about what sort of data structure should be used to represent a grid that can have multi-tile elements, but even more difficult would be creating an editor for such grids that would be easy to use.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!