How I'm making my game in C++

Поділитися
Вставка
  • Опубліковано 26 вер 2024

КОМЕНТАРІ • 28

  • @qwerty86381
    @qwerty86381 7 місяців тому +4

    Cool :D nice to have readable code

  • @ojima510
    @ojima510 7 місяців тому +13

    You really shouldn't include .cpp files ever. You want to split your code across different source files and only include header files across them. Including all your source files into one means your compiler needs to recompile all your code every time you change anything, instead of only having to recompile the files you edited since the last compilation. It can also make for more readable and structured code if you create clean headers.

    • @victorgallet3174
      @victorgallet3174 7 місяців тому +5

      You are totally missleading... Actually it's called unity build, and the idea is that there is only one compilation unit, the whole program, and you recompile it every time.
      Just measure the performance, for small/mediums projects, it's quite often faster to recompile the whole project rather than compiling each object files individually and link them together.
      And you get extra benefit of quick and easy compiler optimizations because it knows the whole structure of your program, and can do a great job at inlining some parts of the code.
      And nowadays with compilers like zig cc (which is llvm under the wood with a cache system), even in unity build compiler can easily cache files which don't changed to blob and use that in place when generating object file.

    • @victorgallet3174
      @victorgallet3174 7 місяців тому

      ​@@chocolatezt Just use compiler with caching capabilities, like zig cc, and you'll see you will never need anything other than unity builds.
      If you actually need to recompile and change lots of code for debug purposes, actually what you need is hot reload (probably compiling to dll and (re)load the module at runtime when file is modified), or jit compiler features (like tcc offers for c). And incremental build was not the solution of the problem in the first place.

    • @ojima510
      @ojima510 7 місяців тому +5

      ​@@victorgallet3174 Oh, I did not realize that this was nowadays actually common practice (sorry, I had no intentions of being "misleading", I was just going of my 10-y/o GCC experience when compiler optimizations weren't that advanced I guess). Guess it's a stylistic choice then, but whenever I see things like this I often feel like I'm looking at a one-person project that will end up stalling within a month due to unreadable spaghetti code (but maybe I'm wrong).

    • @Rupour
      @Rupour 7 місяців тому

      ​@@ojima510 It seems like he's definitely been working on this for longer than a month. And looking at the structure of the includes, it seems nicely encapsulated. I suppose we'll see as time goes on, but it looks like a nicely structured codebase so far. I agree it looks like a one-person project, but apparently there are a lot of old c libraries that use unity builds, so maybe not.

  • @kplays_6000
    @kplays_6000 7 місяців тому +1

    Looks great! Personally, when not using VS Solutions etc., I prefer VS Code - it's a lot more lightweight!

  • @albertojesusalvaradogarza1009
    @albertojesusalvaradogarza1009 7 місяців тому +3

    imagine this, but in 3D, thats my final proyect for oop, i had a 2D version but using assembly, good job

    • @alexdev404
      @alexdev404 7 місяців тому +2

      Damn and I think that creating a rental system in QT/SQL is hard 😭

    • @albertojesusalvaradogarza1009
      @albertojesusalvaradogarza1009 7 місяців тому +1

      @@alexdev404 dont worry, im not even a good programer, a lot was already made in the proyect, but i have to create the player, objects, etc

    • @alexdev404
      @alexdev404 7 місяців тому

      @@albertojesusalvaradogarza1009 gosh well- i hope everything goes well! And thanks, I'll try my best, too!!

    • @ryanlockhart5328
      @ryanlockhart5328 7 місяців тому

      weird flex bro

  • @courterart
    @courterart 7 місяців тому

    wow, this cpp app couldn’t be further than what I’ve been taught project setup wise. Is there a reason you don’t just use Visual studio to compile your project? As a single platform cpp developer myself, I’m very interested in following the development of this project to see how smoothly it goes. I’m all for making the process streamlined and simple for development, you’ve made some interesting choices here. If it works it works, I always say. Good luck on the project and thanks for sharing.

  • @Wyoming307
    @Wyoming307 7 місяців тому +1

    you can use the DirectWrite windows api to render text if you want to get rid of freetype

  • @diegoaredes2721
    @diegoaredes2721 7 місяців тому +1

    Amazing video😮.

  • @brettrogers4208
    @brettrogers4208 7 місяців тому

    My game design teacher said to never use unity builds but to only include header files. Odd, i guess its just coders choice

  • @Aragubas
    @Aragubas 7 місяців тому

    great now add support for Vulkan, Linux and Wayland 👀

  • @m4rt_
    @m4rt_ 7 місяців тому +5

    Btw, you don't need to release/free the allocated memory when you are already going to exit.
    The OS will handle this, and this will just make it slower to close/exit the game.

    • @paradox8425
      @paradox8425 7 місяців тому +7

      That's a bad practice tho

  • @agaveboy
    @agaveboy 7 місяців тому

    owww why not sdl ;( opengl is pain

  • @RoboGameOfficial
    @RoboGameOfficial 7 місяців тому

    0:50 why not just use VS Code then?

    • @coolmanthecool603
      @coolmanthecool603 7 місяців тому

      He already explained, he doesn't want to use cmake, vscode does't manage projects, its just a file explorer terminal and text editor, it cannot compile code, letalone manage it

    • @someever2
      @someever2 7 місяців тому +1

      ​@@coolmanthecool603​ ?? that's not what he meant. he doesn't use visual studio to compile his code, he uses it for text editing. the compilation is done in a batch file, which is why vscode might actually be a better option, it's more lightweight than visual studio. it also has everything that he needs: a text editor, a file explorer and a terminal.

    • @ykeygames
      @ykeygames  7 місяців тому

      I use the visual studio debugger and memory inspector from time to time. Forgot to mention that.

  • @theunsignedtarik
    @theunsignedtarik 7 місяців тому

    diing the same in rust