Game Development - Task 3: Game Prototype

28.10.2024 - 27.11.2024 / Week 08 - Week 10
Tan Zhao Yi / 0363285
Game Development / Bachelor of Design (Hons) in Creative Media
Task 3: Game Prototype



LIST


Task 3: Game Prototype




INSTRUCTION




LECTURE

Lecture 6
In Week 9, we replace the coin from the last tutorial to a designed assets with animation. In this class, I've learnt about:
  • Sprite mode in Unity - standard and multiple 
  • To properly fit the box (as some seniors’ game doesn't fit), will have to change the aspect from free aspect to full HD / 16:9 
  • Lens ortho size 
  • + 1 coin can be written as: ++ 
  • Reference to TMPro 
  • Int to string ways: +"" at the back
  • Apply root motion to avoid the coin animate from the same place
  • New spawn: Key
Lecture 7
In this class, we started to work with the player and enemy's animation. I learned to observe the coherence of each animation, for example player attacking to enemy death, or player jump and run. This lesson allows me to implement the knowledge I gained into the prototype in Task 3.
Lecture 8
Summary of technique in this class: 
  • When player collide with enemy, he will get damage. 
  • Add HP Bar and reduce it by adjusting fill method (horizontal) 
  • Pivot: center to botttom to prevent player die through the ground 
  • Disable playercontroller after dead damage 
  • Visual Feedback: Change player color once hit
  • Adjusting knock back force and knock up force Randomizer (Random.Range(minDamge, maxDamage), makes the damage unpredictable

Task 3: Game Prototype

In this task, we need to create the prototype of their game. The prototype allows the use of grey boxing and doesn’t need to have the final art asset. It is to quickly test out the game mechanics and to troubleshoot any technical difficulties discovered during the development. The focus should be the MVP of the game. This task includes coding the movements, enemies' interactions, and game level.

I've selected some screens that include major interactions and the MVP screen included in the prototype will be:
  • Eryndor running, jumping, and attacking (Level 1)
  • Power of Shadow - slow down player (Level 2)
  • Collect scrolls (Level 2)
A. Eryndor Animation
The animations included and the key button to trigger them are:
  • Idle - Default
  • Moving - Front: d / right arrow key; Back: a / left arrow key
  • Jumping: Space bar
  • Attacking: Return / Left click
After importing the background, I've added an invisible collider as a ground for the player, and a 2D capsule at the start. This is to try out the moving front and back, up and down.
Fig 1.1. Prototyping Character
Then I imported my art asset to the Unity file, and started working with the animation. I adjust the animation speed and scale by PPU (Pixels Per Unit) because the scale when I convert GIF to PNG is not consistent. In this process, I get really frustrated because I taught transforming the scale in the Animation tab will work but it turns out making the ground collider not working, which means the player will fell out from the ground. Fortunately in the end I figured it out, yeay!

Fig 1.2. shows the script of Player Controller, which controls the animation and movement of Eryndor.
Fig 1.2. Script - Eryndor's Animation

Outcome
Fig 1.3. Outcome Video - Eryndor's Animation
B. Power of Shadow
This section is designed to test the functionality of the Power of Shadow from the Shadow Spirit, which slows down the player. I implemented a shadow spawner, causing the Power of Shadow to spawn randomly along Eryndor's path. This adds an element of challenge for players, as the shadow could appear unexpectedly close, potentially causing them to be hit when they fall from a jump. This has led me to reconsider the inclusion of the Shadow Spirit, as its current implementation feels somewhat unnecessary.

For easier control, I changed the Power of Shadow (hit) to only one black circle, so the shadow won't seems like glitching while moving. Also, I can control when is it fading by scripting.

I've been utilizing the same script as in the previous section, while also adding specific scripts for each Power of Shadow prefab and the Shadow Spawner. The Shadow Spawner script is designed to maintain a consistent Y-axis position, while allowing for a defined range along the X-axis, determining where the shadow will appear. Additionally, I’ve implemented a time interval to control how frequently the Power of Shadow spawns. This approach ensures that the spawning is both consistent and unpredictable, adding a level of challenge for the player as they navigate the game.
Fig 2.1. Script - Shadow Spawner
Then for the Power of Shadow prefab, the script is to control the direction of the radius gradient and the fading effect. The shadow will fade to invisible once it hits the player, and remain black if player successfully jumps and avoids it.
Fig 2.2. Script - Power Of Shadow
Finally, I made adjustments to the player controller script by adding specific lines of code to manage the player's speed reduction. This change allows the player's movement speed to decrease temporarily when they come into contact with the Power of Shadow. By controlling the duration and intensity of the speed reduction, I aimed to create a more dynamic and challenging gameplay experience. This feature increases the level of strategy required from players, as they must carefully time their movements to avoid getting hit and slowed down, especially in critical moments like jumps or tricky platform sections.
Fig 2.3. Script - Slowing Down Player

Outcome
Fig 2.4. Outcome Video - Power of Shadow
C. Collecting Scrolls
This MVP is set in Level 2, the dungeon. Players must collect scrolls that contain riddles, which are randomly placed throughout the level. To solve the riddle at the end of the dungeon, players need to observe the symbols carved into the environment. These symbols represent the sequence of the correct answer, encouraging players to stay attentive and engaged as they explore the dungeon. This mechanic adds an element of puzzle-solving and exploration, enhancing the overall gameplay experience.

The symbols will be carved onto tiles that the player can jump onto. To collect the scrolls, the player must jump up to reach them, adding a vertical exploration element to the gameplay. In the prototype, only a few tiles will be included to provide a clear and straightforward visual demonstration of this mechanic. This approach allows for a more focused experience, emphasizing the core gameplay concept without overwhelming the player. The carved symbols on the tiles will also serve as visual cues, guiding the player on where to jump and encouraging them to engage with the environment in a meaningful way.
Fig 3.1. Tiles with Symbols
There is only four scrolls for the player to collect, each contained the riddles of star, sun, moon and rose. As player collect the scrolls, the scroll icon in the scroll bar displayed at the top left of the screen will increase. 
Fig 3.2. UI Canvas - Scroll Bar
The script is also added to the Player Controller. This allows the player to interact with the scrolls directly through collision detection, eliminating the need for multiple separate scripts. By consolidating functionality into a single script, the workflow becomes more efficient and easier to manage, reducing complexity and potential errors. This approach keeps the game's logic more organized and maintains a cleaner project structure.
Fig 3.3. Script - Colliding with the Scrolls

Outcome
Fig 3.4. Outcome Video - Collecting Scrolls

One issue I encountered during this task is with the background. When the player reaches the end of the background, the screen turns blue. I attempted to resolve this by adding a box collider as a boundary, but it didn't work as expected. I plan to address this issue in the final task, possibly by adjusting the background's size, creating a looping effect, or implementing a proper boundary to prevent the unintended blue screen from appearing.

What's done ✅
  • Main character's animation
  • Power of Shadow functionality
  • Spawn Machine
  • Collecting scrolls
  • Counting scrolls
  • Jumping up to tiles
What's yet to be done ❌
  • Background boundaries
  • Sprout Guardian spawning (similar as Power of Shadow)
  • Looping background
  • Opening scrolls
  • Key in symbols password - will be drag and drop method
  • Polishing
Final Task 3: Game Prototype

Fig 4.1. Final Task 3: Game Prototype - Slides

Fig 4.2. Final Task 3: Game Prototype -  Presentation Video


REFLECTION

At the start, I faced many challenges, especially with errors in the script and logic issues, such as making sure only one "Power of Shadow" spawns at a time and getting the scroll collection system to work correctly. These problems required a lot of patience and critical thinking to identify the root cause of the errors. I learned how to carefully debug scripts, understand error messages, and adjust game object components properly. This experience taught me to be more detail-oriented, as small issues like unassigned objects or incorrect tags could cause the entire system to fail. It also made me realize the importance of planning and organizing game mechanics before jumping into development.

One of the biggest lessons I learned was the importance of persistence and testing. I had to experiment with different logic for the "Power of Shadow" and scroll collection systems, often encountering errors like "NullReferenceException" or "child out of bounds." These moments were frustrating but also rewarding when I finally found the solution. I realized that sometimes it’s better to take a step back, analyze the problem, and try different approaches. This taught me to approach challenges with a growth mindset, knowing that mistakes are part of the learning process. Collaborating with others and seeking guidance also played a big role in overcoming roadblocks.

I also learned how to better structure my scripts and keep my code clean and efficient. Beyond technical skills, I improved my patience, attention to detail, and problem-solving mindset. This experience showed me that even difficult problems can be solved with persistence, logical thinking, and a willingness to seek help when needed. It was a challenging but rewarding journey, and I feel more prepared to tackle future game development projects.

Comments