Advertisement

Need resources for starting game engine programing

Started by December 11, 2019 03:56 AM
3 comments, last by mmakrzem 4 years, 8 months ago

Hello there,

I'm new here, just created an account. I will get straight to the point so as to waste anyone's time. I need help, pointing towards resources in the area of game engine programming. I spent the past year with unity and reading up a lot on existing game engines, learning c, c++ and c#. I would eventually want to release a game, but I can afford to wait as it is a side project. So I decided to create a game engine that would serve my needs, act as a separate tool to make my game not become my game. The engine would only need to cater towards 2D game development as the game I have in mind is 2D.

Considering how it is a side project, money is not a priority and so I have more time, which I can use to learn more about game development (I'm currently about to pursue CompSci in Uni but not in game development). I've been seeking out resources, searching reddit, youtube, google, duckduckgo, my own thoughts and can't seem to piece everything together as of yet. There seems to be a layer of abstraction between the game and the engine. Existing game engines only amplify this confusion, and frameworks like Monogame overwhelm me by not being an engine.

As such I decided to start with raw opengl programming with c++. It's been good so far, going back to origin and working up really helps me understand individual functions, but that's where the problem lies. Everything I'm learning seems isolated from each other, and I'm not sure if I'm supossed to piece it all together based on what I know or if I'm missing something really important. I'm struggling with a lack of information and I need some help.

I am aware that this seems vague, I'm sorry. I too am struggling to express my thoughts on this.

Welcome to wonderfull world of possibilities in game (engine) coding. The topic is not simple and you have to forgett anything you already know about games when writing a game engine. Here comes a brief introduction and if you have further questions just feel free to ask.

The audience of a (regular) game mostly associates a game with beautiful graphics, audio and and a kind of action-reaction model (aka gameplay). A game engine dosen't care about all these things in the first pass. The primary goals a game engine has is to abstract the underlaying platform away (in best case you can release the same game on different platforms without changes), handles file I/O and game assets, manages a game's memory and then provides the on-top features graphics, sound and anything else. You can imagine it as a car. You don't care about how it is being build if it does what it is made for.

One can say you compare a driving teacher for a car mechanic.

So as you already mentioned to have read a lot about existing engines, did you had a look at their source code as most of them (Unreal, Cry, Lumberyard) are open source and available on GitHub? A topic everybody (including me) starting to code a game engine miss is the build pipeline, did you already had a look how building your game (engine) looks like for example in Unreal?

I don't now much books but Game Engine Architecture Second Edition is always worth a look and even if it uses old APIs, the message matters not the paper it is written on. I learned all the topics by searching on the internet and reading different blogs about people writing their own engines. The BitSquid development blog gave me a lot of insight about memory management and other things when reading and there is also an open replication of the code on GitHub you can take a look to.

When I got into memory management and left the C++ STL stuff behind me, I used this as a template to design our engine's memory model. I implemented those basic data structures Array<T>, Vector<T> and HashSet<T> on my own for learning purposes first but later because working with my own data structures felt way better in case of performance and transparency than using the heavy template stuff of the STL.

Another point you have to take care of is your project design. When I started first time writing a game engine in C++, anything was one single monolithic project compiled into a Library. It turned out that this was complicated to maintain as fthe project grow and caused circular dependencies on classes including each other. Now 4 iterations and 2 reworks later, my projects are structured in a highly dynamic fashion, modularizing anything if necessary and maintaining a tree of dependencies from the engine core up to the outer modules like Graphics for example.

I also created my own build tool like Unreal has because Visual Studio on it's own is very limited in the case of pre/post-build and compiler backends (using not just MSVC but also LLVM/clang which is pretty standard in game development) and something like make, cmake, ninja and whatever build systems exist out there feel to complicated to maintain. I don't want to have to manage a hand written script file of hundrets of lines and look for the one single misplaced command that breaks my build.

The Gamasutra Article has been removed sadly so sorry to not be able to show it to you. Should be enougth for a first post anyways.

Happy coding!

Advertisement

You might want to check out https://handmadehero.org/

This topic is closed to new replies.

Advertisement