Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language.

0
votes
2answers
43 views

Advanced Tetris Programming

This example of tetris game is more complex than general clones. [to test the link: enter/ctrl for start and c/v/b for movements] As you see from the game it has: Smooth movement Auto alignment of ...
0
votes
1answer
28 views
0
votes
0answers
17 views

Angle Between One Vector and its Reflected Vector coming out to be wrong

I’m making a 2d game where reflection of an object is required. I’m solving the relfection porn=blem using vectors like this: float x = (bullet.x - player.x); float y = (bullet.y - player.y); ...
1
vote
0answers
26 views

Creating a real loading screen between levels in Unreal Engine 4

I'm trying to create a loading screen to pop up between levels in Unreal Engine 4. I want to have a traditional loading screen such as the loading screen in Skyrim, where the player presses play and ...
1
vote
1answer
39 views

Drawing many separate lines using mouse OpenGL(GLFW/glad)

So, in order to draw a line, I track the coordinates of the mouse, then I add them to the array and capture it as GL_LINE_STRIP_ADJACENCY. However, for example, I completed drawing a line1 at P1 and ...
0
votes
1answer
80 views

Use a different language for engine and game

Just a quick question that I haven't been able to find an answer to, I am creating an engine for a game, I have begin making the engine in C++ but I want to make the game in java. My question is, is ...
0
votes
1answer
43 views

Read access violation, pointer was nullprt

Im trying to figure out how to use pointers to make a single instance of an object that in this example will just change direction on x-axis. Splav.h (eng. Paddle.h) ...
0
votes
0answers
40 views

Cross-platform shaders with SDL2

I'm working on a (my first) project, a little 2d game in C++ with SDL2 to set up the screen and stuff. I learned how to write graphics code using THREE.js to run OpenGL ES shaders, so in this new SDL2 ...
0
votes
1answer
47 views

Initializate float4x4 in vertex shader

Forgive me for my English. I am trying to create a 4x4 matrix in vertex shader, but it is not initialized correctly. Why is this happening? Vertex shader: ...
0
votes
2answers
38 views

Removing a pair from array of pairs

Im making a Breakout clone game and im stuck with deleting objects after they are hit. There are 3 rows. Each contains 12 blocks. I'm trying to delete a pair in the array of pairs. The array contains ...
0
votes
1answer
14 views

Directx 12 Root signature compatibility with pso

Can you bind a different root signature than the one that pipeline was created with? If so does it have to have exactly the same parameters or could it have like one more but the pipeline will ignore ...
1
vote
0answers
35 views

glDrawElementsInstanced rendering always rendering the last instance at the origin

I'm in the process of adding instanced rendering to my engine, to do this I'm adding an offset attribute with a divisor of 1. But for whatever reason, OpenGL is consistently rendering 1 instance at ...
1
vote
0answers
68 views

Is native performance of C++/C etc. relevant for game servers? [closed]

I am wondering if the performance of unmanaged languages like C++, Rust etc. is relevant when developing a game server or is it more about the network. For game clients, it makes sense and is probably ...
1
vote
0answers
21 views

How to apply a visual filter to what I am drawing?

