Welcome to EnDavid.com. You can find here a compendium of things that I have published and other stuff I made during my spare time.

If you get lost, try visiting the Site Map.

In this main page, you can find my main blog, where I keep track of the updates of this site, and post some technical articles from time to time. If you are interested, just subscribe to the RSS feed.


2016 Retrospective
Fri, 30 Dec 2016 22:38:21 +0000
2016 Retrospective

Achievements

I released all these, None of the above has been a commercial success, but I got good feedback from friends and family. I'm particularly happy about Silabitas, because I made it thinking that it could help improve my mum's aphasia after the brain stroke she had last year, and she's been very patient and cleared most of the stages! 😊 (even when some people complain the game is too hard after the second stage 😜)

Power up!

I think I've done lots of learning,
  • Improved my Swift skills, while writing the games and apps above and some other unreleased projects.
  • Bettered my Javascript skills, with several internal apps I made at work, including node.js servers, and Javascript workers in the SOM demo.
  • Attended the Eurographics Symposium on Rendering
  • Learned about Metal API and started a couple of projects that use Metal. I also wrote a couple of blog posts about Metal and Swift for the tech blog of our office: Metal: a Swift Introduction, and Performance of quaternions in the GPU
  • Started learning and programming VR rendering algorithms.
  • I also updated myself a bit on Java and Android development.
  • Did some baby steps on Vulkan API.
  • Did some baby steps on Clojure.
  • Kept working in C# and C++ at work.
  • My year reputation in Stackoverflow is 329, which it's not much, but it more than doubles the reputation I had before.
Apart from that, I became Engineer Manager of my crew at work, so I think I'm getting better at Scrum and planning, and at listening to the problems and needs of my team.

Power down...

A brief interlude with some slightly negative things,
  • I practiced piano, but just to the level I wouldn't forget how to play a couple of songs I memorized... But I haven't managed to play anything new, and my score-reading skills are close to 0 now...
  • I haven't read any book... My list of readings is in fact empty since last year... I can never find the time... I've read some manga in Japanese, and I've read some online programming books, but perhaps I should try to find time for some other types of readings.
  • My Japanese is getting worse... I use it at home, but our conversations aren't technical... Also, I don't read as much as I used to do.
  • I haven't cleared Metal Gear Solid V: The Phantom Pain yet... I did play and got half way through, but, again, I'm quite busy during my free time programming games and other stuff... And of course, I haven't picked any other new game since I want to clear MGS first... So no "Uncharted 4" or "Final Fantasy XV" yet...
  • I haven't played any badminton. Since I cycle to work everyday, I do some exercise, but it would be better if I did something like badminton as I used to when I worked at Ninja Theory.
  • I haven't drawn much either... Although I'm quite happy with the cover I did for my game Silabitas.
I guess powering down is inevitable, since time is limited and there are too many things I want to do. But I should try a better balance for next year.

Fun

Trips!
  • I travelled several times to Barcelona this year, and had really good time with my family. I'm happy to have the love of my mum, sister, and brother ❤️
  • Visited Tokyo again. I didn't travel much, but I met many friends and ex-colleagues, which was the main purpose of my visit :)
  • Short nice trips to Edinburgh, Dublin, Berlin, Trieste, Ljubljana, Tenerife, and Paris.
And my highlight of movies and anime that I've watched this year,
  • The Danish Girl, a bit sad but worth checking.
  • Summer Wars, really good anime movie from 2009.
  • Your Name (君の名は), an anime movie nominated for next year academy awards. It's the best movie I've watched in the cinemas this year.
  • Yuri!!! on Ice, super cute sports anime about figure skating, centered around the pure love between the main two male characters. By the end of the year, with all the bad news going on about war and politics, this anime made me see hope in the human race again 😉
Music albums of the year,

And that's been my 2016! I think it's been quite good, but I'll try to admin my free time a bit better next year, including time for doing NOTHING!


Vulkan on Android: first dev impressions
Tue, 27 Dec 2016 18:53:40 +0000
As you may know, Vulkan is the Khronos Group equivalent to Microsoft's DirectX 12 or Apple's Metal, a modern graphics API. I've been playing a bit with Vulkan on Android, mostly following tutorials online and setting up a build environment. Starting from the conclusions first, I would say Vulkan is not quite ready for prime time just yet. Here are some of the reasons:

  • Very little supported devices: Nexus 5X, 6P, Samsung Galaxy S7. In contrast, Metal for iOS has been around for a couple of years already, so anything from iPhone5S onwards supports Metal.
  • Poor documentation. The official guide helps you get started by showing you how to build some examples, although the documentation is a bit out of date and I encountered problems with the latest version of Android Studio. In any case, the guide doesn't tell you how to setup a project from scratch. In contrast, you can start a Metal project easily in Xcode by simply selecting a Metal template when creating a new project.
  • Not many online tutorials. Google provides these samples, android-vulkan-tutorials, but again, it doesn't tell you how to start your own project. Other good tutorials, like vulkan-tutorial, do not provide setup instructions for Android.
  • Poor integration with Android libraries. Because you have to write your Vulkan code in C++, I suspect the communication with your Java libraries is going to be a nightmare. If you write your app using OpenGL ES, you can write everything in Java and you can use all the available libraries easily. Similarly, Metal can be written all in Swift, not only making it slightly easier to write, but also enabling an easier integration with the rest of iOS libraries. An example of this would be using an existing VideoPlayer to stream some video and then getting hold of the video texture to pass it to a Metal surface. The communication between native libraries and Java to get hold of that video texture in Vulkan sounds overwhelming at the moment.

