I've been refactoring again, and by now you'll probably be thinking "This guy really likes redoing stuff he's already done, what about new/cool stuff?"
Well, as much as I do enjoy the fruits of my refactoring endeavours - refactoring ain't all fun! You have to take something that works and break it good and proper, 99% of the time nothing works afterwards until you've fixed it all up again. That can be a daunting task, and often leads to thoughts of "Why did I do this? It'll take ages to fix this back up..."
In this instance, the recent work on Scene Paging led me to think of a tidier way to handle objects as they ingress/egress the various scenes. That then lead on to tidying up the 'huge' logic blocks that get invoked per object as they ingress/egress. For instance, a vessel has to say 'ok, i'm in the local scene now, so I need a model to render, weapons on the model, loads of assets, a presence in the scene, shields, etc. etc. etc.'. Then when it leaves, it has to say 'Ok, done with this lot!' and then detach them, get rid of everything it created when entering the scene. It has to do this nicely, so if another vessel enters the local scene, it can efficiently recycle any/all of this stuff to avoid recreating objects all the while, as that really fragments memory, and takes time, so results in a performance hit.
So, after a week of coding, Dom looks no different, but the engine code is a lot tidier and far easier to debug. And trust me when I say "That's a good thing"! Also, as and when anyone out there gets to be able to Mod this beast, they will be much happier I did this.
All this work on the Scene system is very important. It's the core of the entire game engine system, and allows me to portray a scene from anywhere in the game universe and isn't dependent on any preset concerns, like the players position. Why? you may well ask...
1) Observers. Observers (if you haven't read Insurmountable Odds, why not? ) are weeny punctures in space-time that allow you to observe anything through them, a bit like a wormhole. A vessel equipped with Observers can drop or project these handy little doobries anywhere they like, and then keep an eye on things from the other side of the Cluster if they so choose. Their use is limited though - the power drain is huge, and they decay over time, but they are excellent for short term surveillance. (Like watching a station for a vessel departure, whilst lurking behind an asteroid on it's route waiting to ambush it...)
2) Wormholes. Whether from a constructed gate-station, or generated by a Wormhole Drive, these much larger spherical punctures in space-time will show you the volume of space on the other side of the wormhole at the terminus point. From any angle. Likewise, once you've transited the wormhole, you can still see the scene of your departure point until the wormhole closes.
So, to support those two systems, I have to be able to instantiate an entire scene at a specific point in space, at any time, so they can be rendered along with the scene from your current location. I can't wait to actually get to implement this