Taking it all apart

It’s one of those things I love: You start with a simple premise, in my case “let’s reduce the amount of synchroonous loading in Anarchy Online”, and end up with weeks of work. The reason: tentacles.

A lot of AO code doesn’t like when you load a mesh asynchronously, so especially when new characters get into your vicinity, their meshes are loaded in the same frame (well, not exactly true, there’s some throttling). This is mostly because the animation code really hates not having a mesh, but also the special effects code and some other bits and bobs. While looking at that, I noticed that in other places, people don’t use the asynchronous resource-loading thread, mostly because it is hard to use, and got added as an afterthought. It was clearly time for some refactoring.

So I started not with more synchronous loading, but with changes to the Resource Loader itself. The first test I made gave 25% faster loading times for synchronous loading, so even with no change to the rest of the system, I would increase framerate for those laggy you-entered-a-new-zone moments.

So I rewrote that, and also changed the API. This is where the trouble started. Changing the Resource Loader API meant chnging a lot of classes that were inheriting from the Callback class to using a separate callback class (which lets me then also load objects that did not previously inherit from that class go through the Loader. I’d need a diagram to explain this properly). So suddenly, nothing compiled, and I was in the middle of rewriting those classes when I decided that the callback mechanism was a bad design in the first place, and that I rather wanted to use ACE_Future objects and cleer notification. Around this point, I also decided to make meshes load _only_ asynchronous from now on, because the ACE_Future objects will allow me to make the transition between now and fully async loading as smooth as I want it – well, or so I hope. I haven’t even started fixing the mesh class.

And if you go through that much code, you see all those things that are bugged. Dangling pointers, bad design, inefficiencies. And I just can’t let those be, so I end up taking a detour of one, two hours to fix some smaller thing. It spreads. And now it’s the weekend, and I can’t tear myself away from the machine, although I have no hope of getting this stuff to work any time in the near future…

I love my job 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.