I think I need to rewrite Animate... can it be salvaged?

Custom models, custom animations, skinned meshes…

All of my animations work right now. None of the default animations are applicable. I currently have code that overwrites the animations in Animate with my own, while otherwise leaving the script in tact. This was fine for the player. For NPCs, something else is going on.

  • The weighting makes no sense. The “look left” animation fires a lot, while only having a 10% weight. The animation is not on loop, the Animate script is just not very random.
  • Critical error! For some reason, the idle animations only run a few seconds. Then, one after another, every NPC stops moving altogether. This does not happen to the player, who happily bobs up and down for hours.

I’ve tried removing all the unusable animations, but the Animate script breaks. It isn’t reasonable to fix it, as hard coded animations for a rat won’t work for a horse. I think I have to get rid of it and start over.

What do you think when watching the video? Can Animate be saved? Should I go ahead and rewrite the whole system for my player characters as well, given that they don’t use default animations either? My hacky solution is still hacky.


So, I battled the 800 line monster script Animate and emerged, I think, the victor. Instead of putting this code in every npc and every player, I made a 140ish line code that handles all npcs at once, and a 90 line script that handles the player animations.

The war was not without casualties. My previous 150 lines of animation code is still embedded in every other script. I still need it for combat, so I have to bring it back online immediately. Also, old storage methods must be rebuilt, and all animations must be cleaned up for the newer, better game engine.

A brief first victory, when I was able to first manage core, idle, and movement animations without Animate script.

180 rats, all animated simultaneously by 1 script, with all animations still playing 10 minutes later.