News for hackers. Stuff that matters.
Re:Swift is Open Source by practicalswift on Thursday December 03, 2015 @01:55PM (#10671703)
Happy to see that my collection of Swift compiler crashes (see https://github.com/practicalswift/swift-compiler-crashes) has been part of the official Swift repo since September 2014: https://github.com/apple/swift/commit/e5ca8be1a090335d401cd1... :-)

A previous HN thread about the swift-compiler-crashes project: https://news.ycombinator.com/item?id=9020206

Re:Swift is Open Source by practicalswift on Thursday December 03, 2015 @05:13PM (#10673115)
I'm really impressed by the attentiveness of the Swift compiler team. Found this in the repo: https://github.com/apple/swift/commit/666646fee95bc75ca81e1d...

One tweet and the bug is fixed within a couple of hours. Wow!

Found that issue while working on the Pythonic.swift project: https://github.com/practicalswift/Pythonic.swift (btw, contributors welcome! Know Python? If so, a very good way to jump into Swift programming is by contributing to Pythonic.swift: a Swift implementation of selected parts of Python standard library)

Re:Swift is Open Source by Arjuna on Thursday December 03, 2015 @03:22PM (#10672303)
Wow, congratulations, that's really cool! Speaking of errors, I remember receiving the "Expression was too complex to be solved in reasonable time" error when I was first implementing Catmull-Rom splines for calculating flight paths in a game that I developed. I translated that to, "The math is making the room spin up in here." Definitely the "coolest" error I've hit working with Swift.
Re:Swift is Open Source by pa5tabear on Thursday December 03, 2015 @04:24PM (#10672755)
I recognized the name Catmull from Steve Jobs biographies... lo and behold you're talking about the Pixar President Edwin Catmull.
Re:Swift is Open Source by Arjuna on Thursday December 03, 2015 @04:49PM (#10672925)
Indeed; that's him! Edwin Catmull [1], along with Raphael Rom [2], created the Catmull-Rom spline.

It was perfect for the Galaga-like level in my game. I only need to define a few control points to create a robust flight path for the enemy drones. The cool thing about the Catmull-Rom algorithm is that the spline passes through the control points.

[1] https://en.wikipedia.org/wiki/Edwin_Catmull

[2] https://en.wikipedia.org/wiki/Raphael_Rom

Re:Swift is Open Source by copperx on Thursday December 03, 2015 @09:43PM (#10674260)
Curious -- were you implementing the drawing algorithm by scratch? or were you using any libraries?
Re:Swift is Open Source by Arjuna on Thursday December 03, 2015 @11:11PM (#10674558)
Thanks for asking... I used Apple's SpriteKit framework [1][2]. It's essentially a 2D graphics rendering framework that primarily acts as an abstraction layer for OpenGL ES. In addition, it also offers several other "nice-to-have" features with regard to 2D game development (e.g., collision detection, particles, physics, etc.)

Of course, you could do all of the above without SpriteKit. For example, for all of the rendering, you would simply write everything directly in OpenGL ES.

There are also cross-platform options, like Cocos2d-x [3] and Marmalade [4].

Finally, if you've read this far, you might be interested in reading my general thoughts and feelings from when I finished the game [5].

Cheers!

[1] https://developer.apple.com/spritekit

[2] http://www.raywenderlich.com/category/sprite-kit

[3] http://www.cocos2d-x.org

[4] https://www.madewithmarmalade.com

[5] https://news.ycombinator.com/item?id=8888107

Re:Swift is Open Source by cballard on Thursday December 03, 2015 @06:17PM (#10673467)
When that happens, try adding type signatures to any closures that are currently using inferred types. It often fixes it.