top of page
Paddy Benson

Capstone Project: Week 14

Updated: Jul 29

This week I worked further on polishing what I already have, so that my core gameplay loop is fun, bug free and satisfying, almost like a vertical slice.


The first thing I did was take Scarlet, the player character back into substance and updated her textures to look closer to a racing suit that matches her jet. I then took her into Mixamo

where I found 4 animations for the respective places a player could finish. Due to me already coding this ahead of time I then just swapped out the place holder smiley face objects with the four Scarlet's, each with their own animation. This now means she will reflect the players position and emotion with her own.



After this I continued personalising by giving the other racers their own respective textures. Inspired by SSX3 and MotorStorm I gave each their own unique, and personal paintjobs. I plan to build on characterising them further later on.



After that I went about fixing bugs to do with the final position being calculated incorrectly. I then started working on updating npc racing recordings and getting them timed correctly with the countdown in the built version. I was doing this as I attended a playtesting event at Auckland Makes Games.


From this playtest I got lots of helpful feedback and also praise which was good for letting me know I am on the right path. One of the biggest things I noticed in all players alike was that they all:


  1. Did not seem to understand racing lines for corners

  2. That letting off to maintain speed means that you cannot suddenly break at the last moment because every time they ended up in the wall without fail.


Now after this I sat down the next day and really thought about how I could fix this. I hadn't been wanting a brake button in my game but it seemed like to the general player base they either found it too difficult or disliked it due to it feeling sluggish mid corner as well as rewarding slowing down.


After awhile I remembered someone also asking if drifting was in the game and that's when I decided to meet in the middle of both my idea for the game and the players wants. And so I went about adding a Drift feature that allows players more lenience when it comes to cornering. The way I added it was through taking the calculate propulsion method and adjusting the side friction when the player is braking. The usual calculation being:


 Vector3 sideFriction = -transform.right * (sidewaysSpeed / Time.fixedDeltaTime);

However If I further divide it be a value eg. 4 It causes sliding:


Vector3 sideFriction = -transform.right * (sidewaysSpeed / Time.fixedDeltaTime / 4);

And so I further built off of it adding a timer that only allows the player to Drift for a certain time before being launched forward at the direction they are currently facing.


float sidewaysSpeed = Vector3.Dot(rigidBody.velocity, transform.right);

        if (input.isBraking)
        {
            brakeHoldTime += Time.fixedDeltaTime;
        }
        else
        {
            brakeHoldTime = 0f; // Reset brake hold time when not braking
        }

        // Adjust side friction during braking for drift
        if (input.isBraking && brakeHoldTime <= maxBrakeHoldTime)
        {
            float driftForce = 2f; 
            Vector3 driftDirection = -transform.right; 
            rigidBody.AddForce(driftDirection * driftForce, ForceMode.Acceleration);
        }
        else
        {
            Vector3 sideFriction = -transform.right * (sidewaysSpeed / Time.fixedDeltaTime);
            rigidBody.AddForce(sideFriction, ForceMode.Acceleration);
        }

Due to the way it's set up, it allows for a lot of depth in mechanics as there is almost two separate ways to use it. If you press brake and release the accelerator, it works how a brake normally does slowing down the vehicle but in this case also causing a drift to promote a faster way to turn into sharp corners. However If you hold both triggers down you actually don't lose as much speed, creating a power slide effect. This depth allows for players with more skill and knowledge with the games mechanics to use this faster drift to navigate sharp turns and corners without really losing much speed. Good players will also have the timing down for when a drift is at it's max, causing you to sling forward with grip again. This means timing it and learning the timing is important and will give you a large advantage.


I then worked on the the player feedback for the mechanic by adding a particle effect for when the player is drifting. I decided to go with a pulsating outline under the ship. I came up with this after looking at how air reacts to fighter jets when they pull sharp turns. And so using this idea I wanted to show the air reaction of it clouding up in a stylised way.


I then altered the FOV script to lesser the X damping when the player is drifting to keep them slightly more central in the screen space and not fly off the side.


 if (playerInput.isBraking)
        {
            transposer.m_XDamping = Mathf.Lerp(transposer.m_XDamping, brakingDamping, Time.deltaTime * 5f); 
        }
        else
        {
            transposer.m_XDamping = Mathf.Lerp(transposer.m_XDamping, normalDamping, Time.deltaTime * 5f); 
        }

Once this was all worked out I then created a menu that allows the player to restart or quit the race as I noticed lots of players try to do this during the playtest. This just required a simple script that when a key is pressed time scale is set to 0 and the canvas is activated and set back to 1 when deactivated.


 private void Update()
    {
        if ((Keyboard.current.tabKey.wasPressedThisFrame || Gamepad.current.startButton.wasPressedThisFrame) && !isPaused)
        {
            TogglePause();
        } 
isPaused = true;  
        PauseUI.SetActive(true);
        Time.timeScale = 0f;

I then just have two functions for the buttons, one that restarts the level:


 public void RestartGame()
    {
        Time.timeScale = 1f;
        SceneManager.LoadScene(SceneManager.GetActiveScene().name);
    }

and one that quits to the Main menu:


public void QuitToMainMenu()
    {
        Time.timeScale = 1f;
        SceneManager.LoadScene(mainMenuSceneName);
    }

The actual pause menu itself is still basic visually but everything works and that is important. I decided to not have a resume function (which is why there is a isPaused bool.) This is due to the ghost replay system NPC's use not seeming to pause when time is set 0 unfortunately. However since each level is at most 5 minutes for an average player I don't think having to restart is that big of an issue.



As you will see in the gameplay, something I forgot to mention last week is I also altered the NPC trails to be both more transparent and personalised through individual colours. I think this helps to reduce clutter on the track and also adds more individualism to the NPC's.



5 views0 comments

Recent Posts

See All

Comments


bottom of page