Game Engine from Scratch...Why?

Started by
29 comments, last by jbadams 12 years ago
When making something like a game engine from scratch. It really means just having a language and a library and building your engine on top of it. As opposed to using a completed engine. You cannot possibly understand the inner workings of your program because there is always a layer beneath what you see. You can however for example choose a open source library so that you can figure out how it works if you want (but its works on top of OS library). C++ and Java are excellent languages for your "from scratch" approach. As opposed to using Engines such as Unreal or Unity.

Also note that i don't recommend learning C++ without learning C style coding. I'm not saying you should learn procedural programming first, you can learn java OOP first. But when it comes to C++ you should start from the beginning in order to fully utilize the full power of C++. Good luck
Advertisement
If you are coding the engine simply because thats what you want to do... then awesome, do that. For everything else though, I'd say that re-writing code that already exists is a huge waste of time, I re-use as much code as possible at all times (whether its personal, or sourced from public).
Until recently I also had the same mindset, I wanted to code everything from scratch. I think it was just so that I could say "Yeah I coded this game myself." and using an engine seemed like cheating to me. Then I picked up Unity. Its the first engine I've used and I'm definitely enjoying programming a lot more right now. I can get things done much faster by writing a lot less code.

I understand that there are many performance improvements to be reaped from using low level languages.

While this can sometimes be true, it may not be as straight-forward as you think. Lower level technologies offer you finer control over your software, the potential performance benefits can be gained from using a solution that is more specific to your particular problem rather than something more general that has been created to handle various different problems. These potential advantages are far from automatic however, and it's entirely possible (even probable for a non-expert) to instead create a less optimal solution.

In the case where you've done a particularly good job of choosing your higher level technology and it's a good match for your specific problem, you would even find that you would simply have to replicate exactly the same solution if you decided to work at a lower level.

Choosing lower level technology (whether that be language, library, engine or whatever) hoping for performance reasons is not a good idea unless you have the experience to be able to take advantage of that. You should also consider whether or not the potential benefits will outweigh a potentially significant increase in development time.



As for learning a bit more about how things work at a lower level, I'd recommend taking a class or checking out some reading material on algorithms and data structures. You might also consider learning some basics of how simpler hardware works, and learn a little bit about assembly.

- Jason Astle-Adams

-AdrianC
Haha! We have the same name and same situation? :P I also have Unity, I picked it up when they were giving away a free license i think about a month ago? However I haven't looked it at yet, but I've seen some pretty cool games people have made on Ludum Dare on Unity.

-Adams
That's true, I can't wait for the fall when I start college and my computer science classes. For the past year and a half I've only been working with books, tutorials, and just recently my mentor. I'm going to be taking a C++ class instead of a Java class though since I feel comfortable enough with Java for the time being, and also in reference to Sh@dowm@ncer, I want to learn how to code in C++ since I'm sure I'd just try coding with C++ syntax in "Java style". Also I'm guessing that the lower level I go, the more probably I actually break something right? Yeah, I can't wait for my college courses.

-Alonjar
Yeah, so just "make things from scratch" for knowledge's sake, but when working on a deadline embrace pre-existing code right? I guess that makes a lot more sense xD I'm going to stick to that mindset from now on.

Thanks for all the feedback guys!

Also I'm guessing that the lower level I go, the more probably I actually break something right?

Absolutely -- with great power comes great responsibility. Languages like C++ assume the programmer knows what they are doing, and if that isn't true you don't have some of the safety nets that other languages can provide. In the hands of a skilled programmer this means they have increased control and can potentially gain some performance improvements by tailoring the programs behaviour to exactly suit their own needs and not waste time trying to handle more general cases that don't actually apply. Unfortunately, in the hands of a beginner it means there are more potential mistakes to be made, and more you need to be aware of to avoid said mistakes.

It sounds like you're probably on the right track, and if you're planning to study computer science at college there should be some classes available that will teach you about some of those lower-level topics you're interested in.


Yeah, so just "make things from scratch" for knowledge's sake, but when working on a deadline embrace pre-existing code right?

Absolutely, that's an excellent approach to take. It's great to learn new things, and knowing more about how things work at a lower level can often improve your skills even when working at a higher level, but if you want to produce good quality software without wasting a lot of time there's absolutely no reason you shouldn't take advantage of existing technologies that meet your needs and have already been bug-tested, etc.

- Jason Astle-Adams

What about a compromise? Use the high level APIs, but if one piques your interest do a bit of a google about how it works, maybe write some code to test it's capabilities. I think it's great to understand varied topics like pipelines, shaders, rasterisation, etc. But realistically you're unlikely to write a better implementation than the guys who write APIs for a job unless (a) your requirements are very specific or (b) they dropped the ball. Option b does happen sometimes, e.g. there are library implementations of quicksort which have worst-case performance for sorted or reverse-sorted arrays because they use the first element as the pivot.

The other option is to do some general research on known algorithms to feed that knowledge hunger, e.g. look up stuff by Knuth or Sedgewick. How string searching can be done is actually quite fascinating! Also design patterns are good to research, and often useful in future development.
It is a big project to making a game, especially a 3D game, but no matter how big or complicated it was, it can be separated to many different parts, some parts you need to concern since they are connect to your game idea closely, some parts you don't need to concern if someone has finished them for you, that's why people need a game engine, it can save your time and energy largely. But if you want to learn more or enhance your program skill you can also do everything by yourself.

Java is a good language for someone who is just a beginner of learning program, but it dose not suit to making game because its high level and low performance.

Java is a good language for someone who is just a beginner of learning program, but it dose not suit to making game because its high level and low performance.


The creators of Minecraft, RuneScape, Puzzle Pirates and Wurm Online (amongst others) would probably disagree... Java is just fine for games, and whilst it isn't for everyone there's absolutely no reason to spread nonsense about it being "not suited to making games". The fact that it's higher level is potentially a good thing (as has already been covered at length in this topic), and while there can be some additional performance concerns the idea that it's "too slow" for games is largely just out-dated and no-longer relevant.

- Jason Astle-Adams

Well somebody has to write a game engine from scratch. If you look at the previous examples of idTech3, Unity, UDK, etc - yes, they did get a lot of subsequent reuse, but they all began as engines written from scratch. If nobody wrote an engine from scratch these wouldn't exist to be subsequently used by those who don't want to or need to write one.

So you need to sit down and think about what exactly it is you want to achieve. Where is the payback for you? If you want to make a game then reusing an existing engine is likely to be a good option. If you want to learn about some specific aspect of technology, then modifying an existing engine might be more appropriate. If you want to get deep involvement in all aspects of what an engine does, then writing your own may be what you want. But it's firmly a horses-for-courses decision, and only the person making the decision really knows which one is right for them.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

This topic is closed to new replies.

Advertisement