martes, 14 de octubre de 2014

Data Orientation or The Circle Of Life

There was a time where data structures were important and every programmer would think in terms of procedures that simply transformed these data structures into other data structures. Many others would put their focus on declarative languages, and concretely, on functional programming (With ( Beautiful (Languages (like Lisp))). Yet the revolution in the world of programming paradigms was yet to come: Object Orientation arrived to tell a universal truth to all unwary and naive designer and programmer: "in our daily lives, we think in terms of objects, therefore objects should be the building blocks for your systems". And voilà! Smalltalk, C++, Java, and lots of other languages would stick to this paradigm, advocating code reuse and mental models of the system better aligned with the problem domain thanks to several techniques such as abstraction, inheritance, polymorphism and late binding. Object Orientation seemed to be the One that would guide programmers towards successful, robust, maintainable and reusable systems, especially with new languages that hid low-level dirty details like memory management.

Schools and universities then started to teach this new paradigm, first as a complement to previous programming practices, and soon, their curriculums would be centered around them. Because, why on Earth to teach C when most of the companies today called for Java programmers? Why to teach a paradigm that is obsolete, only present at legacy systems that are bound to being wrapped around web services or Java interfaces? 

Object orientation really seemed so perfect that when a teacher at my University asked us to give him one disadvantage of this paradigm, neither of us would be able to find a clear answer. Yes, everybody was thinking that Object Orientation was the best, and that it was unbeatable. 

Nonetheless recently I noticed something. In the same way as Sauron was secretly spawning enemies and planning its revival in the Middle Earth, some strange people were colluding in the deepest corners of the Internet to bring back something ""new"", something that cannot even be called a paradigm: data orientation. But what's more important: not only are these people convinced that data orientation is a plus, but they (most of them at least) are also convinced that object orientation is not that good, and that even could lead to very poor results.

Ok, let's put things in their context. Most of the people I read about who advocate data orientation (DO, from now on, which I will  briefly explain in short) work in the games industry or are indie game developers. This is important because one of the benefits of DO is a boost of performance due to more efficient memory usage.

As I mentioned before, DO does not seem to be a paradigm on its own, but rather a set of guidelines and ways of thinking, without any programming support or special techniques enforced by compilers or programming languages. The best way to understand (at least for me) what DO means, is by citing some of its mantras:

  1. The platform is the hardware, not the software. Know your platform, because abstraction is not that good.  
  2. The code is not important. Data is important. Code only serves the purpose of transforming data in trivial ways. Design your code around your data, not the other way around.
  3. Different problems lead to different ways to organize data. 
  4. When there is one, there are many. Don't think that a function will have to perform an action on only one object (typical object-oriented mindset), but think that this function will be applied to a bunch of objects. 

The main reason of the uprising of DO is the ever-growing gap between the processor and the memory. Processors are steadily faster, especially when considering multi-core and multi-processor environments. On the other hand, memory is not progressing as fast, so very often the processor is idle hundreds of cycles while waiting for data coming from memory. DO aims at exploiting the cache (a fast memory between the processor and main memory), and at making code easier to be divided among threads for exploiting cores and processors, something that is hardly possible with object orientation.

When you read some of the techniques that underlie DO, you may find that many of these techniques are well-known programming tricks that good programmers have known for years... but now they are being spread out and someway systematized for the public knowledge. For a quite comprehensive summary of these techniques, take a look here.

In this fantastic video, Mike Acton, engine director at Insomniac Games, explains data orientation with practical examples and how it can be implemented in a language like C++.


Here you can find lots of useful resources about DO. And here, a very interesting blog about the development of a game engine in which some DO considerations have been taken.

The point of this post is to reflect about a reality: the domain of Computer Science is in constant evolution, and hardware considerations constrain the way the software evolves. This evolution may even come in terms of a circle, coming back to the origins. But it's even more serious. We've been taught for years that abstraction is good, and that we don't need to worry about the platform on which we are developing. In performance-sensitive systems in general, and in game engines and games in particular, this is no longer true. Actually, developers are demanding to be able to work "closer to the metal" in the graphics domain as well.

I must add a personal comment though for all of you who are newcomers to the world of games programming. As I mentioned in an older post, abstraction is good, and should be you ally when you're starting. So don't worry about the nitty-gritty intricacies of low-level details. Just design your game in as high-level way as you can.

However, beware, you advanced programmers who want to delve into the world of game engine programming!! Embrace data orientation or perish!!

See you!
FM

jueves, 9 de octubre de 2014

Is this blog dead?

No!
See you!


No, really, it's been a while since the last post, but that's because I was quite busy and at the same time I needed to take a break. But I'm back stronger than ever with new ideas and with more technical insight into videogames and engines programming. 

For example, in the next post, I'd like to discuss about a phenomenon that I noticed is taking place lately in the world of games/engines programming: the reluctance of Object Orientation in favour of Data Orientation, something that a priori seems partly against what we've been usually told in Computer Science classes for the last years. I'll explain what this means and why it's happening very soon.

See you! (now yes)

lunes, 28 de julio de 2014

Gamepolis 2014: An Overview

Hi all!

As promised, I'm eager to share with you my experience during Gamepolis 2014, the second edition of this videogames festival held in Malaga from last Friday to Sunday. 

As last year, I arrived on Friday afternoon due to work, so I missed some of the morning talks. As I set foot on the entrance, I saw some Disney Princesses around (ok, not so videogames oriented, but quite of a surprise anyway).


Disney princesses; probably colluding against their princes... or no 

Then I walked around the stands in order to cover myself with the spirit of the festival. Graphics cards brands were presenting their last products, people gathered around games, like FIFA 2014 and Mario Kart 8, and shops were showcasing some very interesting and geeky products. 


People walking around the place. The surface of the event was bigger and clearer than in the previous edition. This allowed for a a clearer space. 


Gigabyte and Nvidia presenting their last products.



People gathered to play FIFA 2014 and Mario Kart 8. 
Tournaments for these and other games were also organized.


Geeky T-Shirts and videogames products were sold in the shops.

The first afternoon session was about legal issues to take into account before and after developing a game, including raising funds and protecting the product. I couldn't attend this one though because I arrived later (thanks Oliver for your notes).

The first session I actually attended was about the importance of music in videogames, where the speaker pointed out that the audio must adapt itself to the player, and that it should know its place in the game as a whole, not wanting to show off over the rest of the game. 



 While the session about music in videogames started, Pong was exhibited

After this talk, I decided I would walk around a bit more, and that's when I found a magical corner where all wishes come true: the retro area. There, old tiles would bring joy to all types of players: from the oldest ones to the youngest kids. 




The retro area was fantastic, as in the previous edition. 
Do you recognize the games in this pictures?

Then, I went back to the auditorium to enjoy the talk "Indie: origins and revolution", where the speaker provided an overview of some of the most relevant games in the indie scenario. The author also pointed out the importance of addressing game reviews rigorously and with actual insight, as it is done in his high quality magazine Deus Ex Machina.  



As examples of relevant indie games we find World of Goo and The Binding of Isaac.

Saturday morning started with tons of people lining up to buy their tickets. Fortunately, I had already bought a 3-days pass by Internet. 


Long queue on Saturday morning. 

I also took advantage of this great audience to advertise Chubby Buddy. For this purpose, Manuela designed an eye-catching flyer and we handed them out.


Yeahh! Our dear chubby friend was also in the conference. Some people (including bloggers and press staff) were actually interested and asked us about it

People tried to get pictures with their favorite game characters, including Altair or the scary Slenderman. 





As in the previous edition, people have made a great effort to look like their games counterparts. 
Do you recognize them all?

The first session in the morning presented a game that is being developed by Brainside, a Spanish game company based in Sevilla. The game is Embrion, which was already in last year edition. Last year, the developers presented a sensor that could be attached to the player in order to measure heartbeat and change the gameplay accordingly. This idea by its own is fantastic, but now they also revealed that they're using Oculus Rift to gain a bigger immersion. I didn't have the chance to try it, but I presume that the experience must be really frightening (actually, as a curiosity, the team mentioned that one person who was trying the game didn't have the courage to go beyond the first room of the game). 



By the stand of Brainside, people would line up to try Oculus Rift in Embrion

The next talk was about the presentation of a book and a new publisher: "Ediciones Arcade", which promises to bring from abroad and translate the best books on videogames. As as first notice, they announced that they would publish "La Legende Final Fantasy VII", a special edition for collector book that was not available in Spanish. 


Presention of Embrion

Next session I attended was "From videogames to gamification", where the speakers discussed the foundations of gamification and how it can boost productivity in boring tasks and at the workplace. They showed how big companies such as Coca-cola have understood the importance of gamification  as as marketing strategy.


Speakers during the gamification talk

Next session was: "Hidden treasures of MSX". The speaker, Gaby López, who was also in the last edition, revealed lost of curious games for MSX and MSX2. A funny part of this talk covered some erotic games that, contrary to what one may think, had a great quality.







MSX had lots of curious titles, but the erotic ones deserve a special mention... 

The first talk of the last day (Sunday) was a presentation of Bitton, a game-making company. In addition to presenting their last products, the speaker also reflected on marketing issues important to gain some audience in a competitive market such as the mobile one. 




Bitton presentation. Note the second picture: we employ around 3000 millions of hours per week playing online games... Awesome!

The name of the next talk was: "Metal Gear Solid: When Hideo Kojima met the movie industry". The speaker showed some of the films that inspired Kojima while creating this super mega saga. The speaker also presented his book: "Metal Gear Solid: The Legacy of Big Boss", which of course I bought :)


Me in the possession of this amazing book. Preparing myself for MGS5...

Next talk was about artificial intelligence in videogames, and the speakers, researches at University of Malaga, provided an overview on procedural contents generation and on the need for "artificial stupidity". This last term refers to human-like (error-prone) behaviour for bots, which is necessary in order to provide a more engaging and realistic experience.


Researches from University of Malaga talking about artificial intelligence

The final presentation was actually very special, and probably the most original presentation I've ever seen, because the flow of the presentation was driven by a game itself. The speaker, Locomalito, was playing a side- and top-down perspective game he had developed (very much like the first 8-bit Zelda adventures), and the issues on game development that he was discussing were intertwined with events in the game. For example, typical stumbling blocks (like lack of skills at the beginning) were represented like final bosses. 


A game-based presentation. Yes... I'll have to do this at some point :)

As a conclusion, my experience in Gamepolis has been rewarding: not only the atmosphere was great, but I also met people with the same interests. Last year, I suggested some improvements that can still be implemented for next year, so I'll copy-paste them: 

"There should be some more technical workshops or meetings where developers and artists could interact in order to open the possibilities of forming potential development teams. [...]. Please, free WiFi! I would've loved to comment the talks on this blog with my laptop while being there, but I could only do it by Twitter using my data plan".

I would like to specially suggest the organization committee to make an effort and try to bring some important international celebrity in the area of indie game development. I think designers and developers would love to be able to talk to Jonathan Blow, Derek Yu, Edmund McMillen and the like.

That's all, see you soon!
FM