Sunday, March 10, 2024

Gob3D

There are some items in the school zone that would better be done with 3D objects. This is not quite new, but if I intend to have them in Dreamlands, likely it is time to consider them more seriously. At least, to identify the questions to be addressed.

  • How do we define hitboxes for a rotating 3D object ?
  • How do we define events that trigger when a given angle is reached ? (e.g. for state machine transition)

Je me suis laissé quelques petites notes pour quand il sera temps d'essayer de faire des objets 3D un peu plus ambitieux que les élastiques de SpongeBop pour Dreamland. Notamment des livres qui tombent et des lattes qui tournent ... Chacun d'eux ouvrant la porte à au moins tout un niveau dans mon carnet bleu.

Il faudra que je trouve le bon moyen de lier des zones de collisions aux objets 3D, pour commencer. Puis il faudra que je vérifie que j'ai bien compris comment marchaient les "display lists" pour la NDS ... Et accessoirement, faire une petite estimation du nombre "d'écrans" que compterait la school zone de DreamLands avec et sans les objets 3D, vu que pour la green zone, je suis déjà bon avec 2 niveaux ancestraux :-P

For the objects being considered here, it might be enough if rotations always happen around the origin of the model. A smashing book always rotates around its bottom line (X position irrelevant). A bridge book, around the middle of its bottom line (Z position irrelevant). A ruler bridge around its center of mass (Y position of the origin irrelevant). Sure, this does not capture all the possible things you might want to do with a 3D object in a 2D game, but it seems to be a sufficient start to me.

Now, last time I toyed with the idea of doing more than ropes in 3D, I ended up with the issue that anything that isn't hard-coded would have to use "glCallList", but I couldn't figure out how that would work. At last, I studied the registers used to control the 3D geometry engine (which turn out to match the gl* function almost 1:1) and noted that there are "command identifiers" associated with every 3D register. A call list is essentially a set of values to be written to GFX_FIFO. Writing to GFX_BEGIN (in order to implement glBegin) would be replaced by writing the command identifier for "begin vertex list", etc.

I could use a tool to craft these and adjust their parameters so that things look properly shaped.

edit: avec le "niveau de Rémi" et le niveau-anniversaire, je suis déjà à 36 écrans (contre 30 pour le 2eme monde de Kirby's Dreamland). Il y a au mieux 6 écrans à prendre dans le niveau avec tous les livres qui tombent et 2 à 3 fois autant à aller chercher dans les niveaux sans ces livres (mais avec quand-même quelque chose comme des lattes qui tournent et des bookmarks qui pendent). Je dirais que le plus raisonnable, c'est de garder les livres-3D pour un autre jeu.

No comments: