Code a 2D Game Engine using Java – Full Course for Beginners

Ecommerce Empire Academy

Learn how to program a 2D game engine from scratch using the Java Programming Language. You will use the game engine to create a Super Mario Clone but the engine can be used to create other games as well.

💻 Code:

✏️ Course created by GamesWithGabe. Check out his channel:

🎥 Part 2 (final hour of this course):

⭐️ Course Contents ⭐️
⌨️ (00:00:06) Introduction
⌨️ (00:07:54) Setting up the Window with LWJGL
⌨️ (00:25:20) Adding Event Listeners with GLFW
⌨️ (00:51:42) Creating a Scene Manager & Delta Time Variable
⌨️ (01:11:26) How OpenGL Graphics Programming Works
⌨️ (01:32:53) Drawing the First Square
⌨️ (02:02:56) Regexes and Shader Abstraction
⌨️ (02:24:25) Game Camera OpenGL
⌨️ (02:47:47) GLSL Shaders
⌨️ (03:08:45) Texture Loading in LWJGL3
⌨️ (03:36:02) Entity Component System
⌨️ (04:06:25) Batch Rendering in LWJGL3
⌨️ (04:50:00) Resource Management in LWJGL3
⌨️ (05:05:30) Texture Batching
⌨️ (05:38:48) Spritesheets
⌨️ (06:01:12) Dirty Flags in Rendering
⌨️ (06:23:17) Alpha Blending and Z-Indexing
⌨️ (06:38:56) Integrating ImGui
⌨️ (07:01:56) ImGui Fonts and Scene Integration
⌨️ (07:19:43) Serialization with Gson
⌨️ (07:42:48) Deserialization with Gson
⌨️ (08:06:03) Exposing Variables to the Level Editor
⌨️ (08:25:29) Converting Screen Coords to World Coords
⌨️ (08:49:27) Drag 'N Drop Level Editor
⌨️ (09:15:25) Debug Drawing Functions
⌨️ (09:47:35) Snap To Grid Tool
⌨️ (10:10:25) Debug Drawing Boxes and Circles
⌨️ (10:28:58) Framebuffers in OpenGL
⌨️ (10:52:56) ImGui Docking in Java LWJGL
⌨️ (11:11:55) Adding a Game Viewport
⌨️ (11:34:51) Mouse Screen Coordinates to Game Viewport Coordinates
⌨️ (11:50:01) Pixel PERFECT Mouse Picking
⌨️ (12:23:39) Enabling Mouse Picking and Code Maintenance
⌨️ (12:35:16) Editor Camera Controls with Lerp
⌨️ (13:01:48) Coding Gizmos
⌨️ (13:31:03) Translate and Scale Gizmo
⌨️ (14:04:29) Properties Panel
⌨️ (14:33:53) Integrating JBox2D in our Engine
⌨️ (14:54:53) Event System and Box2D Physics
⌨️ (15:19:09) Adding an Engine Runtime (Play/Stop Buttons)
⌨️ (16:10:10) Refactoring and Physics
⌨️ (16:40:28) Font Rendering
⌨️ (16:43:34) Beginning Scene Hierarchy & ImGui Upgrade
⌨️ (17:00:38) Scene Panel Drag & Drop (ImGui)
⌨️ (17:18:31) Even More Bug Fixing
⌨️ (17:44:51) 2D Animations
⌨️ (18:18:29) Sounds with OpenAL
⌨️ (18:44:27) Improving the Editor
⌨️ (19:21:24) How to Use Box2D Physics
⌨️ (20:06:12) Pillbox Colliders and Player Controllers
⌨️ (20:45:32) Variable Length Jumps
⌨️ (21:25:28) Powerups
⌨️ (21:51:52) Goomba AI
⌨️ (22:29:59) Mario Pipes & Editor Improvements
⌨️ (23:01:59) Game Camera & Grid Lines
⌨️ (23:28:28) Mario Turtle AI
⌨️ ( ) Adding Flag Poles to Mario
⌨️ ( ) Fireballs and Bug Fixes
⌨️ ( ) The LAST Episode and Distributing your Game

🎉 Thanks to our Champion and Sponsor supporters:
👾 Raymond Odero
👾 Agustín Kussrow
👾 aldo ferretti
👾 Otis Morgan
👾 DeezMaster

Learn to code for free and get a developer job:

Read hundreds of articles on programming:

And subscribe for new videos on technology every day:

51 thoughts on “Code a 2D Game Engine using Java – Full Course for Beginners”

    1. @Hema Thiruvengadathan these are obviously recorded in parts, you can find that in his channel

    1. @GoldSpark That’s why I mentioned the Mario tutorials in JavaScript. They go step by step & it’s not 24 hours long.

    2. @20 Ice you’re concerned with the wrong thing. It’s about the quality and knowledge gained. This is about building a game engine in Java. It’s a marathon not a race. Oy

    3. @hackerprincess You might be right… but have you started the tutorial? Is it really quality? Just because something is long doesn’t make it better.

    4. ​@20 Ice If you’re just wanting to make a quick playable mario game this may not be fore you.
      Just hit more on the info and you can see all the things he covers; to make a game engine, a game, and level editor, packaging and distribution.
      I like it because is more than just making a game. It is a pretty in depth video that goes over the code and explanations regarding the code, how it translates to the user’s device. Also he tests with trial and error as he progresses.

  1. Thank you so much for hosting my videos on your channel Beau! And not only hosting them, but taking the time to put them all into a giant video! I hope anyone who watches this is able to find some use out of the series, and if you want to go more in depth about game engine development, I can’t recommend “Game Engine Architecture (3rd Edition)” by Jason Gregory highly enough (it’s a big blue book :).

    I’m also working on a new series that goes in depth on how to code a Minecraft clone. It only has two episodes out right now, but if this is something that interests you, feel free to drop by the channel. Once again, thanks for all the work you put into combining these videos together Beau!

    1. This is insane that you were willing to do this! It must’ve taken a lot of effort! You’re very talented.

  2. Currently I am trying to develop a bouncing ball game by using design patterns in java. So, I can’t imagine how much background needed for such a mario game in 24 hours. This is not a lecture this is a show.

    1. WhatsApp➕➊➌⓿➊➌➏➌➏➋➒➌

      For more information dm👆

  3. Really helpful , need more like this…
    Giving thanks from every cell of my body…
    Really great job…
    Feedback- if u first show a roadmap for all the things you used and a short or tutorial type on those concepts then that would be even more better..
    But still thanks man..

    1. WhatsApp➕➊➌⓿➊➌➏➌➏➋➒➌

      For more information dm👆

    1. @Daniel Muñoz java is not native code machine it’s run on the JVM that’s impact a lot the performance

    2. @Kevin he’s alright I like java bit it’s unnecessarily complex and that’s not help you to logic focus

    3. @nasri Marc its 2022, you really think java is only JVM? JIT and the like are a thing.

  4. Me watching: this is so cool I want to learn how to do it too.
    1 hour later: learning for loops

    1. WhatsApp➕➊➌⓿➊➌➏➌➏➋➒➌

      For more information dm👆✌️

  5. Insane! That these content are free. I wish companies can look at job candidates differently these days because degrees are not needed to do a job well.

    1. 杨睿Felipe

      @RegiRuler that’s what people don’t understand, a person without a degree can obviously be better than someone who owns one, but it just takes triple the effort, if not more. The thing is, some companies just don’t want to take the risk.

    2. @John Perez I just checked on indeed, the 4 major bank still require a degree in relevant field. What are you talking about?

    3. I work at a pretty famous game studio. Half of my coworkers don’t have degrees. The ones that do are the Principle engineers who design all of this stuff from scratch, but the gameplay engineers and such don’t.

    4. @RegiRuler yap, there’s a big different with peoples that goes to campus for degree and didn’t. Let’s take a little example, if A, want to get a job in a single matter time, then he need to get a course that teach him how to build a project, while B, want to know how the curriculum, the structure, and the fundamentals, then choose a degree. I believe google gonna choose person with MIT degree instead of person with a single course certificate..

    5. I think doing both works best. Work hard enough to go where you want to study the way you want. Youll be lucky to enjoy your uni life and work for a job.

  6. You guys are amazing, thank you so much for sharing knowledge for free on YouTube! 🔥 ❤️

  7. JohnnyFrickinRico

    Great Video! I like how you are using existing classes and libraries for this tutorial. As one of my favorite C++ programming instructors would also say ” in programming never re-invent the wheel”.

  8. For those who don’t know, GamesWithGabe is a great channel, you should definitely go and check it out! These days he’s making a Minecraft clone(A fully fledged game rather than a simple random world generator) with a unique teaching style. I hope all the best!

  9. Very useful and insightful. I would like to see more of such videos as I am currently developing a game in Android.

  10. Devils Advocate

    Incredible. As a mid-30s year old guy who is self-learning I find this type of content to be invaluable.

  11. This seems extremely informative, the only problem I have is I am unsure which files I should be downloading without having to search and hope I am getting the right stuff to properly follow along with this course

    In any case I appreciate such a thorough (I think) walk through of what needs to be done with the tech available to us now to achieve similar results. Thank you!

  12. This is insane…23 hrs content !!!!! Huge respect for free code camp and the content creator…..🔥

  13. For people with a different version of inteliJ at about 2:10:00 when he’s mentioning about modifying VM options (if you’re not seeing VM options available for modifying, you will just need to click Modify options and check Add VM options)

    1. thanks, I knew checking the comment section in this type of video will help a lot regarding changes in the ide and stuffs

  14. Great video thanks for share your knowlegde. the key question here is, why did you use LWJGL instead of LibGDX? Thank you man.

Comments are closed.