Spherical Geometry Framework (S2)

Discussion in 'Engineering & Reverse Engineering' started by qiuu, Jul 25, 2014.

  1. qiuu


    Tech Member
    Blue Ball & Blocks
    Varion asked me about the engine that was used in Sonic Boom's Gorbichev boss to have the orbs move around on Gorbi's surface.
    I stripped the boss code down to its basics, and rather than just giving it away in private I thought I might just release it publicly for those interested.

    Link: http://geoo.digibase.ca/Genesis/sphere_engine.zip
    Included are Nemesis compressed sprite graphics and mappings for the orbs ripped from S3K courtesy of Varion.

    What it does
    This framework is written as an object, it initializes a central object (that formerly was Gorbi, but now is just a static object displaying a sphere and handling all the geometry) and has orbs move around its center point on the surface of an imaginary sphere. Three sample orb pattern are provided, and the framework makes it very easy to create new orb patterns, the main point of it. The orbs also have collision with Sonic, and can be thrown off to jump around freely as individual orbs.
    An option to have orbs move on a cylinder is included too but more limited.

    I tested this with the latest version of the Sonic 2 disassembly from the repository. There are a few instances where OST offsets are still hard-coded as values which might make porting to S1/S3 a bit more annoying, but mostly equates are used. In the code file, there's a header with a lot of options and commentary on what does what. The code itself is only sparsely commented, mostly in those parts where it's not immediately obvious what the code does. Some of the code organization could be improved, but some design decisions stem from how Gorbi was coded.
    To get it up an running in S2, pick an object ID (to be set in the codefile) and an art address, place one instance of this object in some level and load the orb art for the level e.g. via a PLC.
    The framework computes the mapping frame of an orb via a lookup table depending on its z-position (depth). If you want to use your own orb art, I provided a tool to generate this lookup table. The input is the mapping frame that shall be used when an orb is right in front of the center position (when an orb appears biggest, in the code osp_min_frame_used), and the mapping frame that shall be used when an orb is right behind the center position (when an orb appears smallest, in the code osp_max_frame_used). The sizes of the orbs in the mappings file should be decreasing.

    If you want to use this in a hack, please give credit along the lines of "This uses the Spherical Geometry Framework by qiuu that was used in Sonic Boom for the boss Gorbichev, programmed by qiuu and snkenjoi.", preferrably with a link to this topic.

    If you have any further questions, feel free to ask me (if I don't respond try PM or in IRC as I only read the forums sporadically).
  2. Varion Icaria

    Varion Icaria

    He's waiting.... Tech Member
    S4: Cybernetic Outbreak
    Glad to see you share this. I'll be coming up with some interesting patterns for what I disclosed to you in private :P