WWDC 2014 announcements as a game developer

At WWDC 2014, Apple announced new features for iOS and OS X. These are my thoughts: Swift Swift is a new programming language by Apple. At first sight, it seems to be easier to learn and easier to master than Objective-C. Objective-C is not particular difficult to learn and master, but its syntax looks foreign to C# / C++ / Python developers. Swift, on the other hand, has a more conventional design. You can read Swift code the same way you can read C# code, even if you are not a Swift or C# developer. Swift is a compiled language, although it looks like an scripting language. It is strongly typed, it is object-oriented with functional features. It does not have garbage collection. It uses ARC instead. You can call any Objective-C API from Swift (at least Apple’s APIs) , and Apple claims it is faster than Objective-C. Objective-C wasn’t the fastest language out there, but it wasn’t particularly slow either. Perhaps the killer feature for me is Playground, a kind of sandbox for testing ideas / rapid development / rapid prototyping. BTW, Playground seems to be inspired (or copied if you prefer) from Bret Victor’s Inventing on Principle talk, which is a MUST WATCH video for everybody. Also, Swift has pretty much what John Siracusa asked for in his Copland 2010 article. So, if Swift is easier to learn, easier to master, less error-prone, faster to develop code, performs better than Objective-C and you can call Objective-C code from it, why Apple should keep adding features to Objective-C ? I expect that: Objective-C code will be supported on iOS / OS X for the foreseeable future. But new APIs will be added on Swift only. Developers will be forced to migrate to Swift to use the new ones (similar to what happened years ago with Carbon vs. Cocoa APIs ). Unknowns: Can you call any Objective-C library from it ? or only Apple’s APIs ? Will Apple release the binding generator ? [UPDATE]: Yes, it is possible to call 3rd party Obj-C libraries from Swift. Will Apple open source the language ? Or at least submit the language to the standard committee ? Can you call C and/or C++ libraries from it ? For me: Swift is a very attractive language, so if Apple decides to open source it, it has the potential to gain a lot of developers from other platforms as well. I would definitely use it, and would seriously analyze the possibility of porting cocos2d to it. Bret Victor’s Inventing on Principle was very inspiring. Since the day I watched that video, I wanted to add similar features to cocos2d. Playground showed us that it is possible to do it with a compiled language.

June 3, 2014 · 5 min · ricardoquesada

Integrating LiquidFun with Cocos2d-x: Part I

[caption id="" align=“alignnone” width=“400”] LiquidFun Testbed + Cocos2d-x[/caption] From LiquidFun’s site: Based on Box2d, LiquidFun features particle-based fluid simulation. Game developers can use it for new game mechanics and add realistic physics to game play. Designers can use the library to create beautiful fluid interactive experiences. Basically LiquidFun is Box2d plus an extension to simulate fluids using a particle system. To test it, download and install the official LiquidFun - Testbed, and LiquidFun - EyeCandy for Android. Cocos2d-x already has Box2d integration, so in order to integrate Cocos2d-x with LiquidFun, we only need to integrate this new class: b2ParticleSystem. LiquidFun’s b2ParticleSystem I’m not going to describe how to use LiquidFun (for that, read its programmers guide). Instead, I’m going to describe how to integrate b2ParticleSystem in Cocos2d-x (also applicable to any other game engine). For the integration, what we need is a Cocos2d-x node that knows how to render a b2ParticleSystem. And b2ParticleSystem has these 4 useful methods: [code language=“cpp”] class b2ParticleSystem { … // Get the number of particles. int32 GetParticleCount() const; // Get the particle radius. float32 GetRadius() const; // Get the position of each particle in Box2d’s coordinate system // Array is length GetParticleCount() b2Vec2* GetPositionBuffer(); // Get the color of each particle in RGBA Uint8 format. // Array is length GetParticleCount() b2ParticleColor* GetColorBuffer(); }; [/code] Ideally we should be able to reuse cocos2d::ParticleSystemQuad for the rendering, but we can’t because: cocos2d::ParticleSystemQuad doesn’t support changing the attractor (this is a design bug, we need to fix it). A nil attractor would be needed for this case. ParticleSystemQuad works with Quads, and not Points. And even if Points were supported (like in Cocos2d-x v1), it wouldn’t work because the points and colors should be in an interleaved array. The other issue is the conversion between Box2d and Cocos2d-x coordinate system, but it would be easy to fix.

April 23, 2014 · 5 min · ricardoquesada

Dell XPS 15: Quick Review

I’ve been using a Dell XPS 15 for a week, and this is my review (from a developer’s point of view): Pros: Display: It has a nice 15" display with a resolution of 3200 x 1800 (higher DPI than the MacBook Retina Display). Weight: It is a light notebook, of about 2 kilos. It is very fast. And it boots in a just a few seconds. It doesn’t come with crapware The keyboard is Ok. I like that you can toggle the Functions keys by pressing Fn + Esc. Great unboxing experience, but who cares? Cons: ...

April 16, 2014 · 2 min · ricardoquesada

Vistual Studio: First steps

Goals Compile and run cocos2d-x tests on the emulator Set a breakpoint in Visual Studio. Running cpp-test on the Emulator 1. Download cocos2d-x v3.0 2. Unzip it and then go to cocos2d-x/build directory $ cd cocos2d-x/build 3. Open cocos2d-wp8.vc2012.sln with Visual Studio $ start cocos2d-wp8.vc2012.sln 4. Set cpp-tests (Windows Phone Silverlight 8) as the default project: Go to the Solution Explorer Right click on cpp-tests (Windows Phone Silverlight 8) Click on Set as StartUp Project 5. Run cpp-tests on the Emulator Press the Emulator 8.1 WVGA 4 inch button If an Hyper-V error appears, then you have to enable Hyper-V: Enable Hyper-V on the BIOS And then enable Hyper-V on Windows 8.1 Pro (it won’t work on the ‘Regular’ edition). 6. If the following Dialog pops-up, just press Retry: And that’s all. You should see the cpp-tests running on the Emulator:

April 11, 2014 · 2 min · ricardoquesada

Installing git

So you have Windows 8.1 + Visual Studio 2013 installed. Now you need to install a git client. My workflow in Mac is: I use git command line about 70% of the time. In the reaming 30% I’m using Tower, Kaleidoscope and Xcode. So, I was looking for something similar for Windows. And so far, this is my current setup: Mysysgit, for git command line. SourceTree for GUI I couldn’t find a good stand-alone diff-viewer, so I’m using SourceTree’s What I like about Mysysgit is that it installs a Unix-like shell, with git auto-completion and you can also see the current branch in the shell prompt. That is very handy. ...

April 10, 2014 · 2 min · ricardoquesada

From iPhone 4S to Lumia 1520

In order to have a better understanding of Windows Phone, I’m migrating from my old and tiny iPhone 4S (3.5" display) to the huge Lumia 1520 (6" display),(Thanks MS for the gift). I’m also switching carriers, from Verizon to AT&T. My very first impression is that Windows Phone is different. I’m not saying it is worse or better than iOS, it is just different. It is an smartphone , so it has Apps, a Store, Maps, Messages, and more… but with a different interface. If you are coming from iOS or Android it might take a while to get used to it. As an example, the “Start” screen is the start screen ( sic)… and it has " live tiles". A tile is like an bookmark (or symbolic link) to an app but “live”: it can change its “icon” in runtime. You can also change the size of the tiles, and re-order them. From the “start” screen you can transition to the “apps” screen with a swipe to the left. It contains a alphabetically-sorted list ofall your installed apps… as long as the apps are not games. Games are stored in another container called “games” :) So, you won’t find any games in the “apps” screen… you can’t even search for installed games from the “apps” screen.

April 9, 2014 · 2 min · ricardoquesada

Comparing prices

Let’s compare some prices. iOS: Xcode is free You have to pay $99 per year in order to submit games to the AppStore. Android: The SDK and NDK are free There is a $25 one-time-only fee in order to submit games to Google Play Windows Phone 8: VS Express 2013 and Windows Phone 8 SDK are free. If you want something more complete, you can get VS Online Pro for $45 per month, or VS Pro (offline version) for $499. You have to pay $19 as an individual or $99 as a company per year in order to submit games to the Windows Store Random thoughts: ...

April 4, 2014 · 2 min · ricardoquesada

To MSDN or not to MSDN

A long time ago I was a Windows developer. I developed for user mode, kernel mode, win32 stuff, etc. And having a MSDN subscription was a must-have. Not only because Visual Studio was included, but also because you were able to download “debug” builds of the whole Operating System; and also you had access to all the Microsoft products in different localizations. The MSDN subscription was expensive, but it was worth it. ...

April 4, 2014 · 1 min · ricardoquesada

Installing Visual Studio

So, by now you should have Windows 8.1 up and running. The next thing is to install the Windows Phone SDK. A few days ago I tried the Windows Phone 8.0 SDK (it comes with Visual Studio Express 2012) and it works OK. But VS 2013 Update 2 RC (announced 2 days ago) already comes with the Windows Phone SDK 8.1 (which also allows you to develop for WP 8). This is good, because you don’t need to have two versions of VS installed in your machine in order to develop for Windows and Windows Phone 8. ...

April 4, 2014 · 1 min · ricardoquesada

Use Windows 8.1

You need Windows 8 in order to develop for Windows Phone 8. Windows 7 won’t work. But avoid Windows 8, it is confusing. Use Windows 8.1 instead. And boot directly into the “Desktop”. Avoid the annoying “Start” thing. Good news: the upgrade from 8 to 8.1 is free. You should know that there are many “flavors” of Windows: “RT”, “Regular”, “Pro”, “Enterprise”… just get the “Pro”. RT (Runtime) is the new name for Metro. ...

April 4, 2014 · 1 min · ricardoquesada