I’m on my way to converting my 2D action-adventure game engine to 3D. It should have been easy. Convert 2D tiles to 3D cubes, change up a few textures. All characters as flat planes walking around. All game logic can remain the same, working in a 2D coordinate system. It will take a few weeks to work in my spare time. Yes?

Oh, how I was wrong… Maybe, just maybe if everything went super smoothly without any hiccups, I could do it. But I’ll tell you what. Everyone always underestimates. And here I’m working on my engine for one year. The simple task here, simple task there. On or another feature. It looks like converting from 2D to 3D is just adding one more dimension. But believe me, it adds so much complexity. So much more mathematics needed.

All I needed is to convert the 3D position from the world to the 2D point on the screen. So I can show enemies health bar under their head and some other effects, which are easier to implement in 2D. It should be simple. There should be many easy methods to do that. In other game engines, it is one line of code. Technically it is. In the GLUT library, there are methods just for that. I implemented them and… It doesn’t work 🙁

Work on this problem for 3 days. Sometimes a position is on the screen but at the wrong position, sometimes it is not visible at all. I’ve tried to work out a good “recipe” to get the correct position. Eventually, I did. It works like a charm. But I think to myself, I’m stupid or it is common to have problems with such simple things.

Anyway. Checkout those effects around monsters, which look the same as in 2D, except they are rendered on the 3D scene incorrect position. Neat.

Categories: Devlog

Arunas Pangonis

Solo game developer. Creating game for Apple platforms using C++ and OpenGL.


Leave a Reply

Your email address will not be published. Required fields are marked *