I want to eventually create a pseudo 3d game engine like the original Wolfenstein or doom. I am starting from 0 so my first step is to create a 2d top down view where my character would be in the center of the screen always looking up and objects would move around him.

I know how to create a game like Zelda where objects move but dont rotate and the center character just look in different directions. But after that i need some help. I tried to do some research online but could not find exactly what i was looking for.

I dont know yet what language i would use to code my engine. My 1st choice would be c++ but i want my evenual game to be easily ported on different platforms. For that reason ill probably go with Java.

  • \$\begingroup\$ FYI, C++ is cross-platform, as well as a lot of C and C++ libraries that you can use. \$\endgroup\$
    – Quentin
    Oct 22 '19 at 14:00

2D math translates in game programming to 2D transformations. What to implement? Rotations, scaling, 2D shapes overlap/contain tests. Only with that you can already code a lot of fun games. With the correct terminology you can easily search for the required techniques. I included a single link as an example.

While the above paragraph tries to answer the question in the title, the body of the question is more in the grey area of the Q&A format. I can only provide personal experience here:

With Java you have most of the work done, in Android you have the Canvas class and in desktop you have the Graphics2D class. None guarantee to exploit the device GPU at its maximum but I have encounter that today both have very good performance (including no gaming hardware as long as the GPU helps a bit). Both will take care of, probably, all the transformations you will need.

If you want to go up a level, you can go close to low level OpenGL programming with LWJGL. While I said low level, you have all transforms for free (scaling, rotation, mirror, etc) because the GPU will be doing everything. You will be dealing with matrices and vectors a lot. You can optimize the calls for your specific game and got the best performance (this takes time, debugging, and experimentation).

2D hardware doesn't exist. Sprites can be implemented in APIs like OpenGL by using an orthogonal projection with textured quads. There are also more advanced techniques that you can read about, like optimize the shapes of sprites rather than just using a big quad.

Now, if you want to learn more than actually doing, C++ will teach you a lot more about not only game programming but about programming in general.

The multi-platform engine objective is actually very hard. For that is better to just use an existing engine. Except that you want to learn more than finishing the project.

If you want to do more than learn, stay away from low level. Engines like Unity are your friends here. There are solutions for C++ and Java too.

For example, SDL for C/C++ already covers everything including audio and input handling, it is multi-platform enough and doesn't stay in your way by imposing you a specific way of doing things. With SDL is better not to be afraid of extensions, like SDL_mixer for audio, or things go too close to low level.


Not the answer you're looking for? Browse other questions tagged or ask your own question.