Thursday, March 20, 2025

This blog is no longer maintained

 Following advice from my teachers, the past and future blog posts of this blog have been moved to my university WordPress page. 

https://year2.wsagames.com/sc18g23/

You can also find my personal blog here:

https://samcox08.blogspot.com/


Monday, February 10, 2025

Week 2 - Beginning programming

In this week, I started to work on the programming for my group project. I focused on making a movement script, using the Cinemachine package for camera movement, and refining that movement script through making a basic level using ProBuilder.

Making a basic movement script.

To begin with, I created a ball object in Unity, and I followed a YouTube video to create a basic movement script for the player, with 1 change, since I was familiar with the new Input System, I used that here instead of the old Input System that the video used. The way it worked was this, I would add a PlayerInput component to the player, which I can then use to make a InputAction file, where I would store all of the player inputs for the game, and then I would hook up the relevant functions (movement, jumping) to the corresponding Inputs on the PlayerInput component. This has several benefits compared to the old InputSystem, that being cleaner code, and easier editing of the players inputs.

 


Adding a jumping mechanic to the player was also easy. What I did here was add a jump action to the InputAction file, and then in the PlayerMovement script, when the player presses the jump button, add a force upwards using a new Vector2 that includes a new variable called JumpSpeed. 

At this point, I also added packages that I owned through the Package Manager, and one of the packaged I added was a model of a muscular human frog that I bought for a project that I quickly scrapped. This wasn't to be used for the game, it was just to test out the player character.



Camera Movement

The next thing I decided to focus on was the camera movement. I did this by following a Brackey's tutorial on third person movement. I didn't need most of the video since I had already implemented code to get the player to move, but the first couple of minutes were important, as Brackey's demonstrated how to easily add camera movement to the player. The first step was to add the Cinemachine module, the second was to add a CinemachineFreeLook camera to the game, and to add the player to the LookAt and Follow slots on the Third Person Camera GameObject that was added when I put in the FreeLook camera.

Making a simple level using ProBuilder, refinement and code changes.

I decided to make a level using a level modeling tool called ProBuilder. I made a new scene in Unity to contain this level, with the intention of creating a basic level that I would use to refine the movement code.

Within this movement code, I added a maze like structure where the player has to move around to get to a ramp, which then is used to test the physics. For kicks and giggles, I added an Eames Lounge Chair model I found free from Sketchfab. I also used ProBuilder to create some blocks for the player to knock over, placing the models on top so that they would fall to the ground when the player hit the blocks.




One of the bits of feedback I got was to increase the amount of gravity for the ball player, so that they fall down to the ground like a marble would. I had 2 options to do this, via the Unity settings to increase the gravity in general, or via code. I chose the code route, so it only affected the player. It was fairly easy to implement, since I already had a GroundCheck function, and would go like this: if the player was not on the ground, add a force to the rigidbody downwards by a number determined by a float called gravityScale, multiplied by vector2.down. 

During this point, I also decided to make some changes to the movement script, since it didn't use Time.DeltaTime yet, when I build it to WebGL, the player would not move as fast as in the editor at peak performance, yet when my MacBook Air got hot, that would also affect the performance and caused the ball movement to slow dramatically down. 

The way I fixed this was by moving some parts of the code around, and dramatically bumping up the values of some of the variables I was using. Since I was using the New Input System, I had a function called OnMove that captured the player's input variable, and would set a CanMove bool to true. On the FixedUpdate function, I would use that data to add a velocity to the player's rigidbody, multiplied by time.fixedDeltaTime (fixedDeltaTime because it is in the FixedUpdate function, not the Update function).

The final 2 changes I made to the game relate to the camera. One of which is when the player's camera is overlapping with objects, which causes the camera to go through said objects. I fixed this by watching the Brackey's video further, where I found a CinemachineCollider modifier that I can use to make the camera move forward when the player's camera overlaps with objects. 

The second change here is making the player's camera move according to the camera. This was tougher than the first, as I had to do some research and trial and error. But how I did it was this, in the FixedUpdate, I got the camera's transform movement, then I multiplied it with the moveSpeed and time.fixedDeltaTime, used that to set a new variable called movementForce, and then used movementForce to add to the players Rigidbody velocity. 

private void FixedUpdate()
{
if (_canMove)
{
Vector3 movement = _cameraTransform.right * _direction.x 
            + _cameraTransform.forward * _direction.y;
movement.y = 0f;
movementForce = movement * (moveSpeed * Time.fixedDeltaTime);
_rb.velocity += movementForce;
}
else
{
movementForce = Vector3.zero;
}
if (!IsGrounded())
{
_rb.AddForce(Vector3.down * (gravityScale * Time.fixedDeltaTime));
}
}


Conclusion

For the following week, I will continue to work on the movement code, refining it more and getting more feedback so I could improve the code, and the game overall.






Friday, January 31, 2025

Week 1 - Introduction

Hello!

My name is Sam and I am a game design student at Winchester School of Art, a University of Southampton campus.

This week, I have started a module called Game Development, where I review a game design document made from a student during the last semester and, using that, I will work in a team to make a vertical slice, a small portion of a game that is much more polished than a prototype and is generally used to display the game to publishers or investors. 

But first, my background: I am primarily a programmer, and I have worked with Unity to make a lot of jam games and some school projects. 

I was introduced to the project on Monday, where I was told what would happen with the project, and what I would need to submit. At this point I also looked for a project to work on, I narrowed down the search to genres I liked and would be interested in working on. This led me to 2 favorite games, Esi's and Parker's GDDs.

On Thursday, I had a tech session where Ross introduced the class to Source Control and GitHub. I knew how to use both already, but I helped out 2 other students with learning the software, cloning a Git project and pushing. 

The project started coming together in the afternoon, when I was given a team to work with and a corresponding game. The game I was tasked with working on is a game called Kinetic Panic by Parker English. At this point, I started to look at Parker's GDD page in more detail, now that I know that I would be working on this game for the next couple of months. 

Parker mentioned in one of his blogs that the game took inspiration from another game called Marble Blast Ultra. He said that the game was no longer available but there was another, open sourced version called OpenMBU. I decided to download this version to get an idea of the type of movement that I'll be working with for this game. 

At this point, we were all handed roles. I was given the "Technical Designer", and we all agreed on what parts of the game to work on. I agreed to do the game's movement, rotation and jumping. We also discussed who would create the audio for the game, and what we came up with was that 3 of the team members (me, Esi and Guy) would create the audio when the game's nearer to completion. 

Image

I met up with most of the team the following day, where we agreed on the software package to use for the group weekly blog (Wordpress), and each person's tasks for the following week. 

This is what I need to do for the following week:

- Setup the Unity project, and the corresponding GitHub project.

I am in the process of setting this up, as of writing I am installing the corresponding Unity version that the university computers use, and then I'll go from there with setting up a GitHub repository.

- Create basic movement, including jumping and rotation.

This is the most difficult of my tasks to do, since I'll involve creating new scripts, tweaking and refining things so that the movement feels right, and is also easy and feels good to use.

Along that, I will continue to read Parker's GDD and play games that are similar to the game that I am going to make, I asked Parker and he said that along with what he put in the blog, I could also look at a game called Marble It Up!, which is what I will do.

By the end of next week, I should have a rough prototype of the player character to show here.



This blog is no longer maintained

 Following advice from my teachers, the past and future blog posts of this blog have been moved to my university WordPress page.  https://ye...