GameDev, 3D, cross-platform, C++, Android, Windows, OpenGL ES 3.2. This blog turned out to practically step-by-step instruction (tutorial) how to write cross-platform 3D app (game) from scratch. To write own game is my old dream. Now I know how to do it right. Have a few ideas in mind what it could be, haven't decided […]
Chapter 12. Sound / miniaudio.h
Contrary to my expectations, this topic turned out to be not so complicated. And basically it came down to finding the right audio library/API. I've checked a few, including OpenSL, OpenAL, irrKlang, SFML, FMOD, PortAudio, SDL2, etc. Many of them, despite their own claims, are not truly cross-platform (or I couldn't get them to run), […]
Chapter 11. Interactivity
Now we'll try to implement game objects' reaction on our own manual input (mouse for instance). The main part is how to determine which game object the mouse is pointing at. We'll use the same approach as in previous chapter. Unlike in collision detection we'll calculate object's sizes/position not in world X-Z plane, but in […]
Chapter 10. Collision detection
Collision detection is one of the most important parts of the game. Essentially, any game is a set of rules for the behavior/interaction of objects in the event of a collision. For example, a shell and a tank: when they meet, the shell disappears, the tank explodes, and so on. So how can you tell […]
Game idea(s)
Wanted to call this chapter “Game Concept” or “Game Scenario”, but that would be too premature. There is no clear concept or script in my head yet. Although the visual concept and general direction are more or less settled down. When thinking about a future game, it's important to decide not only what you WANT […]
Chapter 9. GLTF/GLB format
We now have a graphics engine capable of generating and displaying 3D models. However, it uses its own model format (XML files). Of course, it would be great to use other (standard) 3D formats as well, that can be downloaded from the Internet. After some research I settled on GLTF/GLB (GL Transfer Format, GLB is […]
Chapter 8. Graphics Engine
Cross-platform graphics engine, GameDev, 3D, C++, Android, Windows, OpenGL ES, Visual Studio, Android Studio Well, it's a big topic. I'd even say HUGE. Here we'll need to decide how to build and render our scene/models, where we'll get our 3D models from, how we'll load, unpack and control them, which and how many shaders we […]
Chapter 7. External files, Android assets
The idea is the same as in previous chapter - to place the data files within the reach of the executable. However, in Android's case we are dealing NOT with the "executable", but with APK. Besides, we have to deliver data files not just to different folder, but to different device. We can do that […]
Chapter 6. External files, Windows
Now, having a cross-platform solution, we can start thinking about our Graphics Engine. However, the first question will be not about graphics, but how we gonna handle data files (like shaders, models, textures and so on)? For example, currently our triangle model (verts array) and 2 shaders (1 vertex and 1 fragment) are hardcoded in […]
Chapter 5. Hello Cross-platform!!
Android Studio, C++, OpenGL ES, cross-platform Now we will try to run TheApp spinning triangle sample on Android. For this we'll need: Didn't find how to add classes/files outside of cpp folder in Android Studio, so let's do it manually. 1. In Windows File Explorer create a new folder C:/CPP/p_android 2. In a text editor […]
OpenGL: Where is the front, where is the back?
For 3D models - not a trivial question by the way. When talking about ourselves or human being in general, our natural assumption is that the right side is to the right of the BACK, not of the front. To the right of the front is LEFT hand: The same applies to cars: However, this […]