├── .gitignore ├── .DS_Store └── published ├── about-steve-jobs.md ├── hello-world.md ├── blockskit.md ├── Swift-cocoapods.md ├── ios-8-extensions.md └── the-state-of_mac-gaming-2014.md /.gitignore: -------------------------------------------------------------------------------- 1 | progress/* -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dimillian/blog-articles/master/.DS_Store -------------------------------------------------------------------------------- /published/about-steve-jobs.md: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /published/hello-world.md: -------------------------------------------------------------------------------- 1 | What an original title... yeah. 2 | But I finally have a blog associated to my [website](http://thomasricouard.info) now! 3 | 4 | For the curious, this blog use [Ghost](https://ghost.org) and it's hosted at [Heroku](http://heroku.com). Ghost doens't run out of the box on heroku, but it's really simple to make run on it. 5 | I followed this awesome blog [post](http://blog.johnny.io/how-to-get-ghost-running-on-heroku-for-free/) from Johnny Halife. 6 | I also use the same theme as him at the moment, it's Vapor and you can find it [here](https://github.com/sethlilly/Vapor), but I may change for a new one in the future. 7 | 8 | Yeah all of that is not super original, but I plan to post cool things soon, I promise! 9 | 10 | -------------------------------------------------------------------------------- /published/blockskit.md: -------------------------------------------------------------------------------- 1 | I recently started a new/side iOS application alongside my main one. I decided to write it with the less code possible, so I started digging into my notes and searching for all the cool libraries I starred for later use. 2 | (Yeah integrating a library which change your codestyle late into a projet is generally a bad idea). 3 | 4 | I'll pass on [ReactiveCocoa](https://github.com/ReactiveCocoa/ReactiveCocoa), [ObjectiveSugar](https://github.com/supermarin/ObjectiveSugar) and other libraries I integrated in this new project and jump on to [BlocksKit](https://github.com/pandamonia/BlocksKit) 5 | 6 | This little marvel provide a lot of functions that are usually called through `delegate`, and transform them into blocks. 7 | In a lot of cases, blocks are a lot better than `delegate`, because it's more compact. When using an `UIAlertView` you want to be able to read the call to action of both buttons after the declaration. 8 | Now you can, you don't need to suscribe to a delegate and implement a function a few lines below. 9 | 10 | All functions from blocksKit are prefixed with `bk_` which is cool because you can easily list every functions available from BlocksKit on an object. Also it won't conflict with [ObjevtiveSugar](https://github.com/supermarin/ObjectiveSugar) for example, as it duplicate some functions. 11 | 12 | I mostly use the `UIKit` extension at the moment, it provice blocks for UIAlertView, UIActionSheet, UIButton and more. 13 | 14 | If you begin a new application I strongly encourage you to use the Blocks syntax, so make your own categories, or use BlocksKit. 15 | For external readers and contributors to your code, it's much more consise and readble. -------------------------------------------------------------------------------- /published/Swift-cocoapods.md: -------------------------------------------------------------------------------- 1 | ### It works out of the box 2 | 3 | True story, I tried it. 4 | 5 | So you want to make a new shiny `Swift` project but you are worried about not be able to use all those awesome `Objective-C `libraries? Worry no more! 6 | 7 | Apple did some clever things with Swift, you can use Objective-c code within a swift project, Xcode will automatically generate a Swift "header" for the imported cod so you can call the original function in your `Swift` code like if it was coded in `Swift` right from the beginning. 8 | 9 | So let's create a new simple `Swift` project, a single view application for example: 10 | 11 | {<1>} 12 | 13 | {<2>} 14 | 15 | 16 | The first thing you want to do is enable the `Objective-c ` bridging header. In order to be able to use `Objective-c` code in `Swift`, you need to tell Xcode to use a bridging header, you'll import all your `Objective-C` headers in this file, once done, all the headers imported here will be exposed to your swift code. 17 | 18 | It's very simple to do that, `file => new file` and choose `Objective-C` source file, Xcode will then ask you if you want to enable the `Objective-c` bridging. 19 | 20 | {<3>} 21 | 22 | Click yes, it'll create your source file alongside a .h. You can remove the source file you've created, we created it only for Xcode to automatically link the header and enable `Objective-C` within the project. We could have done it manually but hey, doing this offer the configuration for free. 23 | 24 | {<4>} 25 | 26 | Now create a `podfile`, add `pod 'AFNetworking'` for example, run a pod install. 27 | Then open your workspace, what you need to do is import the `AFNetworking.h` in the bridging header. Once you've done that, you can call `AFNetworking` code in `Swift`! 28 | 29 | [Example app & code](https://github.com/Dimillian/SwiftTests/blob/master/testApp/MainController.swift) 30 | 31 | 32 | -------------------------------------------------------------------------------- /published/ios-8-extensions.md: -------------------------------------------------------------------------------- 1 | are awesome. 2 | 3 | ### For real! 4 | 5 | I played with the API a bit, this is really simple, to do an hello world, just create a new project with Xcode 6, choose Swift (or maybe Objective-c :) ). 6 | Now you have a basic iOS 8 app, now choose file => new target, and in extension, choose whatever you want, the today extension is the most simple one for an hello world project. 7 | 8 | {<5>} 9 | 10 | Now you are setup, and ready to go, Xcode created the main view controller for your extension alongside a storyboard. 11 | 12 | {<6>} 13 | 14 | Yes, this is true, a today extension is a true UIViewController subclass and respond to all the API you already know alongside some new one. 15 | 16 | If you build & go, you'll be able to add your extension to the notification center 17 | 18 | {<7>} 19 | 20 | {<8>} 21 | 22 | 23 | I strongly suggest you to take a look at some of the [WWDC videos](https://developer.apple.com/videos/wwdc/2014/) session already available, especially "What's new in Cocoa Touch" and "Creating Extensions for iOS and OS X, Part1" if you want to have a solid grasp of what extensions are about. 24 | 25 | In short, to ship an extension you need an host app, you can ship any number of extensions of any kind with an application. You can't ship an extension without an application. As soon as the user will launch your app, he'll see the new extensions available at the bottom of the notification center and in the settings app. 26 | 27 | Also, extensions and your app are 2 completely separated binary, of course you can share code between them, reuse views etc... But your instance and process can't really communicate together. Not much more than you can communicate with system or other 3rd party app for exemple. You still share the same sandbox and app default, so I think it's largely enough. 28 | 29 | Anyway, this is really huge, it's not only widget, it's share action for Safari, photos and more.. Also you can expose content within your own app to let other "Action" extensions access and manipulate it. 30 | 31 | If you want an actions that extract a movie metadata from an iTunes page or Amazon product page and send it to your app user library, well you can. Just make an action extension for Safari and remind the user to use it. Kinda like the "Add to reading list" button. 32 | 33 | I also want to add that extensions are not nefarious for the end users, like the background multitasking Apple allowed recently, extensions widgets are controlled, killed and fired by the system. It won't have that much impact on performance and battery. I exept it to be really optimized. Your extension will be created as soon as the notification center appear and killed as soon as it disappear and that you task is done. 34 | 35 | I can't wait to see the first few iOS 8 apps with extensions. And of course, to make my own. 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /published/the-state-of_mac-gaming-2014.md: -------------------------------------------------------------------------------- 1 | **Disclaimer**: I play a lot of games, I used to play on console, but nowadays I mostly play on my Retina Macbook (which is also the computer I use for my job), because it's powerful, and OSX is not a barrier at all if you know what you're dealing with. I'll try to explain it what is like to play on OSX in this blog post. 2 | 3 | #### OMG YOU PLAY ON MAC NOOB? GO BUY A REAL COMPUTER! 4 | 5 | I would like to begin this post with the current state of gaming on a Mac in 2014, and also explain to you why some people think it's so bad. 6 | 7 | It's bad because companies who makes AAA games don't care about Mac gaming and because Apple is late on graphic drivers. 8 | AAA Mac games happen sometimes, for example Bioshock I, II, and III are available on Mac now, alongside the latest Lara Croft and some other AAA games too. 9 | 10 | It's not bad because it's a rushed job (well kinda), it's bad because it uses the wrong technology. Then players try these games on Mac, see that performances are like 40% the performance of the same game under Windows, and here we are. Left alone with our cold metal Macbook and no games to play at 60 FPS. 11 | 12 | That why we see raging users on forums who now think playing on Mac is a heresy and should never be done, only if you want the sky to fall on earth. 13 | 14 | You have to understand that to port or make a game to run on OSX you have something like 2 options if the game is already running on Windows and already released. 15 | 16 | 1. The owner company can modify their engine to make it run natively on OSX. 17 | 18 | 2. The owner company can ask an [external company](http://transgaming.com) to port the game for them. And the easiest way to do it is to make the game run under a Windows emulator (kinda, it's a translation layer in fact, more on that later). 19 | 20 | Please note that the owner company can hire an external company to do point 1 and vice-versa. 21 | 22 | What happen is the point 2 most of the time, it's cheaper (Okay I don't know about that part) and faster, and don't require to dive into existing huge codebase. 23 | 24 | And this is the sad truth, and that's why most of the times, Mac game perform like craps, but let me explain why. 25 | 26 | ### About rendering engine 27 | 28 | {<1>} 29 | 30 | Windows and OSX use a radically different API to translate graphics code to the GPU and then to the screen. 31 | On Windows, programmers tend to make their game using the Direct3D (DirectX) interface, and this is normal. Microsoft make and promote this API really hard, and yes, it's actually very good. But it's limited to Windows only... But you can target most of the market by making games only for Windows. 32 | 33 | It's still a fair point in 2014, but I want to believe that Valve and some other indie developers is in the process of changing everything. 34 | This year GDC have been amazing, the [Unreal Engine](https://www.unrealengine.com) editor is now available for Mac! 35 | 36 | {<2>} 37 | 38 | On Mac, if you wan to write a graphical Application, you must use **OpenGL** (**Open** Graphic Library). This is an API which allow you to display 2D and 3D graphics. The big bonus point of OpenGL is that it's **platforms** independent, it means that if you write an OpenGL application it'll be able to run on Windows, Linux and OSX (and other platforms too), with very minor modification for each platform. 39 | 40 | But most of the games graphic engine are wrote using the DirectX API, because it's convenient, tools are here and it's what Microsoft support out of the box on Windows and Xbox. PS3/4 is another story, as it use a [modified version](http://scalibq.wordpress.com/2010/05/15/sony’s-playstation-3’s-main-graphics-api-is-not-opengl/) of OpenGL which is not really close to the classic OpenGL. 41 | 42 | What most companies do is that they create some sort of middleware which translate the rendering code to DirectX or PS3 PNGL. Imagine is they included another [output to normal](https://github.com/ValveSoftware/ToGL) OpenGL (well even Apple use a slightly modified version of OpenGL). 43 | 44 | ###About Direct3D to OpenGL translation layer 45 | 46 | To come back to the point 1 of my list, usually what happens is that the game is released on Mac using what is called a Windows translation layer. It's a middleware that translate every Windows API and Direct3D call and execute the correct corresponding OSX/OpenGL call. 47 | 48 | It doesn't sound bad if I said it like that, but first it's a middleware, so no matter what, It'll slow down what happen between your program and the metal, it adds a layer to your application after all. 49 | 50 | But you'll also don't profit of platforms specific features and optimisations you could have made by writing true OpenGL code. 51 | There is a really good article on The Porting Team community [here](http://portingteam.com/frontpage/_/community-articles/reviews/mac-gaming-is-native-always-better-r19). True thing, native games are not always faster that one using a translation layer. Yes, the game is still thinked Windows/DirectX first, and OpenGL later. 52 | Blizzard and Valve are some of the only companies to make true OSX games. If you want to really play optimized and good games on Mac Portal 2 and Diablo 3 are a good start. 53 | 54 | {<3>} 55 | 56 | Most of AAA Mac games port are usually done by [Feral Interactive](http://feralinteractive.com) or [Apsyr](http://www.aspyr.com). 57 | Games released from those companies are usually quite good, I can remember playing Bioshock and Borderlands on my old Macbook, it was really a good experience. I believe those companies write their own translation layer (Or maybe recode parts of the engine directly to OpenGL), the thing is, the game is still made for DirectX first and recoded/translated for OpenGL later. 58 | 59 | There is another company called Transgaming, they have a product called [Cider](http://transgaming.com/cider). 60 | Cider works much like Wine, it was initially created from a modified version of Wine. It's a commercial version of Wine, with some professional tools built-in to ease porting games. 61 | Cider could have been good, but from what I've learnt and what I've tried, and it's not very up to date. 62 | While I see the improvements compared to 2 years ago, it still bad. Games released with Cider tend to be really slow and very limited in term of graphic settings available and performance. 63 | It's a closed source middleware, which is only accessible if you license it to the parent company. Activision, EA, and some other companies contract with Transgaming, and Call of duty, and The Sims are not the best ported games available on OSX. 64 | 65 | It's sad because there is also [Wine](http://www.winehq.org) which is evolving very vast lately. Wine is an open source Windows translation layer, and it's really easy to use and have a very active community around it. 66 | 67 | To put what I said in perspective, I do Mac ports as a hobby, if I take a game released on Mac using Cider, and if I make the port myself using Wine, it'll usually run better and faster than the official port. It'll also take me no more than 30 minutes to do. 68 | I don't know how much money companies pay Transgaming, but it would be really interesting to know. 69 | 70 | Also, there is actually something awesome coming to Wine in the near future, the ["Command stream"](http://www.winehq.org/pipermail/wine-devel/2013-September/101106.html). 71 | It was something done by the team at [Codeweaver](https://www.codeweavers.com) (Makers of Parallel, a closed source fork of Wine), that multithread OpenGL call and allow games to run 100% faster than it was before. It's a big step forward, I tried it with Skyrim but with some other games too, performances are really fantastic with this beast turned on. 72 | 73 | {<4>} 74 | 75 | I made a custom engine with Wine latest version using a patch from the WIP brnch of the Command Stream. I installed Skyrim, and oh my god. I was able to play the game in high, with graphical mods, on my Macbook Pro Retina (NVIDIA 650M) at 40-50 FPS. 76 | It's like 95% of what the Windows version can do. 77 | I plan to do a post about that someday, and I'll post a link to the patched compiled engine. 78 | 79 | There are also a translation layer released by Valve, which doesn't emulate the whole Windows API but just the Direct3D to OpenGL, it's called [ToGL](https://github.com/ValveSoftware/ToGL). 80 | I'm really glad that Valve open sourced that, but I would suggest that every new game should be wrote using OpenGL... Or that you write an engine capable of targeting both Direct3D and OpenGL (and others). So you make call to your abstract rendering engine, and then you're rendering engine make call to OpenGl or Direct3D depending of the platform. 81 | 82 | If you're on a Mac and you want to play Windows games or applications, you can start using [Wineskin](http://wineskin.urgesoftware.com). It's an GUI too for Wine which ease the Wine wrapper creation process by 1000%. 83 | Also, the Wine official applications/games [database](http://www.winehq.org) have a ton of ressources on what to install and how to make a specific game to run under Wine 84 | 85 | ### But why it's like that? 86 | 87 | Apple played a big part on how the Mac games market is shaped. Apple is late, if you talk to any Mac graphics developer, he will tell you that Apple graphics driver are really late. 88 | That's why even some native games are not as fast as there Windows counterpart even if they are native. 89 | Mac market share is also a lot thinner than the Windows one; which is why companies don't allow a very big budget to be spent on porting/releasing their games under OSX. 90 | 91 | ###In the end 92 | 93 | I'm really looking forward about playing on Mac and Linux, in my opinion, every games should be wrote in a platform independent way, it's maybe harder to do, but in the end you don't ask yourself or making peoples sad because your games isn't available on X Platforms. Also the Mac market share is [growing fast](http://appleinsider.com/articles/14/01/09/apples-domestic-mac-sales-surge-285-as-overall-pc-market-shrinks-75), which mean more and more potential Mac players. 94 | And you don't make yourself a fool by releasing a dirty port using Cider or Wine that run poorly on decent hardware. 95 | That argument is used a lot by the vocal gaming community, and it's now an accepted fact that games perform poorly on Mac. But they perform poorly not because it's a Mac, but because the technologies used to make the game offer a neat advantage on Windows. 96 | 97 | I tinkered a lot with Wine, I played and play a lot of games that run under Wine, I can get really decent performance nowadays, but a true native game (I'm looking at you [Elder Scrolls Online](http://elderscrollsonline.com)) will outperform non native game by a lot. 98 | 99 | There is a ton of things I didn't covered in this article, but I'm sure I'll have another opportunity to speak about it in a future article. 100 | 101 | {<5>} 102 | 103 | 104 | --------------------------------------------------------------------------------‘Do you want to spend the rest of your life selling sugared water, or do you want a chance to change the world?’”
— Quote from Steve Jobs by Walter Isaacson (via Glose)This quote is legendary
— Annotation by Thomas Ricouard (@dimillian)