Hapman 🍩 The Inevitable

Hapman 🍩 The Inevitable

This game is from ldjam.com, which is currently unavailable.
You can try viewing the original page on Web Archive (may not load correctly).
overall: 4.10
fun: 3.79
innovation: 4.25
theme: 4.31
graphics: 4.19
humor: 4.15
mood: 3.73
Try to delay your death, ⚑fly⚑ away from the Monster!

πŸ•ΉοΈ How to play

Collect the ⚑ energy-points from the snack *before* HapMan eats you!

Then press F to use your energy to fly to the next snack! 🍩πŸͺ🍎

⌨️
WalkW A S D
JumpSpace
FlyF
RestartR

▢️ Play in browser!

* Download the Desktop version for better performance.
* Chrome recommended!

πŸŽ₯ Gameplay video:

If you're stuck in the game, you can watch the video to see how it should be played:
https://www.youtube.com/watch?v=eXtJV6pMcFM

🧰 Tools used:

Game EngineOwn made using C++/OpenGL with Lua Scripting
3D modelingBlender 3.1
SoundtrackBoscaCeoil
SFXAudacity
Pixel art UIAseprite


I made this game using my own C++ Game Engine. Most game logic related code is written in Lua.
Please note that the GitHub repository contains commits from *before* the jam started, this was to add new features to the game engine, like physics, controller support, instanced rendering & custom shading.

You can download the game, open the assets folder and edit the scripts.

A few sound effects were downloaded from freesound.org.

πŸ‘¨β€πŸ’» Technical details:

Gravity Fields


The player is able to walk on every side of the food 'planets', without falling downwards. This is done using gravity fields. In the picture you can see the wireframe of the field around the apple. When the player is inside this field, a function specific to the planet's shape will calculate the direction of the gravity. For spheres this is relatively simple, but the game also contains functions for donut, disc and cylinder shaped planets.
This was highly inspired by the way Super Mario Galaxy does this.

Biting off pieces of food


I wanted Hapman to be able to bite off chunks of the food planets.
However, I did not feel like I'd have enough time to create multiple versions of the food models where each version would have a chunk bitten off.

So Instead I wrote a shader hack for the planets, that just discards all pixels that are behind a certain Z value. Adding a sine wave creates the teeth pattern:
```C++
void main()
{
#ifdef BITE

float biteDiff = v_position.z + sin(v_position.x * 3.f) - biteZ;
if (biteDiff > 0.f)
discard;
#endif

vec3 albedo = diffuse;
...
```
To make sure the player cannot walk on the part that was bitten off, I just forced the players Z position to be after the bite:
```lua
setUpdateFunction(player, 0, function()

local trans = component.Transform.getFor(player)
trans.position.z = math.min(_G.biteZ - 1, trans.position.z)
end)
```

Giving the player a better sense of their position


Inspired by the way modern 3D mario games do this, I implemented a trick that better communicates to the player where their position is in relation to the floor. It works by casting the player's shadow in the direction of the gravity, instead of the direction of the sun. In the 'after' image, you can see that it is much more clear where the player would land after the jump:

BeforeAfter

All feedback is welcome!

Twitter
Found a bug?
Tell us on Discord