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
0 answers
28 views

What do you do with SDL2 events?

I have the typical/basic event loop for SDL2 and I'm a little confused on what to do with them or how to handle them or I guess more specifically how should I get the data from these events (e.g ...
Konjointed's user avatar
0 votes
1 answer
20 views

When does SFML deal with user input

I have an SFML programme using window.setFramerateLimit() to determine the time step of the game. I have a game loop that looks like this: ...
Momus's user avatar
  • 1
1 vote
1 answer
169 views

How do programmers distribute their games from custom game engines?

I am currently reading tons of books about game engine, real time rendering, animation, physics... but I could not find any description of how game developers who built their game with their own game ...
Benzait Sofiane's user avatar
0 votes
0 answers
33 views

Screen coordinates in OpenGL shader

I have triangle in screen coordinates, and I have resolution 800x600. How I can put this vertex buffer (triangle with screen coordinates) into OpenGL shader and draw this triangle? Inside shader ...
black4's user avatar
  • 175
0 votes
0 answers
31 views

What is the best way to load models with support for multiple textures per mesh?

Currently, I have a model loader heavily inspired by the one made in LearnOpenGL, which works fine when loading regular models. I made a simple cube in Blender, exported it as an OBJ and I'm able to ...
KleberPF's user avatar
1 vote
1 answer
40 views

Blinding flash. Set background color when creating new window

Using GLFW to create the main window Example c++ ...
Blindman67's user avatar
0 votes
0 answers
47 views

Why doesn't my Raycast detect AABB collision?

I have the following struct that calculates Raycasting: ...
Luigi Istratescu's user avatar
0 votes
2 answers
609 views

What’s the benefit of breaking code down into other classes? [closed]

Sorry if this isn’t the proper spot to ask, but something I struggle to wrap my head around is the benefit of breaking down code into smaller pieces on the surface it seems to make sense I think you ...
Konjointed's user avatar
1 vote
1 answer
54 views

I want to change the direction of my platform from z direction to y direction alternatively

So basically, I want my platform to move first on the z axis from start position to end position, and then from ...
Ken's user avatar
  • 13
0 votes
1 answer
25 views

Set Textures DX12

...
black4's user avatar
  • 175
0 votes
1 answer
40 views

Mouse Ray Picking: Z-Coordinate of Projected vector (glm::unproject)

I've run into a curious issue when implementing ray picking in my game engine. It seems the Z coordinate of the Projected matrix has to be ever so slightly more than ...
Josh McCord's user avatar
-1 votes
1 answer
42 views

Shader compilation error

This is the begin of my vertex shader code: ...
black4's user avatar
  • 175
1 vote
0 answers
61 views

How to avoid/reduce code duplication in asset loading/caching with templates?

I'm working on an asset manager for my game engine, and I'm a bit stumped on how to use templates (and potentially inheritance) to reduce some code duplication. An asset requires 4 things: a container,...
Konjointed's user avatar
0 votes
0 answers
44 views

C++ how to load different assets within an asset manager?

I'm in the process of redoing my asset/resource manager currently I have load functions scattered throughout my code for example LoadMeshFromFile(), LoadTextureFromFile(), LoadShaderFromFile(), etc, ...
Konjointed's user avatar
0 votes
1 answer
56 views

How do I make my character jump, with a curve, in C++?

...
Nehal Chowdhury's user avatar
0 votes
0 answers
62 views

How to detect when console system time was changed since the game was last run, without a net connection?

As an example of the behaviour I want to implement in my game, look at Bloons TD 5 on the PS4/PS5 and its Daily Chest Reward. If you disconnect the internet and change the date and time and play the ...
CodeCamper's user avatar
0 votes
1 answer
32 views

How do Entity Component Systems work?

In the project I am working on, I recently ran into a problem of software architecture: I created a base entity class that displays a world object. Then I added functionality for the entity to have a ...
snow_owl's user avatar
0 votes
0 answers
19 views

Build Fails while building for cocos2d-x 3.17 on Ubuntu 22.04

While building the game (cocos2dx- 3.17 on ubuntu 22.04) it fails with below error - ...
user1897165's user avatar
0 votes
1 answer
75 views

Sanity Check on my Idea for an Event System for game

So, I recently started making a small game from scratch, with no engine used(I'm a beginner at this) and I want to create an event system of my own. I want to check if my general idea for it is okay(...
HavocKid's user avatar
0 votes
1 answer
91 views

encapsulation, structs and global variables?

I have worked on creating a gameloop and so far all of the code was inside a main.cpp file and I want to separate it into different files. Which caused several problems: My code is separated into 3 ...
snow_owl's user avatar
1 vote
0 answers
49 views

Old color attachments being used after resizing window

I have the following deferred rendering setup: The first render pass renders the scene to a fixed size image (2048x2048) from the directional light's point of view to one color attachment as a shadow ...
Symlink's user avatar
  • 133
1 vote
0 answers
71 views

How do I create a build from a custom Game Engine?

I have an custom Game Engine, made in C++ and made in Microsoft Visual Studio 2019. Currently, this Game Engine has a .sln with the following projects: TheGameEditor, which is the current entry point ...
JonathanCacay's user avatar
3 votes
5 answers
3k views

Is there any performance penalty to unsigned integer underflow?

Is there any performance penalty to unsigned integer underflow? Suppose I have a computation subtracting two unsigned integers (so underflow can happen if b > a),...
Qwert Yuiop's user avatar
0 votes
0 answers
28 views

CircleShape crashing program when defined as an instance variable

I am encountering a perplexing issue in my SFML game development where my program crashes instantly during runtime when I add a CircleShape as an instance variable ...
Julian42_74's user avatar
0 votes
0 answers
76 views

How to continue with Unreal engine after crash?

I know that it is possible to do it so that when the engine (and maybe the game) crashes, it does not close, and continues to work. Who knows how to do it? I know there are many ways to do something ...
grouptout's user avatar
  • 101
2 votes
2 answers
109 views

How do materials and shaders work in graphics programming?

I stumbled upon a few videos about shaders and materials from The Cherno and my understanding is that materials are this sort of input that a shader takes to calculate an output instead of hard coding ...
Konjointed's user avatar
0 votes
0 answers
84 views

Cmakelists.txt with sfml/glew/glm .exe doesn't work

I am working on a game in c++, i want to make a Cmakelists.txt file for build a .exe file. ...
Gaëtan S's user avatar
0 votes
0 answers
49 views

How to render two different meshlets at two different LODs in a Mesh Shader?

I would like to know how to render two different meshlet at two different LOD values. So, for example, I render the meshletA at LOD1 and I render the mesheletB at LOD2. Please let me know if this is ...
Giuseppe's user avatar
0 votes
1 answer
89 views

How do real time cutscenes work?

I want to code a real time cutscene editor in my engine but I couldn't find any pdf documents or websites explaining it in detail. Is the cinematic scene file loaded with instructions like ...
user23344561's user avatar
0 votes
0 answers
17 views

DirectX 9 specular component of vert and alpha channel

Suppose I locked DX9 mesh vertex buffer, and took one vertex: ...
black4's user avatar
  • 175
0 votes
0 answers
27 views

Absolute and Relative matrix translation

...
black4's user avatar
  • 175
0 votes
0 answers
38 views

Camera (View) in Euler angles

This is code (below) from original game project (90s years), I it study now. Used fixed point math. ...
black4's user avatar
  • 175
1 vote
2 answers
158 views

Bullet Physics Multi-threading Rigid Body transform jittering issues across threads

I've been working on a game using Bullet Physics for C++ as well as SDL for the windowing (with OpenGL) I've recently threaded the game, so that a separate while loop runs the Physics Simulation, ...
jasonmzx's user avatar
0 votes
0 answers
56 views

How to make calculating the inverse matrix more robust?

When I calculated the inverse matrix, I found that the error in using the float data type would cause the inverse matrix calculation error. Is there any good solution? ...
noodle_run's user avatar
0 votes
0 answers
23 views

Workaround to bind templated functions to lua?

I'm trying to add Lua for scripting to my C++ game engine, which is based on ECS, and I have a rough idea of what I want to do (is it good? probably not) but trying to actually execute it has been ...
Konjointed's user avatar
0 votes
0 answers
77 views

How to compile .obj files into final executable?

I have created a .obj model in Blender. I am writing a screensaver, so, I can have only one file(.scr)?
Praveen Kumar's user avatar
0 votes
1 answer
72 views

How to go about executing lua scripts in a ECS engine?

I'm trying to add scripting with lua to my C++ game engine, and I'm pretty stumped on how to tackle the executing/processing part. I started by creating a ...
Konjointed's user avatar
0 votes
1 answer
71 views

Software rendering - compose View matrix

There is function compose View Matrix, it's software rendering project. Used fixed point math. phd_sin() and phd_cos() user defined functions implement sin() and cos(). Please explain this ...
black4's user avatar
  • 175
0 votes
1 answer
113 views

Implementing a Fixed Time Step?

This has been bugging me for few days now. I'm trying to stop movement jittering in my game. I've looked towards semi and fixed time steps - moving towards the latter below so I can really understand (...
tisolo's user avatar
  • 1
0 votes
1 answer
26 views

Camera code in polar coordinates

I have OpenGL code for camera: ...
black4's user avatar
  • 175
0 votes
0 answers
37 views

How to add Input Modifiers in C++

I have a blank Input Mapping Context to which I add the Input Actions that I require at specific times during my game. For example, when I make a roll, I simply add the camera movement Input Action ...
afarre's user avatar
  • 111
1 vote
0 answers
32 views

3D transform hierarchy rotation applied in wrong order

I'm following in the footsteps of this blog in implementing a transform hierarchy to my game engine scenes. I have a fairly similar implementation for a 3D transform: ...
Boyfinn's user avatar
  • 11
1 vote
1 answer
83 views

Infinite jump issue

I am currently making a game in c++ using sfml, I encountered a problem where if I jump in my game, the jump mechanic allows the player to jump repeatedly in mid-air which is something I do not want. ...
Cheez's user avatar
  • 11
0 votes
0 answers
71 views

How to implement events with ECS?

I'm transitioning over to an ECS architecture for a small C++ graphics engine I'm working on and I'm a bit stumped on how to tackle events. One solution I came across was from this Reddit post ...
Konjointed's user avatar
1 vote
0 answers
56 views

What does a "non viable function" error mean?

I am trying to use a websocket and some C++ code in order to trigger a function toogleLight every time Unreal connects with a server. But I have the following error:...
Nicolas Osorio Bustos's user avatar
21 votes
7 answers
17k views

Do real game developers use blueprints, or do they always use C++?

I'm starting to learn Unreal Engine 4. Every time I use blueprints, I think "that's not right" and I need to use C++, but there are not as many tutorials with c++ code. So, is it ok to use ...
mendzek 's user avatar
0 votes
1 answer
142 views

How to develop a game on a 2015 MacBook Pro without learning Metal?

I'm on Mac and OpenGL and Vulcan are not supported. Even worse, I'm on a 2015 MBP 13". Yeah, can't do much with that. I spent a full year learning C++ and I have no patience to try and learn ...
BeardlessDev's user avatar
0 votes
1 answer
60 views

Setting up perspective projection in OpenGL

I'm trying to set up perspective projection in OpenGL but it doesn't work ...
DDD's user avatar
  • 11
2 votes
0 answers
49 views

How does non ECS parts work with ECS parts?

I incorporated ECS to my graphics engine and I have a problem with my Renderer needing the camera which is an entity and the process is a bit bizarre. Originally, I ...
Konjointed's user avatar
0 votes
2 answers
74 views

What happens with global/singleton objects when using ECS?

As I've been learning about ECS one thing that gets me confused are things like input which in my case has usually been some singleton that gets polled or in one project was event based where code can ...
Konjointed's user avatar

1
2 3 4 5
87