Pumpkin boy
Project Details
Development Time: 2 weeks
Team Size: 8
Engine: Unity
Programming language: C#
Main contributions: Player movement, head throwing (Projectile Motion), and box pushing
Pumpkin Boy Repo
About
Pumpkin Boy is a 3D puzzle we developed in 2 weeks total as it was to be shown at Museum of Technology in Stockholm.
We were 8 people in total working on the game: 3 designers, 3 programmers, and 2 artists (listed in Team section at the bottom.) Jason F Ruta S
Implementation
Movement and Box pushing
Body Movement & Box Pushing
Head Movement
Movement
The character’s body has 1:1 movement without any kind of acceleration or drag and can walk up and down slopes. The head will collide with walls while attached, forcing the player to drop it to go through small gaps.
The character’s head is moved using by adding forces to it. To make it easier to stop in the position you want the velocity is quickly reduced through code if no input is given.
Box Pushing
The designers wanted to have boxes that could be pushed or pulled around, and that they should “feel” like boxes (if dropped on a ledge they should start rotating and fall). The first iteration I did was to just apply a velocity to the box based on the player’s movement and to lock the player from rotating while doing so. This sort of worked, but the box would tumble around when pushed as the friction of the ground would have affect it and small bumps would sometimes cause the box to fly off.
The solution I used, in the end, was to lock the player rotation, turn off gravity and make the box kinematic, and then move the box based on the character movement and the initial offset the box had to the player when it was grabbed. To prevent the player from placing the box inside walls I checked for box collisions from the character using the size of the box and the velocity of the player, and if the “collider box” would overlap I prevent the player from moving in that direction.
Head Throw
Head Throwing & Pickup
To throw the head we start by removing position/rotation constraints and enabling gravity, un-parent it from the body, and then apply a force to it. The angle at which the head is thrown is based on the duration that the throw button is held, it starts at 0 and increases until a specified max-value (which we had set to 60 degrees in the build), after which it locks for a few seconds and then reverses back to 0. The line shows the trajectory the head will have in the air, and is calculated by using the projectile motion formula with an assumed air resistance of 0. Additional points were added to the line to show points beyond the starting height, and if the line were to intersect a collider it stops at the collision and the point is used as the final point for the line.
In the video below the throwing preview is permanently enabled, in the released build the line is disabled when the character is not actively charging the throw.
Learning Outcomes
This was the first gameproject I did as part of the Futuregames education. Prior to this project I had not really collaborated with other programmers, which was something that I found really insightful. I also got to look up some physics formulas I had not used in a long time and never used in a game context, which needed some adapting to get into a working state. The code itself I feel could be massively improved upon, but at the same time I’m happy with what I was able to write in the 2 weeks with some days being lost to planning and other events we had to attend.
Team
- David Bång
- Ruta Sapokaite
- Jason Sandelin Francis
- Joshua Ásberg
- Set Engberg
- Dani Vitelli
- Sandra Pärnaste
- Wiktor Kaluba