Bit of a boring week this past week. Lots of internal work went on but not much for new screenshots.
I started the week off by moving a lot of the code for controlling the editor camera into an EditorCameraController class. It had all been sitting in my GameRenderTask class which should have only been responsible for setting up some of the game rendering things like setting up views and other game related things but since it was one of the first things I got up and running a lot of game specific code got placed in there. That got me to thinking about a proper separation of game and editor code which led me to create a MainGameState class. I migrated all the code for player creation out of the GameRenderTask and into the MainGameState.
The next day I did was to move the SceneCollector which collects all the renderable objects out of the EditorGameState and into the GameRenderTask as it made a lot more sense to be in there. The scene collector essentially visits all the renderable sprockets as a container which allows the sprockets to fill the container with any renderable data for the scene. This container can then be batch processed for things like occlusion and frustum culling and then passed to the views. I also fixed up a little bug that was crashing my debug drawing if it was disabled, just a stupid little thing where a buffer count wasn't being reset. I then got to thinking that it would be a good idea to have a way to properly switch between my editor and my game. Up to this point they had essentially been the same thing. I decided I needed to think about this one and wait before I implemented anything. Before attempting that I needed to get my coin collection scheme working. I decided that instead of the coin delegator which I had originally started to implement that I would create a coin collector component. This idea seemed to fit better with my component based architecture.
Wednesday I managed to get the coin collector finished up. I ran into some stupidness with the compiler where it wouldn't compile some templated code unless I separated it into a couple lines. It had me bonking my head on the bus window for half my trip trying to figure out why it wouldn't compile since the code looked fine. The rest of the trip was spent cleaning up the creation codepath for my player sprocket. It was still using the old creation method which was leading to some updating issues with some of the components. I also made a small change to the rendering code and disabled the rendering of bounding boxes if an object was spawned. It was getting annoying seeing all the bounding boxes when I was trying to place down coins.
Thursday, I decided that placing coins was a pain in the ass, the reason, trying to get the coins lined up properly. I decided it was time for some settings in my editor. I repurposed the Protoform property window to work for settings as well. So the first setting to implement was snap. I already had code for snapping in the editor but it was hooked up to a constant value. So it was a pretty quick change to get snap working and it made placing the coins a lot easier. I still need to get save and load working for the settings window though. I also fixed a little bug where the UINode editor wasn't working anymore. It was just because I had changed the default behaviour of my windows to be hidden on creation, so I just needed to add a call to make the UI nodes visible. On the way home that day I implemented object deletion within the editor. Kinda crazy that I had gone this long without any kind of object deletion. I mean I had a pipeline for deleting objects, its just that there was nothing hooked up to the keyboard for deleting a selected object. So that didn't take too long to hookup just some keyboard command setup.
Friday, this was the big day for finally separating game from editor. I created a base game state which would be popped on to a thing I call the GameStateController, it's essentially a stack of game states which allows me to push and pop game states, originally conceived for things like pausing the game and being in the front end, but also works quite well for game logic. So from the base game state you can currently select 1, editor, or 2 game. Nothing fancy yet, need to get some menus or something instead of a blank screen that responds to key presses. This got me realizing that a ton of the code for loading levels and frustum culling and all that good stuff has been set up in the editor game state so I spent the rest of the day pulling things out of there and putting them into their own independent common systems so that they could be shared between the two state.