Tex2D Rotating Header Image

Recovering a mythical post from anaitgames

There was a time when a mythical post on anait games arised.

When I’ve looked for it in the internets and i’ve found the layout isn’t kept anymore, so I’ve decided to put it here with a better layout for future references

Here you can find the original post:

Chiconuclear y Xavi Robles llegan de fiesta y se encuentran con esto en el post del Crackdown 2.
Creemos que se merece una entrada como mejor post de la historia de AnaitGames.
Geras ha hecho una lista con 47 elementos que deberían aparecer en Crackdown 2. Temures de viejo. Hoygan:

1 motos
2 aviones
3 taxis q te lleven a donde quieras
4 humers
5 traker
6 feraris
7 bbicis
8 patines
9 patinetas
10 barcos
11 q tu puedas crear tu propio personaje
12 q el mapa sea muy grande
13 q allan islas
14 q allan deciertos con sus animales
15 q allan animales por la calle coomo pérros o gatos 16 q allan niños
17 q puedas comprar tu casa 18 q allan peluquerias
19 q puedas comprarle ropa
20 q gane dinero por cada q mata a un malo o un enemigo
21 q puedes elejir entre ser un pacificador o un pandiloco
22 q allan elicopteros
23 q naden mejor
24 q allan animales en el mar como peces ballenas
25 q se pueda sumerjir en el agua
26 q llueva o q granice
27 q cambie de clima
28 q tengan los dias del año para q en diciembre neve y llegue santaclos jaja
30 q alla jaloweeen
31 q festejen los dias con desfiles o q allan desfiles asi por nomaqs
32 q allan carreras de caballos y q te los puedas robar y meterte en la carrera
33 q allan cuadrunees
34 q allan lanchas
35 motos acuaticas
36 jet pack
37 q puedas modificar tu auto
38 q allan camiones monster
39 q allan pitserias o amburgueserias
40 q se pueda jugar de 1 a 4 jugadores sin interconeccion
41 q te puedas sentar
42 q pueda aser ejercicio
43 q balla a un jimnacio
44 q allan clubs deportivos
45 q allan parques
46 q puedas entrar a las casas o a los edificios
47 q allan tuberias a las que puedas entrar


This is my current project right now. I had the chance to get the source code and assets of an old game: Resurrection, the return of the Black Dragon. And I wondered “wouldn’t be fun to upgrade its rendering algorithms and that stuff to something more up to date”? And well, that’s my pet project at home. When the other more serious projects allow me, or when I simply want to do something funny, I spent some hours with it.

Here do you have a gameplay of the original game (yep, some people still play to games from 1999), and later a peek of where I’m now.

[youtube J6pdj36brMQ Original Resurrection]

And what have I done on the code? Well, when I took it it had a fixed pipeline forward shading renderer, and that was my start point. Currently it is a opengl 3.3 (formerly OpenGL 4.5 but the port to osx on a macbook from 2009 forced me to go down to 3.3) deferred renderer with omni shadowmapping and an exagerated SSAO :). Ah! and I don’t draw transparent meshes yet :)

The shadows are simple Shadowmapping with no filter yet, and the lighting it’s still a lambertian/blinn. Easy peasy, but I have to admit it’s funny to dive into the code and find ways to improve the rendering.

Here is the little video I’ve recorded this morning. Just the character moving, and I enable/disable the SSAO, otherwise no one would notice it’s there.

It’s embarassing but I admit that 1999 resurrection still looks better than mine, but give me time :)

[vimeo 227532668 Reborn (AKA Resurrection Resurrected)]



Intellij 13 eap

If you have this error when  starting up intellij 13 ultimate EAP on linux 64 bits:

[YourKit Java Profiler 12.0.3] Log file: /home/casa/.yjp/log/IntelliJIdea13-2942.log
/usr/lib/jvm/java-7-oracle/bin/java: symbol lookup error: /home/casa/.java/jayatana/1.2.0/amd64/libjayatana.so: undefined symbol: gdk_threads_enter

Add this line to idea64.vmoptions


It worked flawlessly for me and I can keep coding.


A little advice

SDL overrides the main method, so don’t forget to include sdl.h in your entry point file. Otherwise the SDL_main funciton won’t be called and you can spend like two hours trying to figure out why the hell the system is not creating a proper context :P

The last game i’ve worked in

Last Thursday, the last game I’ve been working on was launched at te Apple App Store. Since then a lot of things have been said about that game, some good, some bad :). I’m thinking seriously to write an in-depth post-mortem of that game as i’ve been the only person involved in the development of that game since the beginning and until the day it was submitted. A lot of things have happened, some good and some others even better personally, but it hasn’t been a piece of cake. I will ask one or two people if i’m allowed to talk about XW.

I’ve been interviewed!

The folks at fasebeta interviewed me just to know my impressions about the industry, gaming and such. You can read it here (it’s in spanish only tho)


At home I’m an ubuntu/Mac OS user, all well known linux/bsd systems :) They’re stable, they’re reliable and, unlucky, they don’t have too many games (well, a bit better on osx).

Anyway, for several reasons i decided install win7 on my machine (one of them being that my desktop computer isn’t able to virtualize properly and windows goes extremely slow :( ). Yesterday I took my windows 7 and started to install it, fast, easy and didn’t have to install any driver! :) That’s good, isn’t it?, like in ubuntu, my desktop was working properly from the begining. Well, some drawbacks, as always it destroyed my MBR so ubuntu was unaccessible :)

Well, I let it that way and this morning I started to download some applications, nothing fancy, ext2fsd for accessing my EXT3 disks from windows, clementine, chrome and itunes and… surprise! When importing my music to itunes I got a BSOD :( It took less than 2 hours of not so intensive use to get a BSOD. And people stills wonders why I use stable systems :)

Porting to mac

I’ve started coding again, a bit, not too much :).
Currently I have the engine working on linux but as my primary computer is now a macbook pro I will port it to mac, but this time using cocoa and all that stuff, that way i’ll learn a but about it.
In fact i had it compiling on mac without problems but linking was another issue. SDL overrides de main method and seems that macos didn’t like that adn you had to do some tricks here and there to make it work. As i didn’t like that I just decided to go to a more platform dependant solution. This way I learn more and at the same time i make all my code more platform independent.

Status Update… or what happens when you start pulling the thread

Ok, I know, I said I would implement sound, and I swear I started, but I can explain what happened and why I’m still without sound.

For each kind of data (i.e textures, materials, loaders, etc) I had a manager. Each manager was a singleton, and after coding the Sound manager I said “Dude! I have tons of singletons, it’s time to change that!”. And that’s what I’ve been doing. I’ve centralized managers, factories and containers under the Engine’s hood. To ensure there’s only one instance of each manager I’ve tangled a bit managers and engine :). It’s something like this:
An excerpt of IManager’s code

class IManager
IManager(int type, Engine* e); //Constructor
virtual int GetType() = 0; //some RTTI
// Adds the manager to the engine
IManager::IManager(int type, Engine * e)

An excerpt of Sound Manager’s code

class SoundManager : public IManager
explicit SoundManager(Engine* e); //Constructor...
virtual int GetType() { return MGRT_SOUND;}
// Adds the manager to the engine
SoundManager::SoundManager(int type, Engine * e) : IManager(GetType(),e)

So as you can see, it’s engine (called from IManager::IManager who decides what to do with the manager’s instance). In my case I stored it in an array.

So once I had all managers de-singletonized (?) I thought:”mmm, I’m not sharing data”. Yes believe it or not, I was loading models, animations and textures as many times as they appeared in the data files. So well, just some more coding following the same schema I had used for managers and well, at the end of the night I was sharing data correctly.
And this morning… I’ve woken up thinking “Ok Toni, so you’re sharing data but, do you know how much memory is your application consuming?”. At Insideo, shash had coded a memory checker, and I’ve thought that doing something similar I could know, at runtime and with a per frame granularity, what was the ammount of memory I was using.
I’ve searched on the internet and I’ve found 2 sources one at flipcode (RIP) and another at CodeProject. I have adapted to my needs and at the end of the day I was tracking the memory consumption…
To my surprise my application was a RAM eater monster :| just loading de imp animation and it was taken as much as 78 MB! WTF!!

78 MB!! The RAM eater monster attacks!

78 MB!! The RAM eater monster attacks!

The first think I’ve thought has been: “textures, probably I don’t release the texture data”. So I’ve checked it, and indeed, I wasn’t releasing it. I fixed it but as I expected I didn’t had a big gain, after all currently I’m only loading 5 textures :).

75 MB the RAM eater monster is on diet! :D

75 MB the RAM eater monster is on diet! :D

So… I’ve been thinking… where do I have tons of data and it’s not released? Where? Where? Obviously it was on the loaders, so I just simply added a Reset method to all loaders, call it after loading and that’s it! :)… And you can be wondering :” And where were those dozens of MB?”. Well, the md5 material loader was keeping a table with a translation from material name to material file and some other info. And that table was consuming 70 MB!!

5MB ! The Ram Eater monster is now thin like a ballet dancer!! :D

5MB ! The Ram Eater monster is now thin like a ballet dancer!! :D

Well, now I have the Ram under control, and I suppose now it’s the momment for sound. The journey of this 2 last days has been interesting, reallocating some classes and studing how to keep track of memory has taught me some good things I didn’t know about memory allocation and new and delete operator overriding :). Probably this will evolve in a near future to some kind of memory allocation manager and custom allocators and all this stuff I’m willing to learn :).

Well, it has been a good weekend, stay tuned!!

Status update

Two status update on the same day? GOSH I’m crazy! The world is ending! Penitenciagite! :P

I’ve just followed shash’s advice and implemented frame interpolation. Obviously it didn’t work the first time I tried, but the second. As always I’ve recorded the progress so you can enjoy and laugh.

Implementing frame interpolation was really easy but if your interpolation value is greater than 1.0 you get things like this

[youtube iVWGw1P0YGA nolink]

Once I changed that i got a nice interpolated animation

[youtube Oj9xDFYEy9M nolink]

And now, once this is completed… it’s time for sound!

Stay tuned!!