About The Project

Description

Space Keys is a captivating game that challenges your rhythm and reflexes. Your mission is to catch as many celestial music objects as possible, by navigating two UFOs through space using webcam-based hand tracking technology. Scores ranging from "Stellar!" for perfect catches to "Lost in space" for the occasional miss add a dynamic layer to your interstellar journey. Each successful catch not only contributes to your score but also enhances the song, creating a harmonious symphony that evolves with your skill. Are you ready to listen to some great music on your journey through space?

Motivation

For this project we wanted to do something that was just for fun and could be taken in any creative direction that we wished for it to go, and which didn’t speak to any bigger cause or was meant to inform people. Another requirement we had was to not be limited by access to hardware, as our previous project had provided some limitations in that regard. Finally, we wanted to work with game logic and include sound from the very beginning, instead of it being an addition towards the end.

The Process

Technology Used

  • Unity is a real-time development engine made for facilitating collaboration and building games and other interactive experiences. It was used to host the game world, because we had previous experience with Unity within the team.

  • Blender is a free and open source software commonly used for 3D modeling and animation. We used Blender to create our own 3D models which we could import into Unity, and we opted to use this tool because we had experience with this within the team too.

  • FMOD is an audio system that is easily integrated with Unity, and this was used for adding music to our game.

  • Mediapipe for Unity is an existing solution which enables, among other things, hand tracking using webcam. On top of this solution we also built our own algorithms to decide the position of the center of a tracked hand, as well as to detect when the user makes fists with their hands.

Challenges and Obstacles

As with any project, we of course faced difficulties along the way with Space Keys. Initially, we intended to have people interact with the game using a smartphone, and we thought this could be accomplished by using data from the built-in accelerometer sensor. We tried this approach, but had to let go of that idea as we couldn’t find a suitable way to accomplish the interaction we wanted using this method. It was challenging to spend a lot of time and effort on researching how to firstly connect the smartphone to a laptop using a client-server architecture, and then how to use the accelerometer data in a reasonable way, only to have to scrap the entire idea in the end. It has also sometimes been challenging to coordinate the work on this project, as our group was comprised of 6 people, who all had very busy schedules.

Lessons learned

One thing we learned from this project is that it can be a good idea to limit the amount of time spent on researching something, so that there is still time for whatever else needs to be done. Additionally, it is good to try to plan when to meet ahead of time, or set a recurring time each week for example. Because although we continuously used Discord to keep each other updated on progress made or issues we faced, we would sometimes need to have a more thorough discussion to be able to make decisions. And that can be incredibly hard to find time for, when you are this many people, who are all very busy with other things as well.

Possible future development

  • The only thing players struggled with was the point of view of the camera which made it hard to understand what was in front and what was behind which made it difficult to target objects accurately and led to missing many easy targets. One of the suggestions we got was to take the camera further away and to add orthographic projections of shadows or "shinings" of the stars/notes on the grid walls to allow players to better orient themselves.

  • There could be more advanced effects when a game object is interacted with, e.g. something that indicates even more clearly that you managed to catch it.

The making of Space Keys

Team

Akshata Murdeshwar

akshata@kth.se

User Interface

Since the overarching theme of the game was neon and retro, much like old arcades, we followed the same for the GUI of the game. The UI's main purpose was to provide instructions, remind players of possible actions, show progress, and give feedback. There were two elements that received special attention:

  • Text

    Each text element was mostly white with 2 undertones of other colors - one darker and one lighter - to give it a 3D feel. The font chosen was bold and in capitals. This choice was based on the fact that a lot was happening on the screen at all times in terms of light as well as movement. Hence, the text needed to be clearly visible without a lot of effort.

  • Icons

    The icons were instrumental in communicating instructions clearly. Since our interactions were mostly based on hand gestures, we used bold white line icons of hand positions and gestures with text to support the same.

General Art Direction

I made mood boards and collected resources to anchor our graphic elements, as well as made sketches of possible stage arrangements, the first mock-up of decoration around the stage, and developed emissive materials and explored their use within the game for beautification and graphic enhancement.

3D Modeling of Elements

I created the prism shaped game objects, and a 3D model of an asteroid field, which was accompanied by a Unity script to animate the asteroids. I also created a black hole, by using a free Unity shader and modifying it to suit our needs. I also used particle systems restricted within a sphere for the star clusters.

Evaluation and Documentation

I also conducted evaluation during testing, and edited the making-of video.

Jacky Liu

hjjliu@kth.se

Server-Client Architecture

Initially, we wanted the player to be able to control the UFO by using their phone. When the player moves their phone up-and-down or left-to-right, so would the UFO in-game. A server was set up so the player could connect to it. Once connected, the player’s phone would send its gyroscope and accelerometer data to the server and update the UFO’s position accordingly. However, we quickly found out that this method is too imprecise, as the data contains too much noise.

Hand Tracking

