Yup, another late update. I typed all this up last Sunday, but have been too tired after school each day to muster the motivation to read it over, do some editing, and actually post it. So here, have it now!
Sprint 9 Results
I finally got the room-assembly algorithm wrapped up!
With the competition retrospect, one of the things that we talked about was going into some more detail of the actual development process, rather than just saying what we got done and what we didn't, so I'm going to give that a shot. If I get too confusing, let me know, and I'll try to spend some more time writing a clear explanation for next week's update.
It's a pretty simple concept, to look at a location for a room with given dimensions and then use component parts to assemble it, but a few things I wanted to do made it more complicated. The biggest thing was converting the algorithm after having it mostly completed to change from assembling a specific wall to assembling any wall. The first version I wrote was compatible with any wall stretching along the x-axis, but to assemble a wall along the y-axis would have required creating a duplicate method and then changing almost every line of code to use y-coordinates and dimensions instead of x-coordinates, so instead I wrote a separate method that checks for the axis along which the wall runs at the very start, and then creates a bunch of weighted coordinate and dimension variables (weighted in this case meaning that the primary coordinate is in the location for the x-coordinate of a Vector2, and the secondary coordinate in the location of the y-coordinate. So, if I'm assembling a wall running along the y-axis, rather than dealing with a Vector2 containing the dimensions of the image in the manner of "dimensions = new Vector2(40, 200)", in which case I need to add dimensions.Y to the Y location of the previous component, I can have "weightedDimensions = new Vector2(dimensions.Y, dimensions.X)" instead, and so be able to add weightedDimensions.X to a weightedLocation.X coordinate to receive the proper y-coordinate, which also works for walls along the x-axis by defining "weightedDimensions" to just equal "dimensions".
However, although that probably sounds really confusing because I did a bad job explaining it, the actual concept of it is pretty simple. What made actually getting this algorithm to work so difficult is a series of little mistakes that I made while writing the code that manifested as nagging bugs whenever I started to make progress after fixing the last one, so I've been doing a lot of problem solving - that is, when I wasn't working in a method with a ton of variables across several lists of different classes and trying to keep how I'm handling all of the coordinates and dimensions and rotation values straight with how the renderer draws it. So yeah, this was actually a pretty tricky little project.
Technically it needs some more work (it feels like there's an endless number of loose ends to tie up), but I'm calling it good for now. Instead, I'm going to focus on something more enjoyable this next week - lighting!
Yesterday I spent some time laying the framework for adding lighting effects to the game (well, I say lighting, but I really mean shadows), but nothing else so far.
Sprint 10
My only goal for this next week is to implement dynamic shadows. If I've got more time, I'll probably try to tie up a couple loose ends for assembling structures that I mentioned, or start working on randomly generating buildings (currently, I'm manually placing the rooms and doors, and I'd like to get it to the point where I simply give a location and approximate size of the building and let the program generate the rest).