Month: August 2008

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:

currentNode = findNodeClosestTo( P );
targetNode = findNodeClosestTo( Q );
walkTo( getNodePosition( currentNode ));
while( currentNode != targetNode )
{
    nextNode = getNextNode( currentNode, targetNode );
    walkTo( getNodePosition( nextNode ));
    currentNode = nextNode;
}
walkTo( Q );

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:

// breadcrumb 0 is the current character position,
// 1 is the most recent and so on
breadcrumb = getBreadCrumb( Lara, 0 );
// find the most recent breadcrumb you can walk to
i=0;
while( !canWalkTo( breadcrumb ) && i < MAX_BREADCRUMB)
{
    ++i;
    breadcrumb = getBreadCrumb( Lara, i );
}
if( i==MAX_BREADCRUMB )
{
    // give up
}
// now just follows the trail
while( i >= 0 && ! canWalkTo( Lara ))
{
    walkTo( getBreadCrumb( Lara, i ));
    --i;
}
if( i > 0 )
{
    walkTo( Lara );
}

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 to 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 – Rogue Spear and write, test and debug the whole game in three-four months.

Continue reading “Tomb Raider – the prophecy”

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.