r/gameenginedevs • u/MammothWing1128 • 2d ago
how can I read a Game Engine source code?
Idk how can i explain it well but a little context, I am studying Cpp for build my game engine, I want to create a game and it's a good opportunity to take this challenge. Recently I know CryEngine was buy for Amazon and it change to O3DE, I read before in this sunreddit is a good practice take a Game Engine Open Source for understand how it works but unfortunately Idk what is you main function, what kind of project it have, I love read code from others people and it's interesting how their solve that kind of weird problem with this amazing solution. anybody could you help me?
Sorry for my english dude
9
u/Left-Locksmith 2d ago edited 2d ago
Okay, whatever looks like one single "game engine" is actually, like everything else in software, a sequence of solutions to individually small problems stacked one atop the other.
Graphics programming: This is where your program reads numbers representing 3D data, and tells the pixels on your monitor what colours they should emit. Much of this work is done on the GPU these days.
Audio programming: This is where your program reads audio data (time series of numbers centered around 0 representing a sound wave), modifies it, pushes it to your sound card which pushes it to your speaker.
Physics: This is where you define what happens when two pieces of geometry intersect, or constrain each other by distance or angle along some axis. Also where position updates based on velocity, and velocity updates based on external forces, are performed.
Input handling: This is where key presses and analog device movements are combined into commands understood by your engine's scripting system.
Scripting: The interface through which a game dev using your engine writes "business logic." E.g., Collision logic saying when ball hits bat play "smash" sound effect and add XYZ velocity to the velocity of the ball.
Networking: I mean you can guess, right?
The "Engine:" the architectural glue allowing all the individual bits to interact without exploding.
My recommendation is to learn a framework like SDL, make a small 2D game with inputs, simple physics, audio, and then return to this question. It'll give you a small taste of everything an engine does, and you can decide afterwards what interests you the most.
Most engine code just isn't going to make sense to you until you understand the problems they're trying to solve.
3
u/ChameleonCoder117 2d ago
I don't really understand what the post is supposed to mean but if you want to read the code of game engines, here's a list:
Unreal code is available, but their lawyers WILL hawk your ass down if you try to modify and redistribute it
Open 3d Engine is open source
Godot is open source
Source 2013 build is open source
Id tech 1-4 is open source
Bevy is open source
Raylib is open source
Cocos is open source
12
u/tastygames_official 2d ago
CryEngine was licensed to Amazon but then Amazon heavily modified it and combined it with their engine Lumberyard which eventually turned into the O3DE project. CryEngine is closed-source, but O3DE is open-source: https://o3de.org/ https://github.com/o3de/o3de
so you can read the entire source.
The other person already mentioned Unreal, which is open-source but not free. You also have FOSS (free and open source software) godot game engine: https://godotengine.org/ https://github.com/godotengine/godot
8
u/Responsible-Offer724 2d ago
study the classics (much more approachable, and the foundations upon which all 3D engines are built upon)
https://github.com/id-Software
I know you said you don't want to use AI at all, but use it as a compliment to explain topics you are having trouble wrapping your head around. You don't need to and should not generate a single line of code with it if you're trying to learn, but if you're trying to learn accelerating your understanding is a good idea.
1
u/cherrycode420 2d ago
Welll .... you search for an open source game engine, check the corresponding git repository, then browse the files and read the source code of whatever seems to be of interest for you.
If that's too much effort, you're probably not ready to try and create your own game engine, unless your goal is to vibecode the #8374692027 frankenstein project bundling SDL, ImGui, Assimp etc. and calling it your own. For those kinds of pseudo-engines, the only unique feature is usually what styling they applied to ImGui 🤡
If you want to create a game, create a game, not a game engine, unless you actually have technical requirements that can't be solved using existing solutions.
3
u/aleques-itj 2d ago
https://fabiensanglard.net/quakeSource/index.php
1
u/Outside-Storage-1523 2d ago
I think you need to first make your own engine, hopefully a simple one, and then pick a simpler commercial or open sourced engine to read.
1
u/MCWizardYT 2d ago
It's like reading the code for any other type of project. Any good engine has documentation that will tell you where to start
0
u/Thin_Tradition8467 2d ago
https://github.com/EpicGames/UnrealEngine