I couldn't find a core 2D line segment intersection routine in Unity and I didn't really like the forum solutions, so I wrote my own, it's here in case anyone else wants it: gist.github.com/sinbad/68cb88e

Experimenting with using Force Directed Graphs to lay out rough high-level paths given a structural description of an "interesting" level

I like how the generator has built an alternate path around the back of the L-shape on the right of the screenshot: this is allowed because although it's off the main (yellow) path, it doesn't compromise the structure because it rejoins a similar point and isn't shorter. It's still correctly avoided all the other places which could have punched through what is quite a winding, tightly packed path

Obviously this is all horrendous programmer art so far. This is the entire tileset it's built from; special areas are just any geometry marked up with connectivity flags at a tile granularity

Hand-crafted special areas can now integrate with my wave function collapse random gen. Generation is guided by paths, with automatic shortcut elimination. This gives a random appearance, details and offshoots (more organic than just prefab room & corridor) but a more designable high-level structure than pure random

You might notice there's no way to skip major sections of the path, or jumping on to the branch from another point except via the explicit intersection. It's still free to generate offshoot areas elsewhere for interest. The orange/red markers are the frontiers enforcing it

To avoid shortcuts, it builds a progressive flow map to detect frontiers between reachable areas that shouldn't be allowed to meet, then updates the constraints to seal them. The paths know their parents so mixing frontiers within a configurable distance of intersections is ok

Level gen conforming to multiple hierarchical paths (branches & defined shortcuts, loops), which also eliminates unwanted shortcuts as it builds. There are so many edge cases to this but I think I've finally got it stable (famous last words)

Gif here, sorry too big for Masto
twitter.com/stevestreeting/sta

Still experimenting with procedural generation; this iteration:
1. ensures a spline path is walkable,
2. makes sure no shortcuts that would skip sections of the path are generated
3. allows random offshoots so long as they don't contravene 2

I quite like this method because it can detect shortcuts as it builds, using a sort of contextual flood-fill. Since I resolve path constrained areas first, & then cells most restricted by those, as you flow outwards you can detect clashing frontiers

It's tough to get music to suit a game, but sometimes I hear a track and like to imagine what kind of game would suit it. Like this one, I kinda just want to make something that fits with it: soundcloud.com/danmason420/k0r

I love this book, it’s like the most exciting parts of my childhood in hardback form. Sure I loved home computers, but the arcades were *magical*

Upgraded my key caps to double shot because the top print on my old set was wearing off. 👍

Tried to get PBT but it’s really hard to get hold of ISO sets in decent colours, so they’re ABS.

(Filco Majestouch tenkeyless with cherry brown switches, Tai Hao Navy)

As I add more constraints, the map starts to gradually look better / more organic. but the more constraints the more likely they accidentally hit a conflict case. Just spend a day and a half on conflict resolution but a previously failing case is now all good 🤘

Making progress with multiple paths causing those areas of the level to be open. Next: need to block off shortcuts; random offshoots are fine (desired, really), short circuiting paths is not

(that's the same random seed but with different paths)

Starting to constrain my level gen to "minimum walkable paths" as defined by splines. Obviously right now there are a lot of other walkable paths as well but by defining the minimum I can start to lay more higher level structure on things and dial back others

In case anyone's interested, I revisited and updated my 2D spline component for Unity this week, gave it a few more features such as working in the XZ plane for 3D projects (planar splines can still be useful). Grab it here, it's MIT licensed: github.com/sinbad/UnitySpline2

I'm gradually adding metadata so I can add more layers of constraints to have maps adhere to higher level rules: interesting loops / branches, region style biases, key locales, etc. Current system just represents the lowest level constraints (match visual edges, enclose at boundaries)

Still very much programmer art, but I'm getting a handle on good tile sizing / shapes that look more organic from my generator. Still only 5 tiles rn

Show more
Gamedev Mastodon

Game development! Discussions about game development and related fields, and/or by game developers and related professions.