Generazione procedurale 2D in Javascript

Fuori si sta per scatenare il primo temporale del mese, con mia immensa soddisfazione, e nel frattempo me ne sto chiuso qua dentro, col ventilatore a palla e il gatto che lo guarda tra il curioso e l’impaurito. Pronto a raccontare qualcosa del nuovo passo compiuto sul cammino della generazione procedurale.

Ho già accennato qualcosa sull’argomento, che è molto vasto e complesso, e del quale vi lascio la definizione di Wikipedia: In computer graphics, procedural generation is generating content algorithmically rather than manually. In video games this means graphic content for a game can be created by the host computer, instead of prerendered artwork being included with game package.
Quindi, generazione di contenuti tramite un algoritmo e non pescandoli da un lavoro fatto in precedenza.

Cosa si genera in maniera procedurale? Qualsiasi cosa, o quasi. Abbiamo ormai sempre più spesso esempi di videogame con contenuti di questo tipo, ma ad esempio per le texture (i “motivi” che ricoprono oggetti nei giochi, dando loro un maggior realismo, spaziando dal terreno alle case, dalle foglie degli alberi a fumo e fiamme) questo è un metodo in uso già da molti anni.
In questo caso il vantaggio è ovvio, a fronte di una maggiore potenza di calcolo richiesta, non si devono memorizzare le texture che verranno visualizzate nel gioco.

Continua…

Javascript A* pathfinding demo

A new post in the english side of “The shaman’s lair”, after more than a year. I’ve been caged by real life problems, and the effort of writing in english was too much to me. Now that things seem to come to a more stable way it’s my intention to try again. Short posts, mainly about my works as a programmer but with focus on my side projects.

Today is the time to speak of a short Javascript implementation, coded in my spare time to learn something about the language and to make a first step into roguelikes game system. To be clear, I’m not starting a new roguelike. But there are lot of interesting things to be learned in that world, and learning while playing is a the best way, for everything.

Well, the first step I’ve made has been to write a procedural generation code with the target to build random cavelike structures, and it works fine for me. I’ve called it Caves and Creatures, you could guess why 🙂
Continua…