From June 25th to July 1st, 2024, myself and three friends participated in the Black Cat Jam, a game jam centred around the simple theme of including a black cat in your game. In just five days, we developed a game called “Cat Island Catalog”, inspired by Pokémon Snap. The objective is to photograph various cats throughout the level, some of which are easily spotted, while others require more effort to find.
Player Camera
A key feature of the game was the Player Camera, whose core component was the ‘Scene Capture Component 2D’. When the mouse left click is pressed, a capture of the scene visible to the player is taken and stored within a Render Texture. To detect a cat within the capture, three checks are performed:
Is Within Range?
Calculating the distance between the cat and the player, the cat is considered within range if the distance is lower than a defined detection length. Since the camera can zoom in and out, this detection length scales with the camera’s field of view, increasing the threshold needed to detect a cat.
Is Within Viewport?
Cats are only detected when they are within a specific region of the screen, making the game feel more like you are actually using a camera. This is determined through a Vector2D, representing a box extending outwards from the centre. The cat’s position is then converted to screen space and checked to be within the box using the AABB algorithm.
Is Obstructed?
By firing a Raycast from the player to the cat, the cat isn’t considered obstructed if the hit result returns the cat actor, indicating that nothing is in the way.
If all these checks pass, a cat is considered photographed. The game mode will then convert the render texture to a Texture2D, storing it within an array along with the cat type.
Conclusion
Near the end of the game jam, we struggled a lot with issues related to null pointers, often caused by systems attempting to reference objects that hadn’t been initialized yet. For my next project, I’ll definitely be vigilant about checking for null pointers and conducting deeper research into the initial execution order of methods like BeginPlay and OnConstruction.
Overall, I’m happy with how this project turned out. Thanks to effective communication and planning, my team and I had a playable version ready within just a few hours of the game jam starting. This project served as a great reintroduction to Unreal for me and a valuable refresher on using C++ with the engine. I had a lot of fun, and I’m excited to start working on the next project.