Android Question 3D shooter game (fps)

MasterGy

Member
Licensed User
Hello Everyone!


I want to create a game. I don't understand many things, I've recently started working with B4A. I have a lot of questions, and I thought instead of cluttering up the forum, I'd post my questions under this post. In the future, these would cover different topics. I think it's a good solution to ask questions about various topics here, under one post, so those who want to create a game in a similar way would get help in one place. Plus, I'm happy to answer anything myself.

I didn't make an internal recording so you can see the controls. I hope it's an ideal, easy solution, and I'd like feedback on this as well. I want to make it as ergonomic as possible. I admit, I'm not good at it in any way, even though I've tried many control layouts. The latter seems to be the most ideal for us. There's nothing better than 'wasd+mouse' on PC! :) But life is limited on mobile.

I'd especially like to ask about OpenGL. Let's start:

  1. How can I draw over OpenGL? Can I use 'canvas, b4xcanvas'? I couldn't make it work.
  2. How can I place a 2D texture over OpenGL graphics? I want a solution that would show crosshairs, energy, and other information with semi-transparent textures. I don't want to place separate panels, which would decrease the size of the 3D window. It's funny because I managed to implement 3D rendering (because I found a sample program and understood it), but I can't do 2D rendering (how to put a simple image over OpenGL). So overall, what I want is very simple. I want to draw and write over the graphics.
  3. How do I know in the program how fast rendering is happening? The actual redrawing.
  4. How can I make the background of the loaded image disappear? For example, if the background is rgb(255,0,0) red, then make it completely transparent (alpha=0). From line 524, you can see that I tried. I left the code in. It doesn't work. No matter how I try, it gives color to the background instead of making it disappear. This is the texture of the bullet I shoot. So for now, I'm left with a triangle-bullet.
  5. I'm uncertain. There are elements that don't move. But there are those that do. My knowledge extends to the point where I reload all the vertices every render. Since I don't know OpenGL, I'm afraid I've also calculated those vertices unnecessarily, which don't change. The thing works like this, but I'm not sure if I'm unnecessarily burdening the CPU. The drawings that don't change are in lines 614-623. Those that always change are in lines 624-637. Would it be faster if I only load the parts that don't change once? Or is it insignificant? Unfortunately, I'm not clear on this, so I welcome any thoughts.
I attached the game. Only one external library is needed, 'OPENGL'. The package contains it.
(pack is too large here)
 

byz

Active Member
Licensed User
Hi everyone!
I feel like I've completed the game. After expanding it with animations, my main goal was to make it compatible with as many phones as possible.
Work done:
  • 10 different tracks with harmoniously selected colors.
  • Added distance-based coloring with OpenGL fog, known as 'opengl-fog'.
  • Animations for mission completion and death.
  • Optional controls: 'sliding' mode where rotation is done by swiping, and '360 VR' mode where you see in the direction you turn the phone.
  • Avoiding the 'orientation' function. The game detects if the phone has a gyroscope sensor. If so, 360 VR will work. If not, it calculates the phone's orientation using magnetic/accelerometer sensors with smoothing.
  • Playability: The game is divided into 40 levels. You start with no attacks. As you progress, the levels get harder. Enemies become faster and more aggressive.
I tested it on three different phones: Samsung A13/2021, Samsung A14/2023, and Xiaomi Redmi Note 12/2023. Different sensors, different sensitivities, different environments. The game is playable on all three phones.
The recording was made with the Xiaomi phone, and I noticed that the OpenGL rendering is poor, and the sound is delayed, which is terrible. Unfortunately, I can't do anything about it. I would like to ask for advice regarding this issue. The recording seen in the YouTube video is very bad. I assume it will be good when played in real-time.
I look forward to all kinds of feedback. I can't buy 10 different phones for testing, though I would like the game to work well on 10 out of 10 phones. I have to admit, the direction I started is not efficient in B4A (((( Games like this and similar ones are better started in Godot or Unity.:(




I tested this version of the game. The movement is not smooth.
 
Upvote 0
Top