Refactoring

Refactor and Replace

Senior Production

Post VI


 

This week for me was focused primarily on refactoring the code base and preparing to be scaleable. This has been a task i’ve avoided mostly because the existing code was pretty gross to begin with but having too much work was a pretty good excuse not to do it either. This week’s post will also be fairly short as nothing has particularly changed code wise besides a lot of stuff being redone in C++ instead of blueprints. However, I do have a few things to talk about in regards to the prototype. Lets start real quick with the code.

So the original project was purely done in blueprints and I had not even touched it at all. I was busy working on BBR (rest in peace…) and my designer and artist worked on this prototype. They did a fantastic job of putting the prototype together, but the code base and the organization were not scaleable and would be problematic moving forward. This is where I come in to help. I don’t think I quite understood what I was getting myself into at first but the further I dug through the blueprint code, the more I realized how badly it needed to be redone. It felt a lot like the kind of code I would write in a game jam when there just wasn’t enough time to do anything fancy or good. So what have i done? I’ll break it down into a few things.

I started by refactoring the project files itself. If you saw them, you would understand how bad it really was. We had no organization and for some reason there was a folder in the root content folder that acted as its own content folder. Not to mention the world outliner being a total mess. After several tries of refactoring the project files (and failing spectacularly because of the dependencies on each of those files), I finally succeed in making it reasonable.

Next step was to rewrite the item system. Our item “system” was kind of thrown together and was a bunch BS which pretended it was a system. It didn’t make a lot of sense and there was tons of duplicated code and parts. I created a system that would allow us to do a lot of cool things down the road with both items and interactable objects. I started with an InteractableObject class which is an AActor and defines functionality for subclasses to implement as needed. It also provides a volume for them to specify which represents the box in which the player’s vision needs to overlap in order to show their interactable functionality whatever that may be.

12

This class is what I based the HoldableItem class off of which defined more functionality specific to the items. I then recreated our existing items in the system and they functioned more less the same but in a more scaleable system.

I also worked a bit on the character class we were using. Since the prototype was originally based off the first person shooter template, it had some blueprint code and assets from that. It also meant that our character class was based off the template’s character class which was all in blueprint. I then had the pleasure of rewriting all of that in C++ so it could be less messy and so that I could work on it down the road with less problems. This is still a work in the progress, but all the base functionality from the first person template is working (besides the shooting because that was removed).

Now that the more technical stuff is out of the way, I can also briefly talk about the direction our prototype is heading. The group and I talked a bit about it and decided to scrap the level we had already created. This is partially because it was incredibly messy and more a less a proof of concept but also because it didn’t fit what the designer had in mind for the beginning of the game. Our new level puts you at the exit of a subway next to the entrance of the mall. This is all underground if that wasn’t clear previously. The level in the prototype is still in progress so it’ll be best to show the image our designer has created for it. The main point of this level is to introduce the player to flares and a basic puzzle like opening a powered gate.

13

Now before I end this post, I have one last anoucement to make regarding the team. For a while, we have called ourselves Mind Tree Games. And while I had not previously posted this, it has been so for several weeks now. But what kind of team would we be if we didn’t have a logo? Our artist nick gave us a beautiful new logo to go with our team name which is below. It really is a remarkable piece of art and I hope we can one day make it a poster because it would look pretty awesome.

MTG

TL;DR:

  • I have the ‘joy’ of refactoring our code
  • We made a new level
  • We have a logo!