Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Level animations are duplicated on build #75

Open
mwpenny opened this issue May 31, 2024 · 0 comments
Open

Level animations are duplicated on build #75

mwpenny opened this issue May 31, 2024 · 0 comments
Labels
bug Something isn't working building Issues and pull requests related to building the code

Comments

@mwpenny
Copy link
Owner

mwpenny commented May 31, 2024

Version of the game

Latest (f35bf3d)

Original Hardware or Emulator?

N/A

What is the bug?

When a level is built, for each armature in the level (@anim level object), data is generated for all of its animations.

For example, in build/assets/test_chambers/test_chamber_09_geo.c, the exit_piston armature has an array of SKAnimationClips named test_chamber_09_test_chamber_09_exit_piston_clips. In this array there is an entry for its piston_move_down animation, which contains a pointer to the actual frame data stored in build/assets/test_chambers/test_chamber_09_anim.c.

However, the exit_piston clips array also contains entries for the pit_0_down and pit_1_down animations, which are only used by the pit_0 and pit_1 armatures:

struct SKAnimationClip test_chamber_09_test_chamber_09_exit_piston_clips[] = {
    {
        .fps = 30,
        .frames = &test_chamber_09_test_chamber_09__anim_exit_piston_sound_type_Piston_piston_move_down_frames[0],
        .nBones = 1,
        .nFrames = 144,
    },
    {
        .fps = 30,
        .frames = &test_chamber_09_test_chamber_09__anim_exit_piston_sound_type_Piston_pit_0_down_frames[0],
        .nBones = 1,
        .nFrames = 72,
    },
    {
        .fps = 30,
        .frames = &test_chamber_09_test_chamber_09__anim_exit_piston_sound_type_Piston_pit_1_down_frames[0],
        .nBones = 1,
        .nFrames = 72,
    },
};

and there are copies of the animation data in the _anim.c file. This is not limited to chamber 14. This duplicated data is unused and bloats the ROM size. It is not very impactful now, but could be for future levels with more large/complex animations (such as in chamber 15; #39). In general it is also just good practice to avoid waste like this.

Interestingly, animations for Blender armatures (such stairs_ascend and stairs_descend in chamber 14) do not get duplicated. This could mean the problem stems from the way animations are defined in the .blend files.

Steps to reproduce the behavior:

  1. Build the game
  2. Open the _geo.c and _anim.c files for a level which contains animations (such as chamber 14)
  3. Observe the duplication described above
@mwpenny mwpenny added bug Something isn't working building Issues and pull requests related to building the code labels May 31, 2024
@mwpenny mwpenny changed the title Level animations are duplicated for all armatures Level animations are duplicated May 31, 2024
@mwpenny mwpenny changed the title Level animations are duplicated Level animations are duplicated on build May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working building Issues and pull requests related to building the code
Projects
None yet
Development

No branches or pull requests

1 participant