Settings

Theme

Show HN: The full source code and assets for my custom game engine and game

128 points by mknsri 2 years ago · 37 comments · 1 min read


I always enjoy reading posts about indie game development and looking at the source code of games other people have built. So for any game I release I naturally I want to do the same.

https://github.com/Mknsri/HockeySlam

Hockey Slam is a hockey shootout game on Android which I built almost from scratch. Some of the engine features include 3D graphics with PBR materials, a rudimentary physics system, replays, a multithreaded job system and a hot-reload DLL platform for developing on Windows.

I detailed the creation of the game in it's own post, but now that time has passed I am releasing the source code and assets under the MIT license. You can still find the making of here: https://hockeyslam.com/makingof

I'm happy to answer any questions you might have.

funcantor 2 years ago

You should probably give credit to Casey / Handmade Hero with regards to your windows platform code. Well its kinda scattered around, so probably just credit in general.

  • mknsriOP 2 years ago

    True, Casey/HH was a huge inspiration and the project started from following the first few days of Handmade Hero. I should mention it.

  • Solvency 2 years ago

    So... not from scratch?

    • becquerel 2 years ago

      Here 'from scratch' probably means 'from fundamentals', e.g. without a prefab game engine, as opposed to 'taking no inspiration or lessons from anyone else or using any library code written by other people'.

      Though that would be one hell of a project.

      • mknsriOP 2 years ago

        I mentioned in a couple of places that I did use other people's file loading libraries (mainly Sean Barrett's excellent stb libs).

        “If you wish to make an apple pie from scratch, you must first invent the universe” :)

        • rootlocus 2 years ago

          > “If you wish to make an apple pie from scratch, you must first invent the universe” :)

          This is something I posted on Casey's first handmade video, together with some counter arguments to his rant on the shortcomings of c++ and windows. He has since disabled comments.

AustinDev 2 years ago

I work in tools for game devs and it's great to see more open-source work like this it's very hard to find good modern open-source game examples.

  • mknsriOP 2 years ago

    Thanks, it's not the cleanest code and for example my immediate mode GUI is nowhere near IMGUI but theres still plenty to look at.

bootloop 2 years ago

Any idea what you would have to do to get it running on iOS?

Did you release it? If so, how is it doing compared to your expectations? (I looked for it on the Play store but couldn't find it)

  • mknsriOP 2 years ago

    You would have to write the platform code for iOS similarly to how the Android and Windows is written. The initial idea was to release it on iOS as well but at the end I didn't want to invest in buying a Mac, the license and the time to port it.

    Edit: As for the release, I think it barely broke a couple of hundred downloads. I didn't do any real marketing and had no real goal of really getting the game out there as it was a learning experience for me first and foremost.

  • ribs 2 years ago

    Maybe compile it for Webassembly?

ne0flex 2 years ago

More of a general nooby question: what would be a good way to read through code like this? Where to start? How to understand what's going on and when? etc.

axus 2 years ago

Congrats on finishing the game, it's an accomplishment

  • mknsriOP 2 years ago

    Thanks! Finishing such a large project feels great and you learn a lot when you have to implement so much you take for granted when using things other people have built

    • dcuthbertson 2 years ago

      Yes, congratulations on finishing the game! Also, thank you very much for sharing the story of making it. I'm more inspired than ever to keep dev logs for the little side projects I work on. It's important to keep track of progress, reflect on where you were early on, and see how far you've come.

fwsgonzo 2 years ago

I'm also making a game from scratch and reinventing wheels. What is the processing that you are doing for GLES? I see the GLSL_PREPROCESS in the GLSL.

  • mknsriOP 2 years ago

    I wanted to include common code for all shaders in a simple way, but I was too lazy write a proper parser. So instead I used the C++ preprocessor and macros to include things from common shader code and combine them in the build step.

    • corysama 2 years ago

      FYI: https://docs.gl/es2/glShaderSource takes an array of strings and just internally appends them together. So, rather than trying to #include common code for all my shaders, I just pass a common_code_string and a shader_specific_code_string every time.

      • mknsriOP 2 years ago

        I could have definitely used that and I'm surprised I didn't realise it when researching how to include shader code. Luckily my setup required very little work and with my system I could share snippets between GLES and GL.

dumdumchan 2 years ago

Why did it get deleted from Play Store?

  • mknsriOP 2 years ago

    The HTTPS certificate expired on my privacy policy page and Google delists the app when that happens. After you renew they require that you resubmit the app and I didn't bother since there were barely any downloads then.

idrios 2 years ago

You wrote an Android app in C++.

...how!? How did you even learn how to do this? I've never seen a github repo or documentation or tutorials that even mentions doing this. Nothing on the developer.android website, nothing in any YouTube tutorials. I'm blown away.

penjelly 2 years ago

if youre wondering why its not on the play store

> The game has been since delisted on the Play Store, however you can download the APK here.

  • mknsriOP 2 years ago

    Yeah the privacy policy page had an expired certificate and Google delists the app automatically when that happens.

ezekg 2 years ago

Very cool. Can you point me to the main game loop? I usually start from there when reading source code for games, but I'm having trouble finding yours. Probably just my inexperience, but any links would be great.

rudedogg 2 years ago

Congratulations on releasing your game! Doing this all yourself is a major achievement.

Also, the graphics look great.

  • mknsriOP 2 years ago

    Thanks! I got help for the 3D models and they turned out great.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection