Production Documentation

To kickstart the initial planning of our project me and Salman followed Jakes advice and used the website HacknPlan to create a comprehensive view of when, how and why we are adding things to the game.

Link: https://app.hacknplan.com/p/164977/kanban?categoryId=0&boardId=442327

This helped us plan out the next course of action and allows us to work on separate things but both be up to date even outside of college on what either of us are working on at any given time, the website is extremely useful in helping us in coordination as we can both work simultaneously, it allows us to label who’s doing what and when.

Another view of my dashboard, showing what will be produced and when, the most recent being recording of Primary Research.

To begin full production of my project I decided to begin work on larger rooms, after playing the game for a little bit I realised that the rooms i have given the player to roam are very small, and have very little area to move around, to fix this I increased the size of the rooms, making it easier for them to move around and avoid projectiles, also allowing me to allow for more NPC’s to spawn.

The newly created larger room.

After adjusting the size of the room I decided to work on randomly generated asset locations, whilst I had already developed randomly generate assets (the room’s objects and assets randomising upon entering a new room0 i wanted the locations of said Items to also randomly generate, to do this I required the assistance of Jake to develop a system which would allow us to let them randomly generate within a certain area.

The script that produces the random generation of location

To do this we had to develop a 1-11 system of random generation, the system would pick between the given assets and choose one of them, meaning that it could choose the same asset several times, it then selects a random location from the top left of the room to the bottom right, allowing for these assets to spawn within the given area this is a good system as it would allow for both random location and random asset, never making the same room twice.

The random model generation script that was created

I decided to create a new room as a example of what to do in the future, the first theme I decided to develop as a template would be the caveman theme, as we had already had the completed assets for this theme at this point, I implemented the assets into the game and had several different types of rocks and fauna already developed, and added them into the game, making use of the assets that Salman had developed for me, adding them into the Caveman themed level allowed me to have a look into what the game would look like with randomly located assets, the assets where initially clipping with the player and had proper collision, this was quickly fixed and they soon had no clipping, allowing the player to walk through them seamlessly.

The different types of rocks that have been selected, randomly generated around the room.

Whilst waiting on Salman to complete the walls for the caveman theme, I got to work on developing the floor, an immediate problem I ran into was that the flooring often stretched images beyond comprehension, making them look terrible and overblown, to fix this I had to decompress the image, adjusting its overall size in relation to the flooring, then i had to make it into a static mesh, and eventually replace the current flooring with the new static mesh, to create a flooring that wasn’t stretched.

the floor after it had been changed to no longer stretch and morph over the whole ground.

Another problem I ran into was the lighting with the flooring, as the game was extremely bright, at certain areas the player could see little to nothing, this was both due to the camera placement and the lighting of the floors colours, to fix this I asked Salman to make a flooring that was darker, atleast for now before I successfully figure out how to dampen the lighting further, he did this and i added it into the game, whilst still waiting for the walls to be completed (which where taking some time due to the various designs he was making.

After finishing correcting the lighting the room looked like this.

After working on the random generation we decided to delete the original room, which as still small, and decided to focus purely on the large room we had constructed, using a pure grey room as the basis for themes, to be updated with various scripting to make it easier to continuously, this helps me create the newer rooms as i have to do less scripting and can change them relatively to make a new theme, only having to change the walls and ground/props.

Upon completing this I decided to get to work on creating the material necessary for the walls, as they are separate and need separate materials from the floor, I had to create a new static mesh and change its proportions accordingly, luckily my partner Salman had made a near-perfect seamless finish template which linked with itself very well, I then imported this and added it to each wall, randomly generating all of the 4 variants he made between, so none of the walls are ever the exact same.

One of the 4 wall variants seen here.

After applying the material to the walls I created a second room (a duplicate) of which would be used for the creation of NPC’s, this was done as I wanted to ensure that no errors where made and I could easily go back to the previously made room and leave it untouched.

The new room that had been created can be seen above.

After this I had to readjust the walls as I noticed their was an error with collision whilst testing the game, and the collision on the walls was for some reason disabled, this prevented further development as if I left it unchecked the game would be near unplayable as the player and NPC’s would clip straight through the walls and fall into the void below, this was quickly fixed and changed on both rooms.

The non-colliding walls in question can be seen above.

I then applied the previously mentioned material to the newly created rooms walls, having to ensure that the randomly generated wall textures were working, I replayed the game and ran through several doors to ensure that it ran as it was supposed too, luckily it did and the walls rarely had the same combination of variants.

The readjusted walls and the new material applied to them.

The next thing that had to be readjusted in order to ensure that the creation of the NPC’s would be smooth was the height of the obstacles on the ground, whilst the player character can easily climb over them slightly and may have a few bumps here and their, the same could not be said for the AI, so I decided to ensure that the height of each individual stone placement was low enough to were it was both visible, and easily climbed.

The first basic AI’s, (the 3 apart from the player, whom is the larger of them.)

Finally the AI had been created, upon creating the AI script I immediately realized a fault, the AI wouldn’t move, to fix this me and Jake had to go into the coding and dissect as to why this was happening, we had to make them so they spawned above the floor, but not too much so that they wouldn’t be noticeably falling, after various attempts we managed to do it, however the AI only spawned in 1 location (their set location) and they only spawn in the same numbers, this goes against what we wanted the game to be like so we had to implement a system which randomizes both placement and numbers, much like the environment.

The simplistic coding needed for the health mechanic.

Before doing any of this I decided it was best to get the health mechanic done and dusted, meaning that my character can take damage from the NPC’s until they eventually kill me, this was done using a simple hit-on-radius detection system which meant that the enemies could hit my player character if they where in a certain radius of him, I adjusted their damage to 5 and their max hit rate (how often my character can be hit at once) to 0.7.

An attempt at fixing the wall collision bug.

The next thing that needed to be developed was the damaging system for my character to the AI, currently the AI could damage me but I could do nothing to them, this was a tricky process as the collision was a dousy, it clipped on the obstacles but went straight through the walls, after lots of work we managed to get it to harm and kill the enemies in one hit (which will later be adjusted,) although we were unable to get the players bullets to not collide straight through the walls, this is a trivial bug but one that exists, it will be patched if we have enough time, for now the damaging system works and I am happy with it.

The spaghetti code that is needed for both player and AI damaging.

An issue that we ran into was that the player character could very easily be trapped in-between loads of enemies at once, whilst they can’t all hit him due to the delay in-between each hit it was still an issue as it seemed to happen an awful lot if the player character didn’t move quick enough, to solve this we attempted to get them to collide with one another but after doing so we realized that it wouldn’t work and we had to just rely on the player character being able to gun them down quick enough, we also adjusted the player characters speed to be significantly higher than the enemies to substitute for this, whist also keeping the one hit kill feature on the enemies, this solved the problem which could later be revisited if I have enough time.

The random location/number AI generating script.

As mentioned earlier I wanted the enemies to both spawn in random locations and in random numbers, to do this I had to create a code which would allow the enemies to spawn anywhere in-between the bounds of the room, and spawn without colliding and being stuck in one another/the obstacles, to do this we had to find the dimensions of the room and allow them to spawn anywhere inside of it, whilst also preventing them from spawning on one another, the random numbers was solved by allowing them to spawn from the numbers 5-20, meaning that the player gets a random amount of enemies, making some levels more challenging than others, I was happy about this.

The newly made shadow-less and readjusted door level, along with the randomly numbered AI.

After testing the level numerous times I found I was rather pleased with the progress, I went back and readjusted the door so that it lined up with the wall, and readjusted the shadows so they no longer blocked the players viewing, after this I decided to get to work on the system that would allow the door to only spawn once each enemy within the room had been slain, this was crucial as it would mean the player would have a goal, and couldn’t skip from level to level, for now the game was finally a game.

A quick demonstration of the game, and how the basic AI work.

After playing the game I decided the next thing to work on would be the need for the player to kill all of the current enemies within the room, I also debated making 4 doors as it seemed like that would line up with my initial goals, I decided to put this on hold until I had developed the system that allowed the door to only spawn once the enemies had been slain.

One other thing I had noticed whilst playing was that the AI seemed to descend on the player rapidly, often boxing them in extremely quickly, I aim to solve this in the future by either reducing the AI speed, or randomizing the players spawn location, possibly creating a scrip that will prevent AI from spawning within a certain distance of the player.

After many tries of constructing a script that worked, eventually me and Jake managed to create one which works, this took a large amount of time and we faced many bugs such as the door not spawning when it should, it spawning once then never again, it spawning but being unusable, it spawning but the model isn’t shown ect, we tried several scripts and different methods.

The initial script for the door, which was dysfunctional.
The resized and shaped door with another dysfunctional script.
We decided 4 doors would be better as it would give the player more choice in which way to go, with a new randomized environment each time.
One more dysfunctional script later.
The remodeled door, it may be changed later (asset material created by Salman)

Finally after much trial and error myself and Jake managed to create a script that allowed the doors to spawn when the enemy count reaches 0, alot of the previous bugs and glitches were caused by the enemy count reaching 0 before or after it should, meaning the doors wouldn’t spawn or would stay spawned instantly, this new and improved, and much simpler script worked drastically better.

An image of the scripts used for the doors working in conjunction, the top one deciding the next room and the bottom spawning the doors themselves.

With this, the majority of the scripting that has been planned has been completed, now all these is to do for the time being is to adjust and alter some of the in-game assets, such as adding environment to the levels and changing the AI’s sprites, as expected this was much more difficult than it seems, as our current levels relied on a singular AI which was pure white, when we created a new one for the newer level it had a hard time differentiating the two and struggled to generate the new AI within the new room, we aim to find a solution to this quickly.

A simple example of the newly created door spawning mechanic, and the newly imported caveman sprites (apologies for the recording quality being awful, the software I used was bad.)

After this I decided to playtest the game to ensure that the health mechanic and the AI damage still worked, this was necessary as I needed to know that the newly created caveman AI functioned the same as the old pure white sprite AI, as if they didn’t some bug fixing would be needed.

A quick test of the health and damage mechanic within the game.

As I mentioned earlier, the next thing to do was essentially the final part of real scripting left to be done, this is the creation of the new rooms and their AI, the creation of the objects within the rooms and the environment surrounding them, due to the previously mentioned AI bugging, this was a problem.

To start of the final scripting I needed to create a code which could separate the rooms from one another, and choose themselves at random from the set list, to do this I had to duplicate the current room, change its name and change its number, I then had to put these into their own asset list (Array,) allowing the game to select between the newly created rooms.

The early stage of the script.

I then had to creates several new arrays for both the in-room assets such as the rocks and trees, and a wall/floor array aswell, this was necessary as the game had to decide what was going in the rooms that have been generated, selecting different assets from the list much like it selects different rooms, I also used an Unreal technique called “Function” which essentially allows you to put the entire script within a singular module, basically acting as a folder which you can click on to see the script, this helps clean up the overall scripting and prevent spaghetti code (messy scripts which overlap.)

The basic script (completed, all that was done was duplicating the current “Set Room Assets” and adjusting the arrays.

After this I had to create an entirely new array for floors, as I had initially believed that they were connected to the wall array, after I realized this mistake I created a new one and imputed all the floors needed, connecting them to their theme respectively.

A list of all the completed rooms, all containing their respective assets and sprites.

After connecting the assets to the right rooms, I decided to playthrough the game and look at the newly created levels and how they looked, this helped me think about if I wanted to add any more assets for the walls/objects within the room, which I eventually did.

The eastern themed level, more assets were added.
The futuristic apocalyptic style level (more assets were added.)
(The caveman themed level, Pre-Historic.)
The medieval themed level, (more assets where added.)

Upon testing I realized that their was an occasional room which was pitch black, I was initially confused by this but quickly realized it was because the system that had been developed was picking from the levels, and sometimes picked a level that no longer existed, to fix this we had to develop an Enum, which essentially converts the names into integer numbers, essentially allowing the game to pick at complete random, without any discrepancies.

The Enum itself, (essentially the selection of levels and their values 1-10, the we created this system and wanted to expand upon it to include the miniboss level which would appear drastically less often, but scrapped the idea after limited time.

After the Enum was created and after much testing I realized that some of the levels looked bare bones, paticularly the future and medieval levels, to fix this I used Pixilart, the same software Salman and I used to create the in-game assets, and sketched up some assets which were similar to the experimentation sketches I did, some of which can be seen below.

Some of the newly created assets.

After adding these assets to their respective levels, I looked at the assets inside each level and decided to screenshot them so everyone can see what asset is inside what level, this was helpful as it would allow me to remember which theme has which colors and materials, and would allow others to have a deeper look into what makes up the levels.

The caveman assets.
The future assets, (Unused Monster boss asset included.)
The medieval assets.
The eastern/ninja assets. (Unused Red Dragon boss asset included.)

I then decided to play and record the game to show of the new assets and enemy sprites, showing the new levels and how they looked with the additional assets, this also allowed me to exhibit the randomly generated flooring on several levels such as the futuristic one and medieval one, which both had many different variations of flooring.

A final example of the newly created assets, the game itself on display. (Software made the game look way laggier.)

After analyzing the game thoroughly, I had finally reached the deadline of 27/05/22, I would say overall developing the game has been extremely insightful into both how to create Roguelikes and how to use Unreal, I learned loads of techniques and industry language such as Integers, Branches, Arrays, Enums, Sprites/Flipbooks, Functions and more, it was very helpful and I enjoyed making the project thoroughly, whilst I had many problems and made many mistakes, I would do the project again If I could, changing many things but also keeping the concept the same as I genuinely enjoyed creating it, I hope this production documentation is helpful to anyone who reads it to understand how and why I created the game.