Skip to content

World Generation: Level Design Week 3

World Generation: Level Design Week 3 published on

ocean problem

 

It all started with that little ocean hole right there.

ocean problem 2Green represents claimed zones, yellow edges, blue ocean.

The problem was that it was impossible for the current zone to claim that ocean tile. It wouldn’t be able to create a double edged border . No amount of hole checking would solve it, it’d require allowing an already placed zone to revise itself or manipulating it in some other way. A can of worms. With single edged zones rapidly appearing more sane I hastily started to revise the edge system to use them instead of wasting time on a double edged system I’d probably just change later anyway.

If you can recall from last week, the big problem with single edged zones was the possibility of multi-zone connection edges:

zoneproblems

 

My solution is quite simple, during zone creation a single edge tile is reserved to be used as a doorway link between two zones at a later date. If two zones don’t have a reserved edge, then they aren’t truly connected. If an edge is connected to 3 or more zones, then it can only be opened if all 3 zones are declared open to each other. The problem was trying too hard with two edge cases:

single edge problem3  The white edge represents the currently considered reserved edge.

In this problem the considered edge is only directly connected to two zones. But it’s adjacent to an edge that’s connected to a third zone- if both are opened then it effectively creates a link between all 3.

single edge problem2

In this case the considered edge is connected to unclaimed ocean. In theory, a new zone could eventually crop up there and then it’d need an edge adjacent to the reserved edge lest it create an unintended connection! But that new edge wouldn’t actually be connected to any other zones unless it knew the reserved edge was actually open.

My unnecessarily complicated solution was to mark adjacent tiles that there was a possible zone connections near the reserved edge and to not create an open tile unless it was desired to connect to those two zones. This was, of course, completely stupid and unnecessary complexity. In the first case, who cares if it creates a connection- for all intents and purposes the player is traversing through the middle zone to get to the other zone- it just happens to be a particularly quick route. In the second case the unclaimed tile should simply be assumed to eventually be another zone and consequently that edge is unusable for reservation.

So then another problem cropped up:

double edged swordGrey mountains represent edges linking two zones. White mountains and caves represent unlinked edges.

If you direct your eyes to the top of the image you’ll notice the top of the border of the two zones isn’t detected as linked. This is because those two edges are bordering against the unclaimed ocean tiles. The solution to this was mercifully simple: I had been placing land on -all- zone edges. If I simply kept edges as ocean tiles up until a link is detected, the issue goes away.

At this point the code base had been ravaged from multiple ways of doing edges, unnecessary reserve code, and so on. So I stripped it all down, re-implemented critical components, made it so zones generate land instead of the layered multi-zone continent non-sense I had going, and so on. This entry doesn’t end on a high note, that’s where I still am. Ironically, doing the last few adjustments to get ocean hole detection working again. Look forward to a mid-week shame post, where I actually start generating level design.