I'm looking to apply a sepia filter to what I'm rendering. Perhaps we could just apply the filter to the view or pass it to the draw method to draw everything with the filter (I'm using one draw ...
1
vote
0answers
83 views

Are most cross-platform C++ libraries really not cross-platform for game developing? [closed]

Sorry for my poor English. Some cross-platform C++ libraries are useful for game developing, e.g., Eigen, Skia, OpenCV, Tensor Flow. I am not sure whether they are really limited to officially ...
0
votes
0answers
35 views

Mouse click from screen coordinates to world coordinates in Orthographic projection

I'm trying to draw GL_POINTS at a right clicked mouse position, when I tried the following methods, https://gamedev.stackexchange.com/a/144667/99481 and https://...
1
vote
1answer
31 views

Texture won't appear using a vector of unique pointers of an Object

I am working on a top down 2d shooter game. I have a player Sprite and a Bullet class. I made a vector of pointers to Bullet to store the bullets. Here is the code of the vector and the functions I’m ...
0
votes
2answers
52 views

Error saying attempting to reference a deleted function while using a vector list

I’m making a 2d top down shooter game and I was working on shooting bullets. Im using a vector for the bullet in my player class: std::vector b; And I have coded a shoot function which shoots the ...
-1
votes
0answers
61 views

Line of Sight Algorritm

I have this working line of sight algorritm which works: ...
0
votes
2answers
97 views

While loop running in thread, but not doing anything [C++]

I am trying to multi-thread my game so that one thread updates and renders the player, while the other listens for inputs. I used a while loop to keep my detached thread running in the background, ...
0
votes
0answers
88 views

C++ Game/Server Design

I am making a multiplayer game in which one of the players hosts the server. I have written a mock-up for the game loop and I have implemented an SFML TCPSocket server that clients can connect too. ...
4
votes
1answer
700 views

Why loss of floating point precision makes rendered objects vibrate?

I'm working on an open-world game. I noticed glitches when I move far away from the origin. The objects seem to be shaking or wiggle. Especially the z-fighting seems to wiggle. And the objects that ...
0
votes
0answers
11 views

android native app is crashing

I am trying to setup android native framework so that I can receive events and touch inputs. I have created a cpp file which has android_main and configured CMake... ...
1
vote
2answers
72 views

Pros and Cons of making one complex mesh vs more simpler ones

Looks like I have a problem with basic understanding of how OpenGL works. Lets say I have a mesh made out of three cylinders that is shown on the picture: So are there any major difference in ...
0
votes
1answer
92 views

Can DDS be used in OpenGL in Linux without license/patent issue?

Is there a 'standard' for OpenGL game creation intended for both Windows and Linux? I understand DDS is the DirectX standard (or, at least, it appears to be). Is there one that does not have potential ...
0
votes
0answers
78 views

Stop time when the player is stopped, advance time when the player moves

I started modifying the basic first person shooter template with some time stopping mechanics, and this is what I came up with: ...
0
votes
0answers
42 views

Handling Player interactions with NPCs?

I'm a beginner in game development and I'm currently writing my game in C++. My way of handling Player interactions with NPCs is by using a bunch of if statements. If the player presses a key on a ...
1
vote
1answer
67 views

Unexpectedly fast rotation after refactoring OpenGL code to add more abstraction

I've been working on an OpenGL program that simply renders a square that rotates in 3D space. The square also has a texture applied to both sides. Here you can see an example screenshot of the program ...
0
votes
0answers
46 views

How can I use the NDK to make games?

I want to use NDK to use my existing C++ code for a game. I know there are two ways to use NDK: I can use Java to create GLSurface and opengl context; I can use NativeActivity class to entirely write ...
1
vote
2answers
150 views

Design pattern for turn based strategy game in C++

I'm studying computer science at university. So far I've created several programs for school projects and homeworks in C++. They were usually smaller programs up to 1000 lines of code. Now I want to ...
0
votes
1answer
38 views

How to change the time dilation using C++ in Unreal Engine?

I searched a bit and found a blueprint solution which does this but I've just started using Unreal and I prefer C++ instead of this visual programming thingy. I'm looking for a Unity-like ...
0
votes
1answer
22 views

How to return reference from BlueprintImplementableEvent?

I've got a C++ component and I want to have function which will be implemented in Blueprint like this: ...
0
votes
1answer
86 views

Correct way of combining A* and funnel

I implemented a pathfinding algorithm like this: There is a mesh of triangles that defines the area the player can walk. An A* algorithm is used for finding a path from the start triangle to the end ...
1
vote
1answer
81 views

Text Adventure - Engine actions based on dialogues

Building forward my text adventure i stumbled upon how to actually drive the actions that can be caused by dialogs. I wrote the dialogues and the logic around handling them already, but i'm missing a ...
1
vote
1answer
140 views

How can I avoid jittery motion in SDL2?

I am experiencing stutter when I am moving faster than 0.1 units in my program. When doing exactly 0.1 units I get: For test purposes I've made the bot always heading southeast. ...
0
votes
1answer
55 views

SFML 2.5 on Ubuntu 18.04 - cannot open shared object file: No such file or directory

I'm trying to run an example code with SFML 2.5 on Ubuntu, but without success. I'm using: VSCode 1.27.0 with the Easy C++ Projects extension on Ubuntu 18.04. The build/run output keep saying that ...
0
votes
0answers
28 views

Ray Sphere Interesection Distances WRONG

The discriminant is not working. This code produces incorrect distances from ray to sphere, but it can tell whether or not the ray does strike the sphere. HOW HARD IS THIS I'VE BEEN TRYING TO DO THIS ...
0
votes
1answer
48 views

The SFML equivalent of polling to see if a key has been released?

I'm testing out SFML by trying to make a square move with lerp velocity. The desired result was that when, let's say, D was pushed, the square would accelerate smoothly from ...
0
votes
0answers
29 views
1
vote
0answers
39 views

Design of (texture) resource system

For an open source game I wanted to redesign the resource management system but got into a dead end and need some pointers to some reading material or where to go now. Starting point was (mostly) a <...
0
votes
1answer
31 views

SFML: How to draw/render from Screen class

Game architecture is as follows: // main.cpp ...
0
votes
0answers
60 views

How should a game server receive/send udp packets with a defined tick rate?

I currently have a game server with a customizable tick rate, but for this example let's suggest that the server is only going to tick once per second or 1hz. I'm wondering what's the best way to ...
4
votes
1answer
135 views

How to create a skybox in an infinite world like minecraft?

I'm making a minecraft-clone game in C++ using OpenGL. I created a skybox using OpenGL's cube map but the camera can go outside of the skybox since it's an infinite world. Then I changed it to update ...
0
votes
1answer
103 views

Access violation executing location 0x00000000

When I try to debug my program, this Exception is being thrown in a call to glGenBuffers. I'm using OpenGL and SDL. Here is my code: It consists of two classes: m ...
1
vote
1answer
92 views

Separating game logic and rendering logic in separate static libraries

I'm trying to write a game in C++ using OpenGL. I've tried to separate my game logic and my rendering logic as much as possible, and up until now, this has worked for me. I haven't written a lot of ...
0
votes
1answer
147 views

How to Design a Generic Collision Detection System?

I'm designing a C++ 2D collision module, and I ran into a problem designing a system where the collider is unaware of the shape it's colliding against. I'd like to have a abstract base class called ...
0
votes
1answer
44 views

Circle to Circle Collision of moving Sprites

i needed help attaching circle1 Sprite to circle2 Sprite on collision onto the same point where they are getting collided, and both circles are moving with Action. Like this, Attaching means, when ...
1
vote
1answer
96 views

How do I check if a window has focus in SDL2?

Is there a replacement for SDL_GetAppState function in SDL2 from older SDL versions? Why was it removed? I want to use it so I can check if the user has focused the ...
1
vote
1answer
158 views

Welzl Algorithm to find the Smallest Bounding Sphere

I'm implementing Welzl's Algorithm to find the Smallest Bounding Sphere. In brief, the algorithm works by maintaining: a set of points to contain in the sphere (inside its interior, or on its ...
1
vote
3answers
65 views

Rotation of a matrix with unequal rows and columns

I have this simple matrix class which has a char** array for storing the data. The data array gets initialized like this: ...