Sunday 14th April 2024
Blog Entry 10
This last sprint was quite packed with work.
When I began converting the features I had made into plugins I wanted to make them as reusable for anyone using them as possible. The plugins needed to be as modular as possible or else what is the point of a plugin.
The first thing I did was make a plugin to help localise enums. This was all done in pure C++ as the Unreal Engine does not let you use template classes in Unreal classes and templates are necessary for anything that needs to accept different types. I won’t go into massive detail about the enum helper plugin because this blog will probably be long as it is but I do want to share what the final function call to get a localised enum looks like: EnumHelperPlugin::Get()->GetLocalisedEnumName<EnumClass>(EnumClass::EnumValue). I am so happy with how clean it is given how complex the problem is.
After this I made the stats manager into a plugin. The stats manager contains 2 main classes the template class of the stats manager and the subsystem of the stats helper. This needed to be split into two classes as Unreal does not like template classes and I wanted the stats manager to be able to work with any enum that a user may want it to and for the user to be able to set what type the stats are e.g. uint8 or int32. As unreal does not like template classes a subsystem was made to essentially call functions in the template class that it holds as a member variable. The stats manager has all the functions it had originally such as being able to increment stats and directly set them. Also, in order to make the plugins as developer friendly as possible the subsystem is compatible with blueprints with its functions being easily callable from any blueprints.
Following this I made the time manager into a plugin. Similar to the stats manager it also has two main classes of a subsystem and the actual manager which is a template class. All for the exact same reasons as the stats manager and it also has the same blueprint compatibility for the subsystem. The only technical difference worth mentioning is that the time manager subsystem has delegates for events when the date or time of day changes. This helps developers a lot as they can subscribe functions to the delegates to know when the date/time of day changes rather than having to add function calls into the subsystem itself and edit the plugin code.
After a bit of testing and polish I have confirmed that the plugins work perfectly and that the project is as complete as it can be before the deadline in 2 days.
This project has been hard but the most fun I had on it was the plugin conversion and the modularity of it. I wish I had started out doing this rather than trying to make a game that to be honest I was only mildly interested in but at least I have found out where my passions and skills lie.