calda / Streets

πŸš— SpriteKit game that simulates managing a network of streets

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Streets

Streets is a prototype / mechanics demo for a road-management simulator inspired by Mini Metro.

In the prototype, you can draw striaght roads on the screen. Intersections are automatically identified using CGPathIntersection. Once a car spawner is connected to your road network, cars will be generated periodically. Cars can drive around the scene, taking a random turn when they reach an intersection.

Screenshots

CGPathIntersection

Surprisingly, calculating the intersections of two GGPaths is not function provided by CoreGraphics. Intersections must be computed manually. It's simple to analytically calculate the intersection point of two straight lines, but that does not extend to arbitrarily complicated paths. For example, the Streets prototype also has some support for roundabouts:

CGPathIntersection, created as a part of this project and provided as a standalone framework, provide tools for calculating the intersection of arbitrary CGPaths. As far as I can tell, it's the only open source Swift framework that provides this functionality.

About

πŸš— SpriteKit game that simulates managing a network of streets


Languages

Language:Swift 100.0%