Inspiration

I wanted to make something that would be hard but also fun to create. I read the rules of the competition and I decided that I want to use as little external code as possible. I decided that opengl and Vulkan was bloat so I wanted to code like it was 1992. I opted to make a 2.5D game since that would only require a window to function (minimal libraries). I wanted to make it on spongebob because I have this image on my phone that has an evil and MESSED UP version of spongebob saying "im evil -----" and I liked that photo a lot.

What it does

Evilbob is a horror game where you have to complete the closing routine in the Krusty Krab. You think you're safe but uh oh! evilbob HATES you and is gonna get you so you have to survive evilbob because hes evil. I'm evilbob i like to scare and when i scare i turn to a nightmare youre in the krusty krab probably gonna die and you will die because you wont survive im evilbob im a sponge and when you die you turn into a sponge so survive the night because im really scary im friends with a murderous blue bear

How I built it

  • For the window, I used a minimal library called minifb (mini framebuffer). It lets you draw a pixel buffer to the screen and polls input. It does not do anything else.
  • For audio, I used miniaudio (no correlation to minifb). It allowed me to play sound throughout the game.
  • The image loading is in house - I iterate through a tga file and load that in. The images are flipped 270deg for performance (cache misses are bad)
  • The bitmap text rendering is in house - i use an image atlas with predefined dimensions to blit each character
  • The raycast drawing is in house - For every pixel on the screen, I cast a single ray out and let it find a wall. It takes the distance to that wall from the camera and draws in a vertical line.
  • Nearly all drawing is mutlithreaded because GPU's highkey had a point with that. Drawing is optimized to take place vertically (hence the flipping of the images for contiguous y pixels)
  • I used Zig 0.15.2 as my language of choice.

Challenges I ran into

  • Zig. Zig is a very niche language. Not much is known about it and there are very little resources online. I would have to go out of my way to figure things out. I even joined their discord just to be able to find more help.
  • Zig arrays. No stop please no more slices no more casting just let me assign my array i dont know what youre talking about stopppp😭😭😭😭😭😭😭
  • Getting the multithreading properly to work was annoying.
  • Rendering the walls, floors, and ceilings was a challenge because thats just properly difficult math.
  • The input was hard because minifb doesnt read in raw input so I had to convert the typing input into game compatible input. Also, when using letterboxing, the mouse isnt adjusted properly so I had to manually fix that.
  • Minifb is a C library. Zig being a niche language means that there are only so many bindings out there. I had to create a wrapper for minifb. I was my first time doing something like that so it took me a good three days to figure out the zig build system and it's C interop.
  • Time constraints. My schedule is fairly busy so it was hard to balance this project and my life

Accomplishments that I AM proud of

  • I am proud of the performance it achieved. I think it was smart to go straight for multithreading without having to worry about it later. The game gets a clean 60fps at a resolution of 800x600.
  • The architecture. I think I did a good job at organizing my code in a way that zig likes
  • Allocators. One of Zig's biggest feature is their allocators and I think i used a wide variety of them throughout the project. I saw on reddit that only super smart people can use the allocators right and that made me blush lowke.
  • bear 5. I like the bear 5 easter egg that i added because bear 5 is very funny
  • cutscene. that cutscene when you win was really cool and i like how it turned out.

What I learned

  • I learned how to navigate the zig build system. It was VERY foreign to me before but after trying to make the minifb bindings, I became very familiar with Zig's build system and I feel confident with it now.
  • Zig. There was a lot for me to learn about Zig. I could only sort of use it before this. I thought it was clunky and felt bad to write but now, I enjoy writing in Zig. I hope to keep using it and maybe as good at it as I am C# or C++. Instead of there being an 100% chance of me compiling with syntax errors, theres only 70%!
  • ImageMagick. I used ImageMagick a good deal for turning my png's into tga's. I didnt know how to use it before but now I do.

What's next for Evilbob

  • you know that episode where mr krabs opens a hotel? that might be cool as a new map.

Built With

Share this project:

Updates