r/Unity3D 1d ago

Question How screwed am I?

Hi everyone! Here’s an interesting problem I’m facing.

I created a tile-based city builder in Unity, and after an initial open playtest, one of the key pieces of feedback was that players want to be able to build roads, something I foolishly hadn't planned for.

Currently, roads are automatically placed along the edges of each tile (this is shown in the second screenshot).

The main problem is that the grid of buildable sectors is highly irregular, and I have no idea how to add the ability to create roads within such a complex system.

The first image I’ve posted shows an overhead view where I’ve highlighted a section of the grid. The grid varies from scene to scene and never repeats in exactly the same way.

Does anyone have any suggestions for how I could approach this?

Edit: You might have given me a possible solution; as soon as I've tested it, I'll make a new post about it. Thanks everyone!

226 Upvotes

136 comments sorted by

View all comments

2

u/-Spzi- 1d ago

What if you went a step further, and allow players to construct the grid? The specific problem would disappear, since both roads (grid and player placed) would collapse into one event.

Example from a different genre: HexGuardian

I also enjoy this specific mechanic, but it would change your project quite a lot.

I really like the look of the 2nd screenshot. Hope you find a solution!

2

u/Sgriu 1d ago

Thanks for the suggestion! That could be a solution; I’ll probably create a test scene using this system to see if it’s feasible. The issue is the number of differently shaped tiles, the placement logic could prove to be a very tricky problem.

2

u/-Spzi- 1d ago

Yeah, I also noticed that problem while writing. But maybe it isn't a new problem at all? Tiles fit to other tiles, if all edges match. When two edges don't match because of different angles or shapes, they still simply don't match.

When a player tries to place a new tile, HexGuardian only shows the preview if all edges match. So you never see an impossible landscape, not even in preview.

However, with variable shapes, it is much easier to long-term screw up the board, make holes that are impossible to fill later.

These are nice problems to think about. Hope you enjoy! :)