Behind the scenes of my own game engine made in 72 hours!
Since my previous post I am getting really positive feedback about my custom game engine that was developed in under 72 hours. Well, I guess custom engines are well respected in this community so I've decided to make another post about what goes on behind the scenes.
The engine is built using C++ and SFML. I am a software engineer as my day job and I've designed and built systems from ground up several numerous in the past.
THE DIALOG ENGINE

I believe starting this post with the dialog engine is a good idea since it is one of the coolest parts (in my opinion) of the engine. When I decided I wanted to have dialogs in the game, I knew I had to design a dialog engine that is easy to use and that can ben managed quite effortlessly.
Normally, I would prefer to store all the dialogs in the game in computer storage as a file and load them into the memory on the go. However this would require a parser and I didn't think that was a good way spend my valuable time during the jam. So instead I have found a more creative way of storing them. But more on that later.
I created a dialog object that structures the the layout of the memory that represents the dialog.

One instance of this object includes an entire dialog, meaning a conversation that has multiple lines.
Ex: The small talk the grandpa and the kid have before the fight.
I have created a DialogManager class to handle all the dialogs during the game. This class was in charge of both managing which dialog to draw, drawing the dialog alongisde the portrait of whoever is talking, handle the animation and play the dialog sounds.
This design is kind of a "You are in charge of everything related to dialogs" approach and you might think it is faulty. While it might not be the best choice for a real engine that needs to scale, it is actually quite usefull when it comes to small projects with time contraints.

So how do I handle the dialog texts? Well I package them into dialog objects and push them into a std::vector in a single header file, this way all of them are kept in a single place. This approach saved me quite some time actually.

As you have noticed these texts actually serve a dual purpose. They not only provide the text but they also include the identity of who is speaking at the moment so the correct portrait animation can be shown. This allowed me to just put a single letter assigned to any characters portrait in the beginning of each line so I can keep writing without worrying about it.

Wait there is more!
The engine also has a "Trash Talk" feature that makes it possible for the enemies to be mean to the player during the fight. I actually found it pretty hilarious.

I really want to explain behind the scenes of this one also but I believe this post is already too long. So I will make another post about what goes behind all that trash talk later today or tomorrow.
Follow me if you are interested in knowing more about the engine :)
Here is a link to the game if you want to play and rate it:
https://ldjam.com/events/ludum-dare/46/a-samurai-friend-of-mine
Source: ldjam.com archive
Next postBehind the scenes of enemy trash talk system in my custom game engine!