References for the brave,

And if you are more interested in Metal,

Happy coding

Pan y Queso equality in Swift
Sat, 20 Aug 2016 18:49:45 +0100
Structs in Swift are copied by value, while classes are copied by reference. If we want to check if the reference of an object is the same, we can use the triple equality operator. From Apple's book “The Swift Programming Language”,

Swift also provides two identity operators (=== and !==), which you use to test whether two object references both refer to the same object instance.

I've put here a few examples that you can copy-paste into a Playground to understand what the above means when using comparison operators:

struct Pan {
    let rating : Int
}
class Queso {
    let rating : Int
    init(rating: Int) {
        self.rating = rating
    }
}
var q1 = Queso(rating: 0)
var q2 = Queso(rating: 0)
var q3 = q1 // same reference
var q4 = Queso(rating: 1)
q1 == q2 // error, == not defined
q1 === q2 // false
q3 === q1 // true
var p1 = Pan(rating: 0)
var p2 = Pan(rating: 0)
p1 == p2 // error, == not defined
p1 === p2 // error, they aren't references!
let quesos = [q1, q2]
quesos.contains(q1) // error, can't convert q1 to predicate
quesos.contains { $0 === q1 } // true
quesos.contains { $0 === q3 } // true
quesos.contains { $0 === q4 } // false

We can define an equality function if we want to check for the equality of the Pan and Queso values,

func ==(lhs: Pan, rhs: Pan) -> Bool {
    return lhs.rating == rhs.rating
}
p1 == p2 // true
func ==(lhs: Queso, rhs: Queso) -> Bool {
    return lhs.rating == rhs.rating
}
q1 == q2 // true
q1 == q4 // false
quesos.contains(q1) // still an error! pass a predicate

If we want to be able to pass a Queso to the "contains" or "indexOf" methods of array, we have to conform to the Equatable protocol. Having the equality function alone doesn't work. This will work,

class Queso : Equatable {
    let rating : Int
    init(rating: Int) {
        self.rating = rating
    }
}
func ==(lhs: Queso, rhs: Queso) -> Bool {
    return lhs.rating == rhs.rating
}
// ...
quesos.contains(q1) // true

Happy coding!

Relevant StackOverflow questions:


My new game is out: Silabitas
Tue, 12 Jul 2016 09:02:37 +0100
It's a word puzzle game, similar to the Japanese game "mojipittan". The main rule is that you can't place a new piece unless you create a word with it. It works well in Japanese because they only have a few syllables, but I think in English it would be very difficult to achieve. In Spanish, we have more syllables, but less than English, so I think I managed to reach a good compromise by mixing syllables with single letters. So it's a bit like Mojipittan plus Scrabble.

The word is localized to several languages, although the puzzles are always in Spanish. If you play in a language other than Spanish, there's access within the app to Google Translate so you can check the meaning of the words you've discovered. There's also access to their definition in Spanish through RAE online.

Silabitas home page


EGSR 2016 notes
Mon, 27 Jun 2016 00:11:11 +0100
Some brief notes I took during the Eurographics Symposium on Rendering, last week in Dublin: egsr2016.md.

Swift Pixels: pixel art drawing app
Sat, 02 Apr 2016 11:02:54 +0100
I've spent last Easter finishing an app I had in mind. It's related to my previous post where I talked about Self-Organizing Maps. I used those maps to create the color palettes for the app, a simple pixel-art drawing app: Swift Pixels

The app is free. Enjoy


Self-Organizing Maps demo
Fri, 25 Mar 2016 23:02:35 +0000
I've recovered some old Matlab code and turned it into a Javascript demo to show how SOM neural networks work. I used them in my thesis years ago to generate color palettes based in universal categories.

Here's the demo and more details: Color Experiments


May and Yam Against Pollution
Sat, 19 Mar 2016 21:12:54 +0000
I released a game for iOS and AppleTV last week: May and Yam Against Pollution.

It's a "re-imagining" of a game I made 23 years ago for the Amiga 500. I tried to keep the retro style, so I recovered some of the original sprites, and also tried to mimic the "copper lines" from the Amiga

If you try it, please let me know what you think (Twitter: @endavid)


Javascriptifying EnDavid
Sun, 06 Mar 2016 09:22:04 +0000
I've refactored lots of this site so it's easier for me to maintain. Originally, I used a lot of static pages and PHP so people with old browsers could access it properly, but it was getting hard to maintain.

So I'm now making heavy use of Javascript. There are a few changes to make the page a little more dynamic, but otherwise it should look the same. I've only tested it on Chrome, Safari, and Safari for iOS. If you notice something is not working, please let me know.

Also, I've updated the list of works a bit.

Anyway, it's getting warmer, so let's go out and enjoy the spring!


Happy new year!
Fri, 01 Jan 2016 10:00:26 +0000
明けましておめでとうございます!
Happy New Year!
¡Feliz año nuevo 2016!

⏪ Previous year | Next year ⏩