I made my game engine

Поделиться
HTML-код
  • Опубликовано: 26 авг 2024
  • Discord / discord
    Patreon / benblodgett
    Engine benjaminblodge...
    Tamkish Music tamkish.bandca...
    I made my own 2D game engine / framework / renderer using OpenGL with the help of learnopengl.com and various sound and text rendering libraries. It ended up being a very simple project and I even made a game with it. Although I did not include that in this video. I am somewhat proud of the engine itself but mostly I am glad I undertook this project because of how much I've learned and how much that new knowledge informs me when working in higher level tools. Basically after working on this I'll have no trouble working with Unity or Godot even if the workflow isn't 100 the way I'd like it to be.

Комментарии • 59

  • @scottcastle9119
    @scottcastle9119 Год назад +20

    More and more people are building their own engines, I think this is a new flex and I’m loving the tread.

  • @NinjacksonYT
    @NinjacksonYT 2 года назад +73

    Impressive, very nice... let's see Paul Allen's engine.

    • @LordOdin
      @LordOdin 2 года назад +2

      beautiful comment

    • @fueledbycoffee583
      @fueledbycoffee583 Год назад +4

      O my god... It even has ray tracing!

    • @lilboiUK
      @lilboiUK Год назад +1

      Look at that subtle off-white coloring. The tasteful thickness of it. Oh my God, it even has a watermark...

    • @sweettea-hv1ls
      @sweettea-hv1ls 9 месяцев назад

      Look at that commented modular architecture of source files. The tasteful minimalism of it. Oh my God, he even implemented ECS

  • @Soykaf_
    @Soykaf_ 2 года назад +2

    Very cool Ben, Very cool. definitely bought that 200$ source.

  • @J.E.L.2658
    @J.E.L.2658 Год назад +2

    Now you gotta host a game jam with it

  • @jankajura5922
    @jankajura5922 Год назад

    man, not gonna lie when I looked at your subscriber count I thought instead of 1 thousand it was 1 million subscribers, keep up the great content and never give up

  • @cheeseman1153
    @cheeseman1153 2 года назад

    I just got recommended this video and I can't wait to see where everything goes!

  • @evilmurlock
    @evilmurlock Год назад +2

    Cool! I couldn't deal with the Unity game engine, so I made my own. Pretty cool to come across a fellow custom engineer.

    • @BenjaminBlodgettDev
      @BenjaminBlodgettDev  Год назад

      yes well... to be honest this project hasnt gone very far yet and I dont have any projects in the toolset to show off, but maybe I will revisit this or write a toolset in the future that ends up being helpful to my workflow

    • @SnakeEngine
      @SnakeEngine Год назад

      What's the problem with Unity? It's clean simple architecture.

    • @mechanicalruby
      @mechanicalruby Год назад

      @@SnakeEngine that's the opposite of Unity. you're describing Godot ...

  • @mNotebook
    @mNotebook 4 месяца назад +1

    a year late to this, but at 1:18 you implied that you're rendering a separate draw call for every sprite! it's super cool to see more people making custom engines, but that's gonna get you into trouble eventually (especially if you use your sprite renderer for particles!). draw calls have a lot of overhead, and you usually want to send as much data over one call as possible. there's some pretty neat techniques on the khronos wiki for batching (check out the Buffer Object Streaming page in particular, it seems pretty fast from my limited testing), but it will probably add a decent amount of complexity to your renderer (especially since you'd probably need to get a texture atlas working).

  • @LowLevelLemmy
    @LowLevelLemmy 2 года назад

    That distorted bruh is something Unity could never.

  • @n8dev
    @n8dev 2 года назад +1

    Yessss

  • @Hazanko83
    @Hazanko83 2 года назад +1

    Also, I was about to recommend SoLoud but just came across that part. I'm developing an engine for my game as well, and I'm using SoLoud with a couple of my own simple tweaks to the code for more functionality. I ended up having to figure out how to build for both windows and linux, as my intention is to have a client/server architecture with the server running on linux(although at this point I think all OS-dependent code has been removed). Learning to build a library was definitely a learning experience, but a very good one. Linux was much, much easier to build for in comparison to windows.

    • @BenjaminBlodgettDev
      @BenjaminBlodgettDev  2 года назад

      I want to try miniaudio some time but for now what I've managed after the video is to build a static lib for soloud which I haven't used very extensively but I think should do the job fine.
      Also I know the c++ isn't conventional or modern but I prefer the c style code with some of the quality of life features of c++. I might familiarize myself with unique and shared ptrs down the line but for the moment I have been experimenting with raw pointers and using malloc and other c style memory management code.

    • @Hazanko83
      @Hazanko83 2 года назад

      @@BenjaminBlodgettDevThe main thing I wanted in an audio library was the ability to control volume, stereo panning, and ability to change pitch/tone. I ended up slightly modifying the FFT filter to allow me to control how the pitch changes, as it's default implementation only allows downshifting of the tone. Being able to slightly change the pitch on the same sound each time it's played helps things sound better and more realistic(ingame sounds like a gun firing or sword hitting something, probably wouldn't want to do this with menu sounds or anything). SoLoud also seemed relatively low-level without requiring me to do anything super crazy, which is another good thing if you want to learn how audio works without getting too deep.
      smart pointers are a huge quality of life 😃
      they get destroyed as soon as they leave scope. Really the only downside is figuring out the syntax and a very very tiny performance hit for the reference counter with shared_ptr.
      If you know how to use a constructor for an object you pretty much know how to use smart pointers.
      auto my_smart_pointer = std::make_shared(CONSTRUCTOR_HERE)
      Basically just adding the shared_ptr bit and angle brackets around the object type, them your normal constructor. You can create the smart pointer like this then pass it to another class/function that accepts a smart pointer of that type, or add to vector of same smart pointer type(and as long as that vector exists the object will remain). You can also pass just with .get() for raw pointer, but remember that the pointer will become invalid if nothing holds that smart pointer anymore. You can't share unique_ptr if it wasn't obvious, yet you can convert it to a shared pointer but not the other way around.
      If the pointer will be a member(and need to declare first), then declare it first with
      std::shared_ptr my_smart_pointer;
      and assign it later with another smart point or by make_unique/make_shared.
      I commend you for wanting to do things for the experience though, part of the reason I didn't choose unity/unreal/etc for my project. I have some basic progress videos on my channel if you want to check it out.

  • @latefid
    @latefid Год назад

    rain world's music is really amazing

  • @adamrushford
    @adamrushford 10 месяцев назад

    SFML and OpenAL... my newest trick is minimp3

  • @ubire2676
    @ubire2676 2 года назад +2

    You should use miniaudio instead of soloud. It's a single header library under the public domain. It has an intuitive low-level and higher level API. Libraries such as raylib use it.

    • @BenjaminBlodgettDev
      @BenjaminBlodgettDev  2 года назад

      MiniAudio was next on the list for me if I couldnt get SoLoud working, but after I made the video I actually managed to compile SoLoud into a static lib.

    • @deepvertic
      @deepvertic 2 года назад

      I love using SFML, it includes all the frustrating loading of most formats out of the box 📦

    • @BenjaminBlodgettDev
      @BenjaminBlodgettDev  2 года назад

      @@deepvertic Very true. For some reason I never considered using SFML or Raylib for non graphics stuff. I guess I felt like it was "cheating".

    • @deepvertic
      @deepvertic 2 года назад

      @@BenjaminBlodgettDev In a way it is because you don't mess with loading obscure libraries from 2010 xD But i kinda feel like loading images or audio is the least of your worries when making something so complex as a game engine :D

  • @deepvertic
    @deepvertic 2 года назад +4

    Great job dude, i kinda wanna explore that same topic now as a fellow c++ purist! For the memory allocation try using smart pointers, they really make your life easier! 😄 looking forward to the next video!

  • @on-hv9co
    @on-hv9co 2 года назад

    very nice! though, I hope you also discovered the delete keyword as well lol

    • @BenjaminBlodgettDev
      @BenjaminBlodgettDev  2 года назад +1

      always write untested and unsafe code. never clean memory yourself and just hope that the program will clean memory itself when you exit it

  • @raulguerreroflores1460
    @raulguerreroflores1460 4 месяца назад

    Frostbite Engine 2

  • @Dustballable
    @Dustballable 2 года назад

    I don't think you need a pointer to any textures. You only ever call "use" which only accesses "id". You don't need a pointer member to the image data from stb_image, and it is pointing to null anyway once you call stbi_image_free. Unless I'm missing something your texture* member of drawable could just be a texture. Glad you decided to make a video about your renderer.

    • @BenjaminBlodgettDev
      @BenjaminBlodgettDev  2 года назад +1

      onto the list of likely unnecessary code it goes

    • @Hazanko83
      @Hazanko83 2 года назад

      Maybe I'm misunderstanding, but the texture has to be a pointer because it's generally(should) be stored on the video card.

  • @maricapilas2847
    @maricapilas2847 2 года назад

    wow i found this

  • @andriusbendoraitis3171
    @andriusbendoraitis3171 Год назад

    'Doesn't lock source code behind a paywall' Who would dare do such a thing...

    • @BenjaminBlodgettDev
      @BenjaminBlodgettDev  Год назад +2

      These tutorials sit down and work through the code in detail so they should have freely available source code. I think paywalling math, theory, or project specific videos is more reasonable.
      Im not mad at him for being greedy or something just I don't think anyone should waste time or money on those tutorials when learnopengl is so great.

  • @bobbville
    @bobbville 2 года назад

    🔥🔥🔥🍻🍻

  • @itsunavailable8646
    @itsunavailable8646 2 года назад +3

    I subed so your subs doesn't stay at 66⁶

  • @glewfw7989
    @glewfw7989 Год назад

    y u didnt use openal?

  • @lonelyfloat2582
    @lonelyfloat2582 Год назад +1

    found you >:)

  • @LvUhcX
    @LvUhcX Год назад

    Would you recommend building a game from scratch or use a low level (code only no GUI) game engine?

    • @BenjaminBlodgettDev
      @BenjaminBlodgettDev  Год назад +1

      If you use a basic game framework you will lack tools like level editors, hot reloading, physics, and particle systems. If you arent going to implement these features yourself in a reasonable amount of time then you are better off using an engine. You should maybe only build a framework from scratch like I did if you want to do engineless 3D or maybe if you're a control freak.

  • @krinjon193
    @krinjon193 2 года назад +1

    Who hasn't

  • @dweebdude1217
    @dweebdude1217 Год назад

    666th like

  • @AlexAegisOfficial
    @AlexAegisOfficial Год назад

    It's kinda sad seeing you waste time with cpp bs just to use a library, meanwhile in modern languages you don't think twice just add it from a central registry and it's there.

    • @BenjaminBlodgettDev
      @BenjaminBlodgettDev  Год назад

      What library are you refering to in particular? You mean the audio library right?

    • @AlexAegisOfficial
      @AlexAegisOfficial Год назад

      @@BenjaminBlodgettDev yes, but it could be said for any other library that you have to manually download and link. this is just cumbersome.

  • @billynugget7102
    @billynugget7102 10 месяцев назад

    Bro stop shooting shots at cherno you dork

    • @tanura5830
      @tanura5830 9 месяцев назад

      He is right tho money hungry cherno

  • @Hazanko83
    @Hazanko83 2 года назад

    c or c++? You really shouldn't be using 'new' in c++ now with unique_ptr and shared_ptr. Smart pointers make everything easier, just be aware that an object won't be destroyed if anything still owns a shared_ptr to that object. Most confusing part for me when learning how to use them was initializing them, as you have to actually do make_shared(1) or make_unique(1) or assign another smart pointer to that variable that already exists. Once the smart pointer has been 'made' you don't have to do it again.
    You can dereference them just like a normal pointer, or pass the 'raw pointer' value using ptrVariable.get(). You can also compared a smart pointer directly to a raw pointer variable and it will work( ptrVariable == ptrVariable.get() is true for example).