Back on Track

I've been reworking Boreal Darkness the past few days. As noted in a prior post, I had created a simplified C++ project in order to iron out the movement within a 2D grid. I decided to pull the rest of the game functionality into that project while rewriting it in a more concise and less mentally exhaustive format. The idea of having a base WorldObject that every element in the map inherits was a horrible idea which I attribute to the dumbassery of object-oriented design (and myself by proxy since I made the decision to use the scheme in the first place). At this juncture, all of the game data is stored in structs and the game state is passed around in a global manner. I'm not trying anymore to delude myself into thinking that game state is anything but a global element in the program; in fact, setting it up as such and dumping all of my structs into it alleviates a lot of the memory management debacle since it all stays where it's originally allocated and just gets passed around by references.

So far I've also removed classes from the code. I'm using namespaced functions that operate on the data structs. I frankly have no need right now for class member protection, so why waste time writing it? I'm not building a framework that others are going to consume, and I'm not trying to do things in functions that I shouldn't allow myself to do in the first place. Ergo, private functions and variables are not useful to me right now. I don't need to save myself from myself. The amount of code simplification has reduced the total line count by something like 900 lines. 900 lines of "proper" object-orientation, which disregarded the fact that no mechanism represented by an object had a real world equivalent and thus both convoluted the instructions necessary to get the computer to do what I needed it to as well as bungled up the concepts themselves in the code. OO is not always the hammer that you need.

As far as additional functionality, I've changed fires so that they'll only last for a limited amount of time. I'll add either a smoldering coal animation or a burned down wood graphic at some point so the fire doesn't just disappear into nothing once it's done. The fire will also regenerate player health if you're within 2 grid squares. I moved the status bar to the top of the screen. Everything is now symbolized with an icon. The wood and score counters are also padded with leading zeros to help everything look more aligned right off the bat. You can see a video of the current progress below.


I think I'm about ready to move onto adding an enemy into the game, finally. I need to generate some type of spawn point (I already have an idea for that), and I'll need to draw the enemy animation, so that'll take some time in Photoshop. I'll also need to figure out how enemy interactions should work, and how you're supposed to defeat them.

Code Stats

Language                     files          blank        comment           code
C++                             12            137             45            982
C/C++ Header                    20             75              4            613
JSON                             1              0              0             59
Lua                              1              0              0             42
DOS Batch                        2              3              0             25
SUM:                            36            215             49           1721