Games Development / Final Project

27.10.2023 - 1.12.2023 (Week 9 - Week 14)
Takuto Hozumi / 0354047 / Bachelor Of Design (Hons) In Creative Media
Games Development
Final Project


LECTURE

W1 Module Briefing

All lectures were completed in Project 1Project 2, and Project 3.


INSTRUCTION

Requirements
Students will integrate their art assets to their game development and produce a fully functional and playable game.

The game must consist of at least three stages.
Stage 1: Tutorial stage
Stage 2: Normal game stage
Stage 3: Boss stage

Submission File
  1. Unity Project Folder
  2. Unity WebGL Build
  3. Video presentation and Walkthrough of the game
  4. Game Design Document (PDF)
  5. Blog URL

1. Programming Process

First, develop the functions associated with the character: create a CharacterController.cs script and attach it to the object.

The values finally attached to the player are as follows.

Fig.1-1: CharacterController.cs Values

Double Jump
Fig.1-2: Jump Function

The double jump system consists of two bool values and an if script. When the player is on the ground, the first bool is ture and the jump is allowed. A jump causes the first bool to be false and the second bool to be true, thus permitting a second jump. By second jumping, both bools become false and no further jumping is allowed. The jump can be made by touching the ground again.

Automatically slides down a slope
Fig.1-3: Sliding Down

Flat ground and slopes are identified by tags. When touching a slope, the player automatically moves to the right. This is because the game is basically all about going down.

Control of HP, Life & Coin
There are Coins on the stage, and if you collect 10 Coins, you get 1 Life. Life is reduced by one when the player dies, and the game is over when the player dies at 0. So, since these functions must be linked, the following settings were made so that a function is triggered for each number.

Fig.1-4: Function Link

Fig.1-5: Respawn Function & Part of Coin Function

These processes are simple, HP control and coin control are managed in a separate cs file, so some of the processes are described there.

By the way, after consideration, I decided the only time a player returns to the initial position on the stage is when it falls into a cliff and dies. If a player dies due to a loss of HP from an enemy or trap, will spend Life and respawn immediately on the spot.

Fig.1-6: Coin Manager

The cs file attached to the coin prefab will govern not only the ability to increase or decrease the life value of the player, but also the SE of the coin acquisition. The same applies to all game objects, such as recovery items, enemies, etc., where something occurs upon collision with the character.

Player Attack Function
Fig.1-7: Rattle

Set player attack function, specifically firing the Rattle with the Z key.

Fig.1-8: Bullet Value

Fig.1-9: Bullet Orbit Setting

In actual play, the firing of bullets was affected by the player's speed. Therefore, the firing angle was also editable in the inspector and adjusted while viewing the actual play screen.

Trap & Enemy
Fig.1-10: Trap Script

Traps, coins, and recovery items work by the same mechanism. Objects disappear naturally as a game by activating animations as well as by increasing or decreasing numerical values.

Fig.1-11: Recovery Item

Traps are HP-1, but recovery items are HP+1 with the exact same script.

Fig.1-12: Enemy Script

The script setup for managing the Enemy's crows is described above. But what is noteworthy is the management of HP. Basically, normal enemies are set to 1 HP, but considering that this script will later be diverted to bosses with a large amount of HP, I made it so that the numerical value of the enemy HP can be set.

Fig.1-13: Enemy Script 2

Boss
Fig.1-14: Boss Battle

Bosses have high HP and must attack players aggressively. I diverted the script from Enemy and set the HP at 50.

Fig.1-15: Boss Values

I also set the Enemy to fly toward the player as a projectile from the boss. The basic movements of the boss and enemy are managed by animations in Unity, and the script controls the entire game.

Fig.1-16: Boss Die & Attack Function

Die & Game Over Function
Fig.1-17: Falling down

Fig.1-18: Hit Point -10

When the player collides water object under the cliff, hit points are reduced by -10, and then the life is reduced by 1 or the game is over depending on the player controller.

Stage Shifting Function
Fig.1-19: Map Trigger from Stage 1 to 2

When moving stage 1 to 2, the following three things will be changed
  • Background
  • BGM
  • Player coordinates
Warp points are set by value from the inspector, so this script can be diverted from stage 2 to the boss stage.

Scripting to hold a Value across Unity Scenes is a bit of a challenge, so in my project file I created three stages within a single scene. I just set switching the background and background music to make it look like player moved to a completely different stage on the outside.

Fig.1-20: C# Scripts

As a result, the files were divided quite cumbersomely. Although development has progressed and it is no longer possible to organize them now, it would have been better to write scripts with a little more information organized from the beginning. This reflection will be used for the next time.

2. Stage Design & BGM, SE

Stage Design
Fig.2-1: Decoration Object

Objects that do not affect gameplay but improve appearance include trees and stones.

*The trees sometimes are placed on a layer above the player character and are not without a role in obstructing the player's vision.

Fig.2-2: Danger Sign

Danger signs is placed in front of dangerous cliffs.

Fig.2-3: Boss Stage & Cloud Object

Clouds are grounded on large cliffs and on boss stages to provide footholds for players. The boss will fire crows endlessly, and players can use their footholds to dodge them. It is set quite difficult to get on.

Fig.2-4: Stage 1 Overall

The water surface object at the bottom of the cliff has the aforementioned HP-10 and respawn scripts attached to it.

Fig.2-5: 3 Stages in 1 Scene

The three stages actually exist on the same axis. but it is not possible player to move into another one except by the specified trigger.

Fig.2-6: BGM & SE

BGM and sound effects were chosen to be copyright-free and to not require a copyright notice.

3. Build

Fig.3-1: WebGL Build

Now that the game is complete, export it to a form that will actually run on the web.

Fig.3-2: Unknown Error

Here is what I have tried to solve building problem;
  • Move the entire project file to another location
  • The compression format changed to Disabled
  • Change graphics settings
  • Delete configuration files from the library
  • Add .htaccess
  • Remove potentially problematic descriptions: Unity Engine GUI
  • Export in developer mode
  • Use different Unity version
All of the above are solutions found by searching the error logs.
None of these worked.

The most nefarious of these was to use another version of Unity. I was originally working on 2022.3.8f1. However, I found advice on the internet that I should try another version, and when I tried it, the file crashed and became unrepairable.

Fig.3-3: Install Another Version

Fortunately, I had prepared a backup, but the project we restored from the backup was also adversely affected. And the final solution was to remove the newly installed version and manually restore the missing files. This took two days. I decided to stop attempting to solve the problem myself, and wait for lecturer check it out as I should not take such a risk of destruction just before submission.

P.S. The lecturer then told me that the build problem is difficult to solve, I submitted the output as an .exe as instruction. (15/12/2023)


FINAL OUTCOME

Fig.4-1: Video Presentation & Play Demo (2/12/2023)

Fig.4-2: Game Design Document (4/12/2023)


REFLECTIONS

Experiences
The goal of this final project was to develop the game that had been planned throughout the module into a form that could actually be played. Many functions are implemented by importing image materials created using Illustrator into Unity, adding animations and attaching C# scripts. In addition, the underlying object settings, such as gravity and materials, are designed to be custom-made in C# from Unity, saving a lot of work compared to actually creating the game from scratch. It was very useful to be able to define basic values in C# and manage them visually from within the inspector in Unity. On the bad side, however, it was often frustrated by unexplained errors.
    Observation
    It was a bit of fun for me to figure out what code I could use to implement the functionality I wanted to add, using values such as Int, Bool or something, and then actually get it working. Most of my errors in this kind of work were cases where 1. the syntax of the code was wrong, 2. the object or script was not attached properly, or 3. the code did not recognize the object. They could be solved by checking and examining the console carefully. However, in rare cases, unexplained errors occur. For example, a script that should have been working a moment ago suddenly stops working, even though nothing was changed. In my case, it happened at the warp point of map movement and at the Build stage of WebGL. For example, let's say the submission deadline is in three days and the game was completed one day before the deadline with plenty of time to spare. However, if the game gets stuck in the Build stage and takes more than 24 hours to resolve, it will be sent for submission even though it is complete. This is also true in work situations. These cases are unpleasant and very stressful for me. Perhaps my skills are lacking, but I have found that Unity is an insecure software with no certainty to handle as a job. I would like to know how programmers who are currently developing games in Unity at their companies as professionals are solving this problem. I look forward to Unity becoming a more complete and beginner-friendly software in the future.

    Findings
    What I discovered this time is not limited to Unity game development. Programs tend to be written in a certain way, and I found C#, for example, to be a bit like JavaScript. I thought C# was a language similar to C or C++, but when I looked it up, I learned that C# has its roots in Microsoft's development of Java to be handled like the C language, which made sense. Nevertheless, then I learned that there are high-level and low-level language scales in programming languages. I learned that I have been dealing with high-level languages, which are convenient and easy because of the abundance of frameworks but also have the potential to complicate the finished code and invoke strange bugs.

    The games we usually play casually are evaluated based on whether the game is interesting or not. However, even if the game is not interesting, I learned that it is a difficult task to reach a level where the game is playable. From now on I will be gentle in the way I look at a damn game.

    Comments

    Popular Posts