jeudi 18 novembre 2010

Des vaisseaux par millions par Dave Bollinger

Dave Bollinger (site) a codé un générateur automatiques de vaisseaux: 2-bits, 8-bits, 12x12 pixels, grâce au logiciel Processing. Très intéressant si on veut une flottille nombreuse en évitant de perdre du temps dans les graphismes.
Ainsi en manipulant le code (le code source est disponible: avis aux programmeurs...) je suis certain qu'on pourrait ainsi fabriquer des millions de vaisseaux viroïdes ou impériaux!! La méthode de ces pixel spaceships est aussi expliquée succinctement, et elle ne paraît pas excessivement complexe!
The spaceships are generated within a grid of cells that is 12 columns wide by 12 rows tall. Each cell may be either on (black) or off (white). Without any further constraints this would allow for 2^144 combinations - a monstrously ridiculously impossibly huge number.
Unfortunately, most of those combinations are not "interesting" in the context of this project. So the cells are constrained in several ways to limit the total number of combinations while focusing in on those that produce interesting spaceship shapes.
The first constraint imposed is that the cells must be horizontally symetrical. This reduces the effective grid size to 6x12 cells, reducing the number of combinations to 2^72, which is still impossibly huge.
Pixel Spaceships Algorithm
The second constraint imposed comes about after flipping the problem on it's head. Instead of asking which cells to turn on in order to create spaceship shapes (which is a non-trivial problem) the question becomes which cells to avoid turning on because they constitute the "interior" of the ship. Then once the interior is defined, simply draw an outline around it, thus producing the desired spaceship-like shapes.
In the end, 32 cells are directly controlled, allowing 2^32, about 4 billion, unique spaceships. A single 32-bit number is used to control the shape of the spaceship, with 26 bits controlling the main body portion, and the remaining 6 bits controlling the cockpit area.
En variant les tailles, on pourrait aboutir à un résultat bluffant, et en me creusant un peu la tête, je pourrais coder un programme similaire sous gamemaker... si j'avais un peu de temps! Et voici rapidement, ce que donnerait une de ces génération façon gameboy... des dizaines de vaisseaux en quelques secondes!

Un dernier exemple de Dave Bollinger pour des sprites plus élaborés, qui montre bien que même généré par ordinateur, chaque sprite a sa personnalité, est unique!



MAJ (11 mars 2014): Yuigoto a réalisé un remake sous GameMaker, à trouver sur Github.

3 commentaires:

  1. Ou peut on télécharger se logiciel ?

    RépondreSupprimer
    Réponses
    1. Aucune idée: il semblerait que le site de Bollinger ne soit plus à jour, et son logiciel disparu... dommage :(
      Mais je pense qu'un petit utilitaire du même genre peut être aisément émulé sous GameMaker/GMS/Contruct2/etc.

      Supprimer
    2. J'ai mis à jour l'article avec les nouveaux bon liens.

      Supprimer