For ease of reference, I will refer to this project as “Hero TD”, as, during my time working on this project the studio that hired me to freelance for them had not given it a name, it was a new startup studio that hired me to program all the foundations. One of their requests was that the bulk heavy overhead mathematical code was to be written in C++, however, they also wanted blueprint functionality, for some of their less skilled members.
For me, this was an exciting challenge, and I couldn’t wait to start, at the time when I was actively working on this project for the studio they had not received any 3D work back so I was extremely limited on resources. Given this information I decided to go with the paragon assets for characters and to imitate the hero’s I was programming. I also used some rough shapes and blocked out the towers using these rough shapes. This allowed me to do my duties to the studio with programming without waiting for assets before I started. The studio that hired me was impressed with my intuition but honestly I just could not wait to start.
So what was this game? well, it was a PVP based tower defence game, where the players could attack each other or they could hire and spawn mobs in to attack the player. In response, the player must build towers and walls to direct the mobs down a kill zone. My task in this project was to build the grid generation, handle the basic movement and the tower building/targeting systems. I did this with ease, and the quality of my work was not questioned.
I did the best that I could do without any assets from the studio. Thankfully the source files where on my PC due to working through perforce, so I was able to get the content needed for my portfolio. So how did this look, well, the paragon assets worked really well, and I was able to program them in and the skins for each one so the studio had the functionality to add skins to their hero’s. Here is a reference to the paragon assets that I used to simulate the hero.
1 of the paragon assets “Sparrow” was used to simulate ranged attacks and hero’s that would make use of ranged for their primary attack strategy, the second hero “Shinbi” she was used in order to simulate melee characters and hero’s that specialise in melee for their primary attack strategy.
I managed to program in the movement of the assets using Animation Montages, blend spaces and state machines. The movement, in the end, came out very smooth, and so did the attack scripts. The performance of the project was also kept in check, and through designing various systems the performance was always a priority. This is because the studio needed to have a smooth multiplayer experience and this was achieved.
The movement was as shown very smooth, and the replication of that movement was perfect, there wasn’t a single issue, and so after this was done, I moved on to my tasks since the studio commissioned quite a bulk amount of work, which I didn’t mind, and I fully enjoyed working for them, in saying that time was critical here as the studio was being charged by the hour.
Once we had the characters programmed, I then moved on to getting the skins for the two paragon assets and using these skins I was able to program the player selection of the skins, so that the studio could replace these place holders later and still have functionality for different skins for their owned hero’s. This was a quick and easy task, and so we began writing the C++ code for the grid generation so that the player could place turrets and objects down correctly with correct snapping and spacing. This proved a little challenging at first, but I overcame the challenges and wrote a lot of efficient high-quality C++ code which the studio was extremely happy with.
Here is a screenshot of the C++ page which had the functionality to run all the code necessary and with this I had also created a header page which I will get to in one second, for now, you can see on the left there was quite a lot of C++ programming in this project. Which I was super excited to do. While the code I wrote was elegant, simple, and pretty small on the overhead, I still had to ensure some functions were accessible through a blueprint for the designers, and so when creating the variables I had to consider what needed to be exposed and what didn’t so that I could keep the code secure, and only make public what was absolutely necessary.
As demonstrated in the screenshot, there were not many variables that I made public, and it was only the ones that the level designer needed access to, that being variables such as grid size, grid height, grid counts, grid points and start locations. I then proceeded on writing the functions that needed to be set, the private ones, and after this, I then wrote the private variables. As demonstrated in the first screenshot, I tried to make sure I could get as many variables to be localised locally, instead of globally to ensure that after a function has run the variables associated with it can be sent to clean up as well.
Once the C++ was written, I knew it was time to build the turrets or at least block them out, so that I had something to test while scripting. To do this I simply created actors, in which I added instanced static meshes, so that I was able to use the basic shapes provided by unreal engine to build a turret, and while doing this I made sure it was set up in such a way that when the studio had their assets they could simply swap them out without ever touching the set up or code.
Shortly after I had blocked out the turrets I worked on the turret targeting systems and also the building aspect of getting them onto the grid correctly. This way they could rotate and lock on to a given target or player effectively, while snapped into solid favourable positions, so the playing field could look neat and understandable.
with this in place, for me it was time to work on the interfaces that would link the player and the turret and the mobs in a way that would allow them and other structures to take damage and have a health value, and I decided to write this in blueprint, to save time for the studio, and because the interface wasn’t intended to be heavy lifting, and so I knew the studio would want or might want to change, edit, add and remove functions from it.
With this light weight code done in blueprints, it was easy for the studio to continue building of my work after my freelancing tasks where done. All though they had a lot of foundations now that I had programmed for them, the interfaced allowed destruction of player bases, turrets walls, and it allowed me to start developing the PVP elements of the game.
After testing the destructibility of the walls and turrets, which might I add was a huge success, I then jumped in and began working and writing the code for the PvP elements which was an exciting endeavour. Previously with Shadows of Athesia, it was PVE, so while I knew a lot about networking and multiplayer server-side games and programming them I had not yet touched on direct PvP.
Once the competitive side was programmed, and players could attack and kill each other I also had to program a respawn system as shown in the above video. The studio also requested that a kill feed was done, so that it was clear who won a specific fight. The studio also had plans to make other game modes such as 2v2, 4v4 6v6, and so a kill feed would be helpful in knowing who killed who.
Finally, it came to the point where my freelance tasks were nearly complete, everything the studio hired me for was complete at this stage and all the studio needed to do was replace the blocked assets with their real ones when the time was right. My last task for them was to ensure the bases they spawned at were damagable and could be destroyed so that the game objectives as a whole where complete.
And so all my tasks where complete, I had built everything they need and programmed all the rules for their game, at this stage the players could kill each other, attack structures destroy the bases and build defence. The studio was extremely happy with the result, and allowed me to keep the work that I did for them as reference.
With all parties happy, this was an extremely exciting project for me to be involved in, I got to work with C++, PVP elements and the project was actually quite interesting.