In the end, we decided to use hand-tracking for controlling the player movement. We made use of MediaPipe’s Framework and their pre-trained solution for Hand-landmark detection. Using MediaPipeUnityPlugin as the base, we further modified it to suit SpaceKeys needs. I was in charge of importing this framework, making sure that we can accurately control the UOF’s position using hand-tracking and then handed it off to the other teammates for further adjustments.

3D Modelling and Visual effects

The shield was modeled in Blender, by taking a sphere and then subdividing the surface to get individual hexagons and pentagons. The UV shield texture was then further modified in Krita, to get a highlighted outline. Using Unity’s ShaderGraph, we control the color and the oscillation effect of the shield. To render the following music objects: Nebula, Quasar and Supernova, a method called Volumetric Raymarching was used. By using volumetric textures, we can determine the density of the cosmic clouds at each pixel. Using this density, we can then deduce the color for that pixel. To get the volumetric textures, we first modeled a cloud in Houdini. Houdini provides a convenient function to create clouds out of geometries using noise (Cloud geometry node). After tweaking the noise parameters, we can then export the model as a Volume Texture using the Volume Texture Export geometry node.

Linnéa Gustafsson

linneag2@kth.se

Audio-Visual Mapping

Since the audio is a central part of this game, it needed to be properly and intuitively integrated into the experience. The melody pitch and brightness were spatially mapped to the horizontal and vertical positions of the melody objects (stars). The colors of music objects also had an intuitive mapping based on audio-color mapping research. The choice of which space objects to use for which music object was also made with logical reasoning behind it: hard objects (asteroids) for drums, single stars for melody and multiple stars for harmony, a black hole for the low-pass filter (absorbing the song’s top frequencies), etc.

Audio Composition

We created our own music and background audio. It comprises 18 audio files created in Logic Pro and four audio effects applied in Unity. The song was designed in Logic Pro, and exported in shorter samples that were then looped and triggered in Unity at the right positions in time.

Audio Programming

For the audio programming, the Unity audio system FMOD was used. The audio can be divided into background audio and game audio. The background audio is triggered regardless of the user's actions – spaceship sound, drums, bass, and some harmony. Game audio is triggered as the user collides with specific music objects. The generation of music objects was programmed as a low-level version of a MIDI editor, with a function triggering a specific music object at a specific time and (x, y) position. The game audio consists of melody, harmony, “space probe” audio, and sound effects (reverb, low-pass filter, high-pass filter, and flanger).

Saga Palmér

sagapa@kth.se

Game Logic

Responsible for the overall logic of the game itself, and for putting it all together. I created the main scene with a star particle system as a background, and generated the procedural circular grid. I also added and generated the music objects in the given sequential order, was responsible for creating the collision logic, and syncing it all with the music.

Visuals

I added the UFO player object, and created light rings from the music objects and the UFO on the circular grid, to provide players with support to understand the positions of the UFO and the music objects coming towards them.

Game Testing

Tested the game and fixed miscellaneous bugs throughout the project.

Shiqi Gong

shiqig@kth.se

User Interface

Established the functional framework of the user interface and was responsible for collaborating with the UI designer to bring the design elements into that framework. Completed the development of the game user interface, including the Home Scene, Main Game Scene, and End Scene.The user interface also has implemented multi-resolution adaptation on different devices.

Game Logic

Designed the game's scoring rules and created the animations for the game score and score changes. I also wrote a GameManager to control the main logic of the game. This includes the game's pause, resume, scene transitions, etc. MediaPipe's Unity plugin does not have a hand gesture tracking solution. Therefore, I developed a gesture detection feature based on the hand-tracking solution for detecting fists.

Game Testing

Responsible for testing and debugging the main scene after merging it, and fixing problems caused by the code and scene merging.

Sofia Bergqvist

sobergqv@kth.se

Interaction

Researched client-server setup, and attempted to create a suitable interaction using an Android unit. When switching to hand tracking instead of the android unit interaction, we initially intended for people to use only one hand. However, we decided it felt unnecessarily restrictive to play using only one hand, and so we wanted to switch to a two-handed interaction. I was responsible for making that switch, making sure that we could keep track of which hand was left and which was right, updating the scene to contain two player objects (UFOs), and adding functionality to keep track of which hand controlled which UFO. I also made a back-up interaction using the keyboard.

Miscellaneous

Responsible for debugging the use of webcam in the built version of the game, and to start merging things that were finished into a complete scene in earlier stages of the project. I was also responsible for creating the project website.

References and Resources

3D Modeling and Game Objects

Aqsa Nadeem. (2022, February 8). Stars VFX Unity Particle System || How to make a Stars vfx effect in unity Particle System VFX. [Video]. YouTube. https://www.youtube.com/watch?v=-u2YKlMHoS4

xOctoManx. (2015, September 1). Unity 5 Tutorial: Particle Systems #04 - Sparkles. [Video]. YouTube. https://www.youtube.com/watch?v=UHCwUMJOFsc

World of Zero. (2016, December 7). Manuel Particle Emission in Unity - Lets Make Data Sphere - Part 1. [Video]. YouTube. https://www.youtube.com/watch?v=7ZGJlSCcp1c

Sketchfab - SebastianSosnowski. Star Cluster - 15k stars model. Free 3D model. https://sketchfab.com/3d-models/star-cluster-15k-stars-model-51148b78a37a4a72b22d8e06f4293e07

GitHub - merpheus-dev. BlackHoleShader. https://github.com/merpheus-dev/BlackHoleShader

Simon Van Schuylenbergh. (2023, August 11). Real-Time Black Hole in Unity | EP 1: New and Improved Shader. [Video]. YouTube. https://www.youtube.com/watch?v=MO-s8uf4rX4

Mert Kirimgeri. (2019, May 13). UNITY SHADER GRAPH with Black Hole Shader. [Video]. YouTube. https://www.youtube.com/watch?v=SWJZcQvTmnw

Turbosquid - Mykhailo Ohorodnichuk. 3D asteroids pack model. Free 3D model. https://www.turbosquid.com/3d-models/3d-pack-asteroids-model-1411080

Pixel Mystique Games. (2019, July 22). ProBuilder Unity | Creating Basic Shapes. [Video]. YouTube. https://www.youtube.com/watch?v=yqL_9eEDm2E

Unity Asset Store - PULSAR BYTES. Starfield Skybox. Free asset. https://assetstore.unity.com/packages/2d/textures-materials/sky/starfield-skybox-92717

Bacosil. (2022, March 24). Complex Shapes Made Easy E04 ( blender tutorial ). [Video]. YouTube. https://www.youtube.com/shorts/0lVPWqfLdpc

Mohammad Faizan Khan. (2020, June 6). Unity3d Animation - Cube Rotation With Animation. [Video]. YouTube. https://www.youtube.com/watch?v=2bwH9gudwCk

Unity Asset Store - Evgeny Pritula. Magellan. Free asset. https://assetstore.unity.com/packages/3d/vehicles/space/magellan-98970

Networking and Client-Server Setup

Unity. Simple client and server. https://docs.unity3d.com/Packages/com.unity.transport@2.0/manual/client-server-simple.html

Unity. (2023, November 8). About Netcode for GameObjects. https://docs-multiplayer.unity3d.com/netcode/current/about/

Unity Forum. (2020, May 11). Tutorial for Input System and Accelerometer / Gyro? https://forum.unity.com/threads/tutorial-for-input-system-and-accelerometer-gyro.887758/

Body Tracking

Unity. Body Tracking. https://docs.unity3d.com/Packages/com.unity.mars@1.5/manual/BodyTracking.html

ganthefan. (2023, June 4). Realtime Full-Body Tracking via Webcam! | Google MediaPipe Pose, Unity, Open Source. [Video]. YouTube. https://www.youtube.com/watch?v=ZKpModYuOpg

GitHub - ganeshsar. UnityPythonMediaPipeBodyPose. https://github.com/ganeshsar/UnityPythonMediaPipeBodyPose

ganthefan. (2023, August 18). Full-Body Tracking with Avatar via Webcam! | Google MediaPipe Pose, Unity, Open Source. [Video]. YouTube. https://www.youtube.com/watch?v=icS2yforZpw

Simple AI Web Application. (2023, March 4). OpenPose vs MediaPipe | A Comparative Analysis. [Blog Post]. Retrieved from https://saiwa.ai/blog/openpose-vs-mediapipe/

GitHub - homuler. MediaPipeUnityPlugin. https://github.com/homuler/MediaPipeUnityPlugin/wiki/Getting-Started

Lighting

AIA. (2021, September 21). Make a Unity Glow Effect in 15 seconds. [Video]. YouTube. https://www.youtube.com/watch?v=kG-jsuTl1Hw

The RealTime Essentials. (2021, November 5). How to Use EMISSIVE MATERIALS in Unity! Step by Step Tutorial. [Video]. YouTube. https://www.youtube.com/watch?v=2PBgCl-zIZQ

Clipper. (2020, January 9). POST PROCESSING COURSE - UNITY. [Video]. YouTube. https://www.youtube.com/watch?v=lB24Mh27Kas

Unity. (2022, November 10). Lighting tutorial: 4 techniques to light environments in Unity | Unite 2022. [Video]. YouTube. https://www.youtube.com/watch?v=DlxuvvYZO4Q

Graphical User Interface

Flaticon. Protest free icon. https://www.flaticon.com/free-icon/protest_2865701?term=fist&page=1&position=2&origin=tag&related_id=2865701

Flaticon. Hand Up free icon. https://www.flaticon.com/free-icon/hand-up_4509289?term=volunteer&page=1&position=5&origin=tag&related_id=4509289

1001 Fonts - Maiko Hatta. ROSEMERO EMPEROR Font. https://www.1001fonts.com/rosemero-emperor-font.html

Audio

FMOD for Unity. https://www.fmod.com/unity

GitHub - shapedbyrainstudios. FMOD Audio System. https://github.com/shapedbyrainstudios/fmod-audio-system