Live data from Hacker News

Flappy Bird in Swift

github.com

71–80 of 126 posts

Re: Flappy Bird in Swift

#72

This may be a stupid question but is the language in some way tailored to game programming? Apple's examples at WWDC were game companies, their coding demo was a game, and this is the first project I've seen written in it - and it's a game.

I think you're missing this is building off of other things that are meant for games like scene kit etc....

The language isn't tailored to it, but there are things it makes easy that are. If that makes any sense.

Re: Flappy Bird in Swift

#73

Author here - I didn't expect to see this here this morning. I'd intended to write a longer post :) In any case, here's a few things I learned about swift yesterday building this. Please note that I have about 4 hours swift experience, so feel free to correct anything I say that's wrong. 1. To make properties on a class you simply declare the variable on the class e.g.: class GameScene: SKScene { var bird = SKSpriteN…

I think just the fact that you were able to build a game with just 4 hours of learning a new language speaks volumes about Swift's barrier to entry. Well done!

But the code was just a port/convert, seems relatively non-trivial to do that in 4 hours.

Re: Flappy Bird in Swift

#74
post #7
post #2

pretty neat! I am not an iOS developer but if i understand correctly this uses the new Sprite Kit stuff included in iOS8 for 2d rendering right ? Is this a threat to existing 2d/game engines ? Not sure where SpriteKit integrates into the existing stack for making a game.

Looks like a good way for Apple to lock the developers to their platform. In past glory days people used to make games for iOS first and consider porting to Android much later. These days developers think cross-platform from the start, esp. since it's much easier to test waters and iterate on Android. I guess that SpriteKit is an attempt to stop this trend. Smart move by Apple IMHO, but perhaps a little bit too late.

I see your polite, critical, level-headed opinion has been down voted into gray dust, despite my meager support. I entreat those who pass by here to drink in my own following opinion: I think you're operating from the democratic ideal that "all people will opine equally about all topics at all times."

The departure from this ideal, I've discovered, is that there is a "Practical Crowd" who will swoop through when questions of practicality, such as cross-platform compatibility come up. Their opinions will be nearly absolute and they will be all but intolerant of the "weak" who claim that merely targeting Windows, Linux and OSX is "enough." They will justify with numerous cherry-picked examples from history, starkly, if not carefully, considered arguments toward the future, and with evidence of grit on their fingers from the present, in which the particular ideal is espoused. At that time, they will down vote anyone deviant enough to cheer for Swift.

Yet, currently my friend, the Apple Crowd has the floor. Any practical concerns are scheduled after the celebration. Think of this when you read the next cross-platform thread and see the Apple fans trying to get a point in edgewise amongst The Practical. There is very little global reality, mainly local basins of morality.

Re: Flappy Bird in Swift

#75
post #54

As a C# developer, I can read and understand the code without any issues. That's a good thing for Apple. I'm sure Objective-C is great but it's too foreign for me and didn't want to toy with it for fun, not worth the effort. But I can write an app or two with this one.

I get where you're coming from - but in my experience, the barrier is totally psychological. Objective C isn't that unusual a language - the syntax is a bit foreign, but nothing that takes more than a couple of days to wrap your head around. You'll spend far more time getting to grips with Cocoa/Cocoa Touch.

That's my problem. I can't even find the entry point for this application. Looking at AppDelegate.swift I see an unused var (window) and that's it.

Re: Flappy Bird in Swift

#76

This being the only code sample of swift I've seen, my overriding takeaway is that for the basic stuff it's remarkably similar to Objective-C with a lick of paint. If people really take to swift, it'll be interesting to see if that's because it creates a shift in programming style, or because people really are just afraid of small syntactical differences.

After skimming through the code and knowing that it was a job that took only four hours, it's very likely that this is just objective-c code written in swift(as the saying goes, you can write java in any language). It will take a bit more time to learn the idiomatic swift style and implementation.

Re: Flappy Bird in Swift

#77
post #54

As a C# developer, I can read and understand the code without any issues. That's a good thing for Apple. I'm sure Objective-C is great but it's too foreign for me and didn't want to toy with it for fun, not worth the effort. But I can write an app or two with this one.

I get where you're coming from - but in my experience, the barrier is totally psychological. Objective C isn't that unusual a language - the syntax is a bit foreign, but nothing that takes more than a couple of days to wrap your head around. You'll spend far more time getting to grips with Cocoa/Cocoa Touch.

the barrier is totally psychological

Of course it is. It's certainly not a physical barrier. But psychological or not, other languages don't have a similar barrier.

Re: Flappy Bird in Swift

#78

Earlier quoted context omitted.

I think just the fact that you were able to build a game with just 4 hours of learning a new language speaks volumes about Swift's barrier to entry. Well done!

But the code was just a port/convert, seems relatively non-trivial to do that in 4 hours.

I supposed "relatively" is the key word here. To me, that'd be a great feat. To others, not that special.

Re: Flappy Bird in Swift

#79
post #77

Earlier quoted context omitted.

I get where you're coming from - but in my experience, the barrier is totally psychological. Objective C isn't that unusual a language - the syntax is a bit foreign, but nothing that takes more than a couple of days to wrap your head around. You'll spend far more time getting to grips with Cocoa/Cocoa Touch.

the barrier is totally psychological Of course it is. It's certainly not a physical barrier. But psychological or not, other languages don't have a similar barrier.

Okay, I meant more that there's not a skills barrier in terms of actually learning to use the language. The syntax can be intimidating, but once you've spent a couple of hours with it, it's not an issue any more.

It's far more difficult to get to grips with how the APIs work.

Re: Flappy Bird in Swift

#80

Earlier quoted context omitted.

I get where you're coming from - but in my experience, the barrier is totally psychological. Objective C isn't that unusual a language - the syntax is a bit foreign, but nothing that takes more than a couple of days to wrap your head around. You'll spend far more time getting to grips with Cocoa/Cocoa Touch.

That's my problem. I can't even find the entry point for this application. Looking at AppDelegate.swift I see an unused var (window) and that's it.

@UIApplicationMain is the key there, from what I can see. An Objective C iOS app typically includes a main.m entry point which calls UIApplicationMain and passes the AppDelegate. This seems to have been removed in favour of what Swift is calling a "declaration attribute", which presumably does the same thing.

In this sense, the code is even less clear than the Objective C implementation.

Post reply on HN