This week have been a really productive one in terms of features completed. First off, I’ve done some finishing touches on the Pathfinding algorithm which I wrote about in last weeks’ post and all that remains now is to give each enemy it’s AI-logic.
One of Haunted Lights more prominent feature is its re-generation of levels. Because of that particular feature we need to have the level to be updated whenever the generation happens. In case we didn’t update the sprites when the level generates we would get something that look something like the screenshot below.
In the previous post I wrote that I was going to go through how our level generation worked, but due to missed deadlines we’ve been forced to push the implementation of that feature to later when we have a working path-finding since we prioritize having a challenging game rather than a fancy level-generation. Because of that unfortunate turn of events I’ll now write about how our A-star implementation currently works instead.
Before I even began working, I did some research on what the easiest way of implementing A-star were. After a while I finally settled on using the “Micro-Pather” libriary which is a lightweight and easy-to-use library containing only two single files;”micropather.h” and “micropather.cpp“.
This week I’ve been mostly thinking and planning out how the level generation will work and I’ve also assisted our programmers in different parts of the game.
since I haven’t completed any new artifact in the game this week (except different resolution support…but it’s such a minor part and therefore I don’t’ count that) I’m going to talk about a feature of Haunted Light that’s a work in progress. The “(Re-)generating Levels”. I’ll explain what I mean by that.
Haunted Light is a game where you wake up on a basement-floor with only a single candle in front of you. As soon as you pick up the candle you notice that there’s a monstrosity following you and the goal is to survive by running away form that monster while avoiding critters and other horrors.
While you’re escaping you’ll notice that the rooms and corridors aren’t the same as when you previously were there. That’s because as soon as you move a large enough distance away from an area then it’ll change i.e. “re-generate“.
This week I have accomplished a couple of things.
I changed what the Object-Manager stores. Previously it stored GameObjects but now it stores pointers to GameObjects. This prevents the object you want to store inside the Object-Manager from being destroyed when it gets copied over to the map container. Due to this change I also managed to fix a couple of memory leaks concerning the objects sprites and colliders not getting destroyed. Another thing I did was making the game scale according to what resolution you have. This change prevents the users who plays the game at higher resolution from having an advantage due to the increased field of view. But the main thing I did this week was the revamp of the State-Manager.
Previously we had no way of pausing the game. If you wanted to take a break from the game you’d have to restart from the beginning again in-case you lost while you were gone. And that’s not acceptable. So now instead I have changed the way states are handled and gave each state a couple of new functions and member variables.
This week we’ve been working hard on getting an alpha product done for the presentation that will be held in from of the class.
I’ve made some finishing touches on the light engine so that it e.g. no longer have transparent shadows. This was accomplished by using blend modes. I’m quite familiar with using blend-modes because of my previous projects when I used to program a lot inside the game engine Game Maker. But I’ve gotten more and more used to how SFML works now and it feels great!
But enough of that. Today I’m going to write about how Haunted Light handles all it’s different objects.
This week and the previous one have been great! We’ve managed to fix most of the game engine’s core features. In the forthcoming days we’ll start working on some simple gameplay implementations.
The development library we use for Haunted Light is SFML (Simple and Fast Multimedia Library). Well the name speaks for itself but it’s a simple-to-use framework to communicate with all the Input and Output devices of the computer. Without a development library you’d have to write code that directly sends instructions to e.g. the Processor or Graphics Card.
Onto the main topic of this post. I’m going to write about the structure of the “sprite-manager”. The sprite-manager takes care of loading all the images to the game, which in turn gets made into sprites. Sprites consists of a texture (i.e. image) and a rectangle shape which determines what part of the texture to show when in-game. The reason you’d have a sprite-manager is to make sure that the same textures isn’t loaded multiple times and take up an unnecessary amount of RAM.
I’ll go through what the functions and arguments are and then explain the details of how everything works. So that you easier can follow the next paragraph. Continue reading
Today was a long day, a whole 12 hours at school.
The day started out with a scrum meeting where we received feedback on what we’d so far done on the scrum document. The scrum document is a kind-of work plan in which all the group members specify all the work which need to be done until certain dead-lines.
First we had planned out the work in broad categories to focus the time on actual development instead of grouping each work-task. Although, today we learned that in the long run, it would probably be better to have smaller parts and update the document more often. And therefore having a better overview of the whole project.
To sum it up. We needed to be more precise and split the tasks into smaller bits in order to better specify the progress of our work.
The next event this day was the programming introduction to the:
SFML framework (Simple and Fast Multimedia Library).
It’s such a relief, getting into the actual game creation process much faster compared to the time it takes with our previously used library: SDL (Simple DirectMedia Layer).