Questions tagged [c++]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
180 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 ...
1
vote
1answer
120 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
89 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
845 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
338 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
254 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: ...
1
vote
1answer
143 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
164 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
694 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
267 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
48 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
125 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 ...
1
vote
0answers
65 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
89 views

SFML: How to draw/render from Screen class

Game architecture is as follows: // main.cpp ...
4
votes
1answer
306 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
625 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
178 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
257 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
120 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 ...
2
votes
1answer
577 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
646 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
194 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: ...
2
votes
2answers
405 views

Moving a camera without rolling (tumble not arcball rotation)

I'm trying to move my camera around using mouse+keyboard. I'm looking for specific camera behaviour however, and I cant figure out how to get it right. What I've found, is that to get a maya/tumble ...
0
votes
1answer
1k views

Native C++ console screen buffer

I'm trying to display a game in the console window using a screen buffer but cannot compile it. I have this simple code: ...
2
votes
2answers
491 views

How to draw a 3D capsule?

I want to draw a 3D capsule defined by a segment (two points start->end) and a radius: Image source: Orionist on Wikimedia Commons I already have a sphere leaning on this answer: https://...
0
votes
2answers
561 views

Correctly transforming normals for G-Buffer in Deferred Rendering

I have a deferred rendering system: first there is the G buffer generation, then there is the lighting or shading calculation on that gbuffer data. However there seems to be an issue with various ...
1
vote
1answer
179 views

Physics - How to calculate the next position of a ball rolling against a slope?

For a small C/C++ game project, I want to add some physics on a ball, to allow it to roll against the slopes of a 3d world, in the same way as the example visible in the image below: However I have ...
2
votes
1answer
110 views

Decouple GUI from Logic

I don't have an educational background in the programming-world; however, I've been working on a programm in my spare time for the last two years. I'm currently struggling with how to decouple the ...
0
votes
1answer
3k views

Base class undefined?

I have no idea why I'm getting this error except that it has to do with the includes. Base class header file: ...
4
votes
3answers
772 views

How can I tile Perlin noise to more accurately represent a world map?

I'm currently working on my game. I would like to generate the world map with Perlin noise, and wrap it just like a real world map. I've found a algorithm to create a map wrapped along X and Y axis: ...
0
votes
2answers
454 views

How to implement ECS in a videogame with C++?

What do I need to know in order to implement ECS in a video game? I'm developing a video game and so far I wasn't using any complete architecture, I was just using inheritance but I don't like it ...
2
votes
0answers
150 views

Getting false positives with SAT

I've been trying to get proper collision detection with SAT in 3D. I started of with this post: How many and which axes to use for 3D OBB collision with SAT. I've been trying to get the right axis to ...
0
votes
1answer
39 views

C++: Setup the basic Update function in different classes which all derive from GameObject

Im working on a little game-framework in c++. Currently i have a (base)class called "GameObject" from which all future in-game objects will derive from. Class enemy will be ...
1
vote
0answers
122 views

How to implement weighted blended order independent transparency in OpenGL?

I want to implement weighted blended OIT in my C++ OpenGL 3D game, but I didn't find any C++ examples about weighted blended order independent transparency. Paper How to clear accumTexture(...
0
votes
2answers
268 views

How can Perlin Noise be modified to not tile?

In vanilla perlin noise, the texture repeats after 256 coordinates, due to the way it picks a gradient vector. In games that require an infinite procedural world, however, this is not an acceptable ...
0
votes
1answer
706 views

What's the difference between UClass and UObject?

I know that UCLASS() macro creates a seperate UClass for every UObject class ,but what is the need for this seperate class , how both of these classes relate to each other and what is the basic ...
0
votes
0answers
43 views

how can i start mipmap technic from character?

hi how can i start mipmap technic from character ? i mean example like this picture : in my code mipmap starts from camera(Near Clipping Plane). i dont want this. ...
0
votes
0answers
79 views

Inverted left & right stick axes in SDL2

I've faced a weird problem with SDL2. ...
0
votes
1answer
399 views

C++ - How to create an engine editor without frameworks like qt and wxWidgets?

Basically sometimes I like to try to venture into the world of graphics computing, sometimes I have a project or another that uses opengl plus all the "blind" with opengl, I wanted to be able to ...
1
vote
1answer
950 views

Why am I getting an access violation when assigning to a 2D array member?

c++ Beginner here, coming from Java background, and I'm getting the feeling this is a c++ specific error I'm running into. I am trying to procedurally generate a 2D map, which is of type Tile[y][x]. ...
2
votes
2answers
176 views

Time based events separate from the game loop

How can set up time elapsed based events separate from the game loop? I want the character to heal over real time rather than per cycle of the game loop. How might i do that?
0
votes
1answer
68 views

VBO interleaving dillema

I'm trying to write a map editor for a unity game using openGL. In order to do that, I need to unpack it's resource files to get meshes, textures and other good stuff. In doing so, I've discovered ...
1
vote
2answers
127 views

c++ text rpg loading rooms/mobs

So for practice and as a learning exercise i foolishly decided to make a text based rpg on my phone using the c4droid ide. ive done well and have learned a lot. So far you can create a new character ...
0
votes
1answer
96 views

Intel GPU running faster than Nvidia GTX 1060

My app in its current state renders only 2 triangles to the screen using OpenGL. I am using std::chrono::steady_clock for frame counting. With Intel graphics, I ...
1
vote
1answer
153 views

Why is my call to SetDisplayMode not supported?

I have some legacy DirectX code that always returns DDERR_UNSUPPORTED. I originally developed the code using DirectX3, and I am porting it to DirectX7 after ...
0
votes
2answers
376 views

SDL/C++ Keyboard Input

I'm having trouble with key management. Movement works fine but the shooting does stuff that I don't want to happen. Every time I press the arrow keys to shoot it works fine but when I press a key ...
0
votes
1answer
142 views

Unreal Engine: Access Violation on FObjectFinder

I got a problem with my project in unreal. I wrote some code about a month ago and it worked fine until yesterday when the editor started crashin on launch. I get this error message in the log: ...
1
vote
3answers
370 views

Why is OpenGL displaying this specific color as white?

I have a sprite class that is supposed to make a 2D rectangle based on the location, colour and size of the rectangle. I have created a renderer class that uses this sprite class to create buffers and ...
0
votes
1answer
259 views

Editor-Assignable function pointer in UE4 C++?

So I have a TriggerBox that I'm using as a pressure pad, and I want to be able to attach objects to it that, when the TriggerBox is activated, will have specific functions called. Similar to unity's ...
0
votes
1answer
508 views

C++ in Unity with dependencies

I am currently creating a c++ program to eventually use in Unity. This c++ program contains references to libraries like OpenCV and dlib, referenced with a include statement which calls in other files,...