Tuesday, October 18, 2011


So I finally started a new SVN branch with the collision engine modification that I sketched in the train. It's not going to be testable anytime soon, I'm afraid. The current collision engine was already abusing some "setContext(...)" calls to set static variables into GobExpression so that you can e.g. shoot things despites the eval() has no such thing in its argument. With the new "attach" and "align" features I want to develop, that becomes a huge mess of things to capture at various places in the GOB -> GOB -> area -> state -> expression call chain that happens at every collision. I bet the best move will be to extract all this context (including some of the things that are currently plain arguments) into a GobCollision structure which would have temporary lifetime (i.e. allocated on the stack) that would be passed around ...

Well, that'd be better unless the compiler is able to keep all the arguments in registers otherwise :P

Je dirais bien "assez causé, implémentons ces fameuses nouvelles collisions". Sauf qu'en fait non. Les petites modif' faites par-ci par-là dans le Boutdlard Express ne compilent pas, et si je fais ce qu'il faut pour qu'elles compilent, ça va être une véritable pagaille dans le code. Genre "la famille araignée en vacances dans une boites de spaghetti géante", voyez? J'ai une petite idée pour rationaliser tout ça sans perdre en souplesse ni (trop?) en performance. Je vous en dis plus après avoir fait le test.


PypeBros said...

one GameObject::align(ALIGN_OP, GameObject &other) additional method should be enough to capture all the attach / position alteration that cannot be done in GobExpression alone (because it doesn't limit to manipulating the data[] array, which is what GobExpression can do :P)

PypeBros said...

I'll use a "nested" structures approach: when a passive Gob process its expressions, collision[0] holds information related to the passive gob and collision[1] related to the active gob. That way, we can still handle "regular" expressions (non-collision) transparently (hopefully).