101000

Tomorrow I’m going to turn 0x28. Undoubtedly it sounds better in hexadecimal than it does in decimal. And much more better than the “left-banana” if you happen to count in ASCII. Well, Xtè, right yesterday, let me note that nothing has changed in the Italian videogames industry in the last 10 years. There are still the same bunch of players. After Ubisoft no foreign company dared to set up a development studio in any part of our land. There are still two major players in Milan, still of the same size, and some minor players around the whole territory struggling to stay alive under the load of work and the inability to find skilled professionals at a price they can afford (or they are willing to pay).
I’m not sure if Xtè is completely right, maybe today we have some studio less than 10 years ago.
Those are sad considerations when talking about an industry that requires low setup costs, that shows no sign of crisis and is a well established part of the economy in most of the industrialized world. Investments in videogames industry are just risky. How much risky? Although young, this industry (as such) is only ten years younger than me. It has much road to go, but over the years “Things to Do” and “Things not to Do” have started emerging. As of today, I think that we learned to distinguish what is risky from what is not so risky. Porting is likely the safest activity in this field, followed by time to market titles. While the riskiest activity is the development of innovative and original IP. Most of the startups fail because they aim for the stars, trying to replicate the success of great games, developing new technologies, leaving free hands to the creative part of the studio.
You may wonder why I have this fixation with videogames. First I think it is part of my nature, maybe due to the fact that I met computer when I was 0xE i.e. an age very game-oriented. Maybe because to me programming is a sort of Lego-playing and therefore writing programs to play with is a natural consequence of this.
On the other side, it seems that I reached my top, from a professional point of view, when I worked in the videogame industry. The largest programs I designed, the largest team I led, the most entertaining problems I had to solve, many of the most skilled people I worked with… all happened back at the Ubi days.
Thinking about it, seems natural to me that a technologically advanced field, where many different disciplines are involved tends to attract the brightest offering them the most interesting problems.
I hate myself when I start complaining, so it is time to come out with a strategy for the future…. if I’m going to work on it in my spare time it’ll be ready and sound for my retirement (that, as I live in Italy, will never happen).

Finding the Right Path

After yesterday’s post, PaoloMan reminded me about how he and Piggi changed the CEngine pathfinding system simplifying the level design by at least an order of magnitude. In fact I had the intention of writing about their bread crumb pathfinding algorithm, but the good will got lost in some interruption of my editing. Anyway the matter is interesting and would be a pity to settle this matter with few lines embedded in another topic, so I am happy that my subattentive mind left out this yesterday.


In the beginning it was [http://www.maxpagani.org/CV-projectDesc-RS.html|Rainbow Six: Rogue Spear]. This was the first game of the studio on the then new GameBoy Advance platform with the quite ambitious goal of recreating the playing experience of the PC version of the game.
Pathfinding was needed for a number of actions of non-playing characters. Terrorists had to be able to find their way toward noises they heard, or to the last known position of their pals. Counter-terrorists had to manage to stay together following the player controller team leader.
A full A* algorithm would have been likely to be daunting on the poor ARM 7, so I devised a lighter system for all these pathfinding needs (well the idea was mine, but later I discovered it was already employed by other game engines). The idea was to define a routing network of nodes connected by straightly “walkable” rails. When a character needed to go from its actual position P to a remote position Q it queried the pathfinding system for the routing node closest to its position P. Then it asked the node for the next node in the network in order to get close to Q. In overly-simplified pseudo code it would turn out like this:

Although the gameboy side of the algorithm was simple (even with extra code for a more realistic behaviour of characters) and fast (provided a way to quickly find the nearest node you can walk to) two non trivial problems had to be solved on the editor side.
First – networks had to be hand drawn on each map and – second – routing tables had to be computed for each node.
The reason for requiring manual work to draw networks was simply because we didn’t have enough programmer time to put the right amount of AI in the editors. One of the constraints of the project was the maximum reuse of GameBoy Color editors and tools we developed for [http://www.maxpagani.org/CV-projectDesc-RM.html|Rayman GBC] and minimally improved over the next two GBC platform games. This meant that editors didn’t understand the 3rd dimension.
So level designers had to hand draw the network taking care of connecting nodes with walkable line, trying to be very careful when more than one terrain level was involved. Also it wasn’t easy to test and debug the network. First you had to flash the game on a GBA and play it. A quick play throughout the level could not show any flaw even with a flawed network.
A properly designed routing network affected how realistic would be the movement of the characters, so networks were subject to several fine tunings.
Routing tables creation was not that hard, but the “easy way” my fellow programmers took first involved several hours of number crunching on the editor PCs. Level designers were quite mad at us for this daunting weight.
Lear produced a new and much more efficient construction algorithm, trimming down the network computation to a bunch of seconds.
But we were talking about Lara and the prophecy. Well it was clear that laying out routing networks was a big problem, luckily the AI needs for this game were quite modest. The pathfinding would have been employed for enemies to chase the playing character only after a walkable contact have been established.
PaoloMan and Piggi came out with a clever mechanism that allowed us to get rid of pathfinding networks and the related burden. The idea was to have the main character to drop virtual (and invisible on screen) breadcrumbs. When the chasing enemy loses direct sight of Lara (maybe she just turned around a corner), he can search the most recently dropped crumb for walkable way. If the most recent is not accessible, then he should go backward in time until he find a suitable one. It is like the main character defines a subset of a routing network just for the area where she is.
Talking about pseudocode, this approach would be something like:

What I find notable is that, when working with games, standard solution to known problems (e.g. the A* for pathfinding) could be overwhelming or too daunting both to implement, to run and to manage. Having a clear vision of the needs of the game can point you to a proper, more efficient and simpler solution for the problem.

Tomb Raider – the prophecy

PaoloMan sent me a link of a video review of Tomb Raider – the prophecy the game we developed some years ago when I worked at UbiStudios. The development was quite a challenge – we have to reuse as much as possible from the previous game – [CV-projectDesc-RS.html|Rogue Spear] and write, test and debug the whole game in three-four months.
With [CV-projectDesc-RS.html|Rogue Spear] we had developed a pretty robust engine for isometric view able to handle a couple of terrain levels – the CEngine. On the constrained hardware of the GameBoy Advance, the CEngine happily performed line of sight and line of fire tests, room occlusion, automatic generation of level maps, pathfinding, managed an impressive number of enemies on the whole level and provided reliable support for multiplayer game.
When I was informed that the studio was going to develop this game and that I would have been the lead programmer most of the decisions about the kind of game we were going to make were already taken, but, they assured me, it is as close as possible to the previous [CV-projectDesc-RS.html|Rogue Spear] game.
Good I thought. Unfortunately the old saying about a non-programmer pretending that two systems are the same meaning that they do not differ more than 50% held in that occasion too.
In fact the game had to preserve the Tomb Raider key game plays: jumps, vertical vertigo effects, puzzles and extinction of animals. Jumps was something unheard in a military simulation game such as [CV-projectDesc-RS.html|Rogue Spear] and the vertigo effect was hard if not plainly impossible to achieve with just two levels of terrain. Editors and tools were the same of the GameBoy Color games we did, i.e. 2D platformers without any notion of elevation. They already posed a number of headaches with the quite-flat world of [CV-projectDesc-RS.html|Rogue Spear], I wasn’t willing to think what could happen with tens of levels.
Puzzles was another head-scraping aspect of the game. I knew that every factor of the gameplay was going to be refined, modified and touched an uncountable number of times before the Gold Master, and I didn’t want a programmer to be dedicated to change and modify code to this purpouse.
Cut scenes were also required and the camera needed to move around, far from the main character, to show the effect of various switches and devices or the goal of the level.
Another problem was posed by the animation system. The CEngine animation system suffered from the [http://www.maxpagani.org/CV-projectDesc-RM.html|Rayman] modular animation. In Rayman many animations were performed just by moving fixed shapes around. This approach was intended to save space and Rayman character itself was designed around this idea, but it is ineffective at most when you have to animate life-like characters. Lara had an impressive number of actions that really stretched the limits of the poor handheld system.
How we made it was a successful combination of hammering, ingenuity, compromise.
The CEngine proved to be well designed and well coded with good insulation between layers of game related abstraction levels. My fellow programmers were top notch and brightly solved a number of problems. Artists and Game Designers were great to understand technical problems and helped us in finding suitable compromises. And we managed to get the game throughout the whole process in three months and half.
How we did it?
About the number of levels we changed the physical property encoding of the terrain. CEngine provides a single byte to encode the physical property of each 8×8 pixels square. Such properties defines whether the place is dangerous to the main character or a solid wall or a plain, walkable terrain.
In [CV-projectDesc-RS.html|Rogue Spear] three bits were allocated to sound properties leaving just 5 bits for the rest. 8 elevation levels allowed to define two floors and the connecting stairs/slopes. Also the slopes needed to be both vertical and horizontal to accommodate for climbing and descending both ways. This allocation leaves pretty no space for more levels.
Well but if Lara Croft can jump why do we need slopes? So here we get back our slopes code allowing for 10 different heights, enough for the vertigo effect.
Nonetheless it was impossible to design such maps with the old 2D editors. Luckily [http://www.maxpagani.org/CV-projectDesc-TM.html|another GBA game we were working on] at the same time needed a better editor so the management decided we had enough “needs” for a new editor. Alberto worked on the editor for about one month and something accomplishing a remarkable result before game designers actually started designing maps and levels.
Another bright programmer, Valentino, worked on the puzzle system. Rather than hand coding each puzzle as a specific C code, he defined a set of devices that could be connected in many different ways to provide enough flexibility to implement any kind of puzzle. At the end the mechanism proved to be still too complex for non-programmers, but he managed to implement and maintain the whole system alone with minimum effort.
Cut scenes were a major problem – we didn’t have the resources for developing a cut scene authoring editor, nor we could afford movies in the game for cartridge space constraints. We came out with a simple idea that turned out to be a nightmare to use. The simple idea was to have a dummy character able to play any animation, then for each character in the cut scene a path had to be drawn where each node contained both timing and animation code.
Although the idea was simple, creating cut scenes this way was a burden. Synchronization among characters was impossible, modifying an existing sequence was a painful operation. At the end the producer Nicola went through all the cut scenes fixing and sometimes recreating from scratch all these meaningless number tables.
The number of Lara action posed another problem. Design document asked for some 40 basic actions to be performed in all the 4 available facings (left, right, up, down). Moreover some of these actions could be performed both with guns drawn or not. Moreover guns automatically aims to the nearest target in discrete steps of 8 directions. Even relying on the hardware horizontal flip for some animations, the resulting number was huge. We managed to handle them all by splitting the character in half: legs and arm with chest plus head. Thanks to this trick and some twiddling in the actor code we avoided the need of writing compression/decompression code for animations.
Given all that, the fact that the lead game designer resigned in the middle of the project, the fact that a change in the Eidos management near the Gold Master forced us to rework a number of license issues and the other GBA game developed at the same time by the same people, I don’t hesitate to call Tomb Raider – the Prophecy a great success. Back then it won’t earn much credits to the studio since it sold much below the expectations and got several mild reviews that’s why I am happy to hear that people love it (the video reviewer score it at 10/10).

Lessico familiare

Juan e Mariana parlano sempre di più l’italiano. Non hanno ancora perso l’accento bergamasco, ma… come molti amici delle alpi Orobie potranno confermare non è un grosso problema.L’esclamazione più divertente è sicuramente “uò la pepa!” condita da “urcaaaa!” se il motivo lo richiede. “Mamà” sta diventando pian piano “mamma” e allo stesso modo “papà” e “papito” stanno diventando pian piano “papa” (si, proprio così senza accento, come Ratzinger).
Se prendiamo dentro Mariana per sbaglio e le chiediamo scusa, lei pronta risponde a fil di voce: “non fa niente”. E allo stesso modo oggi ha detto “non fa niente” dopo che ha pestato il piede alla mamma.
Poi ci sono i “basta!” e gli “‘spetta!”.
Mariana ci sveglia di solito con un “Vamos a hacer colacione”, mentre Juan alla sera dice: “Vamos a hacer nanna”.

1, 2 3 STELLA!!! O comunque una versione molto personale di questo gioco, vince chi arriva per primo, nessuno ricomincia anche se si muove, ogni tanto ci si arrabbia con i compagni di gioco… poche regole, ma ben confuse. Per la seconda edizione è stato necessario addirittura un nonno-arbitro
Un sorriso spontaneo… con il solletico (ai piedi, per questo non si vede il trucco).
Adesso sì che il mondo mi sembra nel verso giusto!
La testa che si vede dietro NON è il papà.
Due cuccioli
Mariana che sorridente e serena carica una enorme pistola ad acqua.
In tema di giochi olimpici: esultanza dell’atleta dopo il lancio del frisbee
Pronti? Partenza! Era un chiste!!!
“Il frisbee è mio”, “no, è mio”, “è mio!” “mamita! Non mi vuole dare il frisbee”

Soddisfazioni…

…quando tuo figlio canticchia la sigla di Gundam senza averne mai visto i cartoni.

Non dire gatto se non l’hai nel sacco. Però se gli hai messo il didò sulla coda…
Mariana… ehm… non siamo proprio a Salsomaggiore.

PS. Abbiamo raccolto la prima parte del blog in un unico file PDF di oltre 9M. Così chi vuol leggere dall’inizio non deve andare avanti e indietro con il browser.

Hai voluto la bicicletta? E i pedali?

Da che parte iniziamo? O, come direbbe un noto presentatore, “La busta 1, la 2 o la trre?” Iniziamo dalla buona notizia: Juan oggi ha imparato ad andare in bicicletta. Si potrebbe aggiungere: così di botto, se non fosse che aveva già provato un paio di volte. Però è stato spettacolare vederlo sulla bicicletta percorrere tratti sempre più lunghi senza bisogno di sostegno fino a che è riuscito a fare tutto.
Però andiamo con ordine. Sulla bicicletta dei cugini aveva già provato ad andare, ma sempre con qualcuno di noi che gli teneva il sellino per non farlo cadere. La nonna Carla, profeticamente, diceva: “con la voglia che ha di andare in bici, in quattro e quattro otto impara sicuro”.
Ieri Ale gli ha detto: ricordati domani che ti facciamo vedere la tua bicicletta (ereditata da un cugino appunto e senza pedali). E lui, puntuale, questa mattina ha chiesto di andare in cantina per vederla.
E’ stato però necessario partire alla ricerca dei pedali. Questo pomeriggio abbiamo visitato Auchan, Decathlon e Bossi senza successo. Tutti avevano pedali con la vite più grande. Alla fine abbiamo ripiegato su un ciclista, il mitico “Cicli Oliva” che per la modica cifra di 6€ ci ha spacciato due pedalini della giusta misura.
A casa li abbiamo montati e lui è partito subito alla volta del parcheggio, con io che correvo ansimando, sudando e, malgrado tutto, sorridendo. Il primo giro è andato bene: lo lasciavo e lui percorreva qualche metro prima che dovessi “acchiapparlo” per evitare che cadesse.
Poi è rientrato a casa della nonna chiedendo di mettere le rotelle… ecco che la sua insicurezza, l’autostima inesistente stavano per togliergli la possibilità di raggiungere questo traguardo. Per fortuna non cedo alle richieste, anzi dopo poco è lui a dire “facciamo vedere alla mamma come vado in bicicletta”.
E così, mentre la mamma ci osserva (lui in bici e io sempre dietro di corsa con la mia strisciolina di sudore alle spalle), lui “spicca il volo”, percorre prima 5, poi 10m da solo, poi fa tutto il parcheggio, riesce anche a curvare da solo… Un’apoteosi. Rientra nel cancello con un sorriso trionfale sul viso!

Incomprensioni
In uno dei mille seminari a cui siamo stati, il relatore asseriva che in un gruppo di adolescenti adottati nessuno si sentiva capito dai propri ado-genitori.
Ho sempre letto questa affermazione, almeno fino a prima dello scorso giugno, come l’impossibilità per chi non ha vissuto in prima persona da bambino l’abbandono dei propri genitori, di capire cosa vuol dire questo. L’impossibilità di capire, senza aver vissuto, questo grande vuoto come la maggior parte degli adottivi descrive questa sensazione.
Si, non lo posso capire, pensavo, però mi posso avvicinare, posso essere vicino… insomma nel mio mondo razionale anche questo aspetto era stato addomesticato e incasellato.
Da quando sono papà con Juan e Mariana il mio mondo razionale ha subito un bello scossone e tutti i cassettini si sono rovesciati. E questa cosa, dell’incomprensione, ha preso un’altra dimensione, molto più pervasiva.
Quando li guardo nei momenti in cui sono adombrati, arrabbiati, scuri e tutte le altre sfumature possibili e immaginabili, non li capisco. Non c’è niente da fare: non so cosa stanno pensando, cosa è meglio fare. Sono lì che difendo le posizioni del bravo genitore-educatore, pensando che la coerenza educativa e le regole su cui ci siamo accordati sono le cose migliori perché i nostri figli possano crescere bene e mi rendo conto che dietro il loro silenzio imbronciato si può nascondere … qualsiasi cosa. E’ un capriccio? E’ un riflesso del loro dolore? E’ il loro dolore primario? Faccio bene? Faccio male? Magari è una cosa su cui posso retrocedere per questa volta?

Di riflesso stiamo sperimentando l’incomprensione noi come genitori adottivi, nelle nostre fatiche. Probabilmente è la voglia delle persone di “tranquillizzare” o forse di “normalizzare”, ma spesso ci sentiamo dire che i nostri figli si comportano come tutti i bambini, che i nostri problemi sono quelli di tutti i genitori. Sentirci dire che il problema della lingua dopotutto ce l’hanno anche i bio-genitori con i neonati è esemplificativo di quello che voglio dire. Noi siamo ado-genitori e non abbiamo esperienze bio-genitoriale, quindi, di prima persona non possiamo dire che differenze ci siano. Però è vero anche il viceversa: i bio-genitori (quelli che abbiamo sentito) non hanno ado-esperienza. Dalla nostra abbiamo la parola degli esperti che ci dicono che l’ado-percorso ha maggiori difficoltà per tutta una serie di motivi e abbiamo anche la nostra esperienza di bio-figli e le nostre osservazioni sui figli di parenti e amici (certo sono osservazioni dall’esterno, quindi da prendere con le dovute precauzioni). E’ vero che Juan e Mariana sono bambini e come tutti i bambini hanno certi comportamenti, certe esigenze e certe reazioni, ma è anche vero che hanno una storia tragica alle spalle, e che questa storia ha lasciato dei segni e che questi segni si vedono nei comportamenti, nelle esigenze e nelle reazioni.
Non è tutto qui, c’è questa operazione di “salvataggio” della dimensione famigliare che non è affatto indolore. Strappati al proprio paese, alla famiglia sostituta, alla propria cultura catapultati con due perfetti sconosciuti, incomprensibili, per molti versi alieni. Anche questo strappo ricucito non può non emergere nei comportamenti, nelle esigenze e nelle reazioni.
Fine dello sfogo 🙂

Fino a questa mattina Juan aveva una macchinina di Lego con su due omini Lego che diceva essere Mamà e Papà. E se li portava in giro, li metteva a tavola, ieri sera li ha fatti addormentare sotto ad una coperta, li faceva baciare… Oggi avremmo voluto fotografare quest’opera, ma purtroppo non ha retto ad un malumore passeggero del suo autore.

Un grazie speciale a Nadia e Paolo che ci hanno lasciato il primo commento per Juan e Mariana, i nostri eroi.

Il bravo vasaio… c’è voluto del bello e del buono per arrivare a questo punto, ma poi si è divertito
ed una volta asciutti i vasi vanno dipinti, insieme a dita, sedie, tavolo e genitori
Ed ecco Juan poco prima del grande passo.