Physic frameworks from hell

Hey guys, let’s get straight to the point. I am developing an own small game engine at the moment (the physic framework of the engine in particular) and I wanted to give you some opinions about rolling your own engine.

This post won’t feature any code since I don’t want to bore you with C++.

My first advice to you is: If you want to understand features which are implemented in other engines, don’t try to roll your own ones to get a feeling why they might be designed like this. You will get frustrated, I guarantee it. That’s a totally stupid idea (that’s why I am doing it 😉 ).  Try to stick with the documentation and tutorials of the engine you are using and you will come out much wiser than you are now.

Well this advice only addresses big features and core libraries, it won’t hurt to take plain DirectX (or at least XNA) to look how to implement a little render backend (and if it’s only for drawing lines). When I tried to work with DirectX first, I was really confused and experienced a rollercoaster of emotions from joy to hate to despair and back to feeling like a god when my first mini-game worked (a space invaders clone). But at least I understand the basics now.

Drawing lines with DirectX is no big deal. You initialize your components (swap chain, dxdevice, dxcontext etc.), you take some vertices and put them in the buffer and then you swap the buffers. But you won’t know that if you haven’t at least read a bit about the basic functionalities of DirectX and co and the naming scheme of DirectX is hell (at least for me). What you shouldn’t do (at least if you aren’t one of those mega mind programmers who read something and instantly know what to do…. I am not on of those guys…).

Well that leads me to my next advice. If you want to develop a serious game and you not part of an AAA studio you don’t want to roll your own engine. Trust me, it’s not worth the trouble. There is a really good chance someone somewhere did id better anyway.

Unity, Unreal and co aren’t around for all this time without a reason. They are well-tested, good developed and very comfortable to use. It’s ok to roll your own engine if you have the experience, time and money to do so, but overall you will be doing better with a third-party engine as a beginner and/or indie developer.

Well I can tell you a lot….. really I can… and you know what? I do! And you know what’s next? I will give you an example how annoying it get’s to roll your own engine features. That’s where my little physic framework enters the game.

physic

It’s nothing big, it’s nothing shiny but it’s mine, and I love it for being mine. But here comes the problem…. While watching the gif you may recognize some of the little squares vibrating instead of coming to a resting position. I recognized it to late and that’s where the trouble started… It took me 4 hours to figure out what’s wrong with this stupid physic calculation. 4 hours of my life.

When I found the issue I got mad. Really mad. Basically when I calculate my speed I round to whole numbers since my minimal motion range is 1 pixel. And that’s where the problem was. By rounding the numbers the falling speed of my squares sometimes if I hit an unlucky number remain at 1 and go down to 0.9 and then they get rounded back to 1. 4 hours for this little shit of a bug. And this is actually a very simple (and not very realistic physic) framework.

I am doing this for training purposes. I am planning to get my hands on Unity 3D (yes I could also start with Unreal or s.th else but I decided to go with Unity). But until I start using a “real” engine (every engine is a real engine… is it a good one, that’s the right question) I want to learn a bit about general design possibilities of engine features and since I feel pretty secure in C++ I decided to do what I told you not to do. And you know what? Sometimes I hate my self for not listening to my own advice. Actually I could be much smarter than me…

Ok enough trolling for one day, serious guys. You will do yourself a favour if you use a third-party engine. If you learned how to use them, you can start customizing them and if you learned how to do that, it might be a good idea to roll your own engine. But until that happens, the chances are good that you will destroy your motivation with rolling your own stuff. At the very beginning I got really frustrated (exactly by doing this kind of mistakes) and stopped trying to learn more about game development. I had a functionally little 3D graphics engine (very basic, bad graphics etc) but it was a start… and then I stopped working on it.

Now I went back to a little 2D engine which is much easier and is really enough to learn the basics. Sometimes even this is a start. If it get’s to hard, go back and start with something smaller. Just don’t stop trying if you really want to do this.

I hope I helped someone with that advice.

Advertisements

Author: mango2go

I am a software developer for a big pharmaceutical trading company. I am interested in C++ and C# programming in general and in game development in particular (only as a hobby atm). My experience about game development is restricted to what I tought me myself so I am still in the process of learning. My goal is to become a professional game developer and find my name in the credits of a popular game one day.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s