Friday, May 24, 2013
Summary
I guess I got pretty backed up on code-ripping during the weeks leading up to LTP, since I couldn't afford to make major changes. Now that we're passed that, though, the rush of urges to tear things apart and cleanse them is hitting me full-force, as it did yesterday, and as it continued to do today.
From time to time, I take a moment to ask myself what I would do differently if I could start over from scratch. Thanks to my profound love for destroying things and replacing them with shinier things, the answer is usually fairly short. I'm very happy with a lot of the engine's architecture. Perhaps the most consistent answer that comes to mind, however, is the way that I structured the scene graph (the structure that keeps track of all of the game objects). I opted for a flat graph - all objects within a "context" (context being a container of sorts: a system, the interior of a space station, the surface of a planet, etc.) are treated as equals. It was one of the first pieces of code I had to write, because it's so central to the engine. And I know now that it was the wrong choice. I should have gone with a hierarchical scene graph. At the time, my reasoning was that the conceptual clarity of having every object on the same level would win out in the end. But I have come to understand that both the simulation and rendering of the scene would be more elegant under a hierarchical solution. For example, currently, a weapon that's mounted to a ship is considered to be an object just like any other within a system. Naturally, there is a special relationship between the ship and the weapon that ensures that the weapon stays "attached," but they're still considered to be objects within the system. A better way would be for the weapon to be considered "in" the ship, and not in the system. The ship would be in the system, and the weapon in the ship. It would solve problems with far more clarity. I'm sure this is how most engines do it (hence the "graph" part of scene graph...), but hey, I was bound to make a few rookie mistakes, especially in the very beginning when I barely knew what 2+2 was
Anyway, the reason I bring it up is that the issue has been bothering me even more than usual lately. As I prepare to transition from local to global simulation, I am finding more and more that the flat scene graph is very unnatural when you start to consider the broader scope - like the region. In a hierarchical scene graph, a system would have the exact same relation to a region that a weapon has to its ship. Elegant. But with a flat scene graph, everything is a "special case." A system is the primary container, but at the same time is contained in a special way by a region, a weapon is contained in a system but has a special logical relationship to the ship to which it is attached, etc. Not elegant. If you follow the logs, you know that the phrase "not elegant" is pretty much a death sentence for any piece of the engine
After it's been deemed less-than-optimally-elegant, it's only a matter of time before the executioner comes in.
Unfortunately, this particular thing is rooted so deeply within the engine that execution will not be as clean as usual. I will need to carefully prepare my team, study the layout of the target area, know where the shadows and security cameras are. We will need heavy weaponry but light feet. It will not be an operation for the faint of heart
Today I began planning out this operation. I've made a bunch of changes already to clean up the way the scene works. It's just a preliminary step in this operation, but now that I have started down this path, it is only a matter of time before we strike
In slightly-less-technical news, I started implementing the jump gate graphics today, and ended up doing some pretty neat stuff with it. Looking good. I'll bet you can guess what kind of math I used
Hour Tally
Coding: 5.80
Internet: 2.06
Logistics: 0.58
Testing: 0.44
Thinking: 2.57
Total Logged Time: 11.44