๐Ÿ“ฆ calda / Streets

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

โ˜… 9 stars โ‘‚ 2 forks ๐Ÿ‘ 9 watching
๐Ÿ“ฅ Clone https://github.com/calda/Streets.git
HTTPS git clone https://github.com/calda/Streets.git
SSH git clone git@github.com:calda/Streets.git
CLI gh repo clone calda/Streets
Cal Stephens Cal Stephens Add README with images 2820f57 8 years ago ๐Ÿ“ History
๐Ÿ“‚ master View all commits โ†’
๐Ÿ“ Carthage
๐Ÿ“ images
๐Ÿ“ Streets
๐Ÿ“ Streets.xcodeproj
๐Ÿ“„ .gitignore
๐Ÿ“„ Cartfile
๐Ÿ“„ README.md
๐Ÿ“„ README.md

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.