Questions tagged [c++]

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

Filter by
Sorted by
Tagged with
1 vote
2 answers
185 views

Line-of-sight algorithm for tile-based tactics

I've tried Bresenham line and Raycasting, but they don't quite give the results I need (examples in the screenshot). '&' - character '+' - cells that can be attacked by the character '#' - walls ...
user avatar
  • 13
0 votes
1 answer
30 views

Passing callback to animation function?

I have the following class that animates a 'fade to black' effect: ...
user avatar
  • 103
1 vote
1 answer
39 views

Rectangular Collision Resolution behaving incorrectly on corners

I'm currently writing a simple game engine and encountered an error while trying to resolve rectangular collisions. When an object moves diagonally and collides with a solid object I only correct it ...
user avatar
0 votes
0 answers
48 views

Where should I download C++ for MacOs [closed]

i started the study c++ alone and i cannot find Where should I download C++ for MacOs Xcode? takes too much time for download on my Mac
user avatar
0 votes
0 answers
20 views

how do I chage pixel color? (SDL2)

After a long time away, I'm coming back to SDL, using version SDL2. I have some example code that does pretty much exactly what I want it to do, but I want to change the pixel color. Ive tried ...
user avatar
  • 101
0 votes
0 answers
26 views

How to use matrices in 2D

I'm trying to wrap my head around matrices, and how to utilize them (using glm). From what I've seen, it seems like a neat solution to mutate sprites purely by matrix transformations, like affine ...
user avatar
  • 103
0 votes
1 answer
22 views

Mode7 transformations

I've been studying mode7 from the SNES, and looking how to build it myself in C++. I've found plenty of examples in SDL for rendering stuff like Mariokart levels, where the mode7 effect is applied by '...
user avatar
  • 103
0 votes
0 answers
25 views

How do you load bitmap data into an array?

Here is what I currently have: ...
user avatar
0 votes
0 answers
25 views

How to shoot raycast, and display image on canvas

I have been trying to work on raycast, where if a raycast hits an object then an image will be displayed on the canvas, like on COD Warzone if I go to an elevator shaft, and look at the wire to go up, ...
user avatar
0 votes
1 answer
47 views

Some objects only rendering half of the screen in snake game

I'm trying to make a basic snake game with OpenGL. I hold all the game object locations in a matrix called MAP. And when i render them, i operate the location info ...
user avatar
  • 5
0 votes
1 answer
46 views

How to I modify a texture in OpenGL?

I am programming the editor for a RTS game and I have created the following: I am trying to modify the terrain so that it is not completely grassy. I am intending to add functionality so that I can ...
user avatar
0 votes
1 answer
53 views

Input reaction is slow in two player snake game

i'm trying to make a two player console snake game. One of the snakes is controled by 'wasd' and other 'uhjk'. I have two function to get the keys getKEYS1() and <...
user avatar
  • 5
0 votes
3 answers
16 views

Should the coordinates, and rotation angles of all the sprites be stored in variables?

I've learned that magic numbers are bad in code. However, should the coordinates, and rotation angles of all the sprites be stored in variables? Is the convention in game development to leave those ...
user avatar
0 votes
1 answer
35 views

Is it possible to have shared data between shaders in GLSL that is loaded once?

For my game engine, I would like to be able to load all of the matrices (i.e. mvp, model, etc.) once per frame to save a bit of time, and have a set of uniforms that any shader can access by using ...
user avatar
  • 1
0 votes
0 answers
38 views

ImGui Rendering Text Atlas instead of Framebuffer color texture

My application looks like this: I am using Dear ImGui for UI and wish to draw the frame buffer contents into a texture and then display that texture in an ImGui Window. I have followed the official ...
user avatar
1 vote
1 answer
64 views

How do I modify parts of a texture on a quad?

I am programming a Real Time Strategy game, and I was wondering how I could retexture one part of a terrain quad to change a texture in the position where I click at. For example, if I clicked in the ...
user avatar
-1 votes
1 answer
161 views

How to generate terrains in real time?

I am trying to make a terrain editor for my Empire Earth OpenGL clone engine. Are there any articles of how to generate terrains in real time? It would be cool if it had pseudocode, even cooler if it ...
user avatar
0 votes
1 answer
33 views

Skipped function calls on Integer based frame data

I'm creating a basic animation system, where I call functions to change the rendered sprite and turn on hitboxes based on the current frame of the animation. For example, if (current_frame == 8), I ...
user avatar
0 votes
0 answers
201 views

How can I use single uniform variables inside this Vulkan shader?

I have set up a shader like so. Instead of having all projection view model in a single ...
user avatar
0 votes
0 answers
20 views

DirectX 12 Ultimate graphics sample generates a D3D12 "CBV Invalid Resource" error

Presently I'm working on updating a Windows 11 DX12 desktop app to take advantage of the technologies introduced by DX12 Ultimate (i.e. mesh shaders, VRS & DXR). All the official samples for ...
user avatar
1 vote
0 answers
88 views

How to calculate geometry term from "Multi-Scale Global Illumination in Quantum Break"?

In presentation "Multi-Scale Global Illumination in Quantum Break" from SIGGRAPH 2015, on slide 105, they present concept of geometry term, which is used to help with light leaks in volume ...
user avatar
  • 111
0 votes
0 answers
64 views

Movement diagonally is not consistent

I am making my own game and this is the first time i'm doing so. so I hope you can forgive stupid mistakes. Im making this in C++ and using the SDL2 framework. Currently, I have a character on my ...
user avatar
0 votes
1 answer
41 views

Box2D bodies order inside the world

I'm working on a small platform game using box2d. When I create the game's objects I store them inside a vector. One for dynamic bodies and one for static bodies. ...
user avatar
0 votes
1 answer
39 views

SDL2 and TmxLite (Tiled) (Reading the actual TILE data from the layer)

I am trying to make use of the Tiled Map Editor for my SDL2 projects. (By using the TMXLITE parser from Fallahn on Github) https://github.com/fallahn/tmxlite ...
user avatar
0 votes
1 answer
59 views

Sometimes player moves too much

I'm working on a simple platform game. I have the player - a dynamic body, which moves by ApplyLinearImpulse. Generally it works very well, but sometimes the player ...
user avatar
0 votes
1 answer
39 views

Box2D make dynamic body fixed on the y axes

I working on a game project using C++ with SMFL and Box2d. I'm basically recreating the game "Jump and Hover", a simple platform game. In the game ther is an platform thats "hovering&...
user avatar
0 votes
2 answers
142 views

Game loop c++ implementation

I'm starting to develop some simple 3D game. The basic topic for a start is the game loop. There is a solution: ...
user avatar
0 votes
1 answer
46 views

"Fix Your Time Step" Variable or Fixed Physics "timeStep" parameter for Step in Box2D?

I have seen multiple contradictory articles on this topic. Have been trying to implement the Should the function call ...
user avatar
0 votes
1 answer
47 views

What would be a correct ID3D11Query design for occlusion testing?

I've tried looking for tutorials or samples related to the topic - but all that I could find are either scientific papers or vague posts on forums. As I understand it - I need to dedicate a whole pass ...
user avatar
  • 1
0 votes
1 answer
55 views

Network racing game position interpolation jitters a lot

I'm making multiplayer racing game and I have problem with interpolating position.. Here's the sequence. Server simulate the world and send vehicle transform packet through UDP socket every 33ms to ...
user avatar
  • 3
1 vote
1 answer
58 views

How to inherit from a custom node of a gdnative plugin, in gdnative?

Context I am developing a game in gdnative and I would like to design it in several "modules", where there would be: a main module for the core gameplay, a second module that I defined as a ...
user avatar
0 votes
2 answers
73 views

X axis intersection with inverted Y axis coordinates

I'm making a visual clue for the player to know where (and more or less when) an asteroid is going to enter the screen. For this I'm using a triangle pointing at the incoming object and color ...
user avatar
  • 13
0 votes
0 answers
34 views

How does using C# and C++ together with Unity affect efficiency?

I'm new to game dev and I'm looking to use Unity to create a phone game that will utilize neural networking. Obviously, putting neural networks in a mobile game presents a serious performance concern, ...
user avatar
  • 1
1 vote
1 answer
20 views

Inconsistent behaviour from MonoObjects

I have embedded mono inside a c++ game engine to be used with my component system. Currently, I store the MonoObjects (instances of the components) using entt like this: ...
user avatar
0 votes
1 answer
64 views

Function glBindBuffer access violation while executing

So I have a problem, I am calling some opengl frame buffer functions in my code but for some reason I get the error from the title. I am also calling many other opengl functions without any problems ...
user avatar
0 votes
0 answers
22 views

DirectX 8 Win32 GUI Not Appearing/Flickering While Running

I am programming a game with DirectX 8, and I am trying to use the GUI options that are provided by the Win32 window that I am using. However, when I try to render a button or, in this case, a textbox ...
user avatar
0 votes
1 answer
53 views

D3D11 CreateInputLayout error: CREATEINPUTLAYOUT_UNPARSEABLEINPUTSIGNATURE

I created a simple shader, and it compiled, but when using the vs as input layout, it failed with CREATEINPUTLAYOUT_UNPARSEABLEINPUTSIGNATURE. I don't know why. ...
user avatar
0 votes
0 answers
28 views

SDL_BlitSurface() 'dstrect' - Not working as I expected

I am new to SDL but have used C++ a fair bit over the years. I'm struggling with displaying sprites with a scale. EG. Here I am trying to draw a grid of squares (ie. Tetris) but the source BMP is ...
user avatar
0 votes
0 answers
31 views

Why does object not show?

I would like to tell about my home made exercising step to step with LWJGL and Java. But I don't understand why does matrix shut up? Transformation.java: ackage Example; ...
user avatar
0 votes
1 answer
53 views

Detect if actors are inside another actor with custom shape

I have few actors with custom, non convex geometry (mesh) created using PxRigidActorExt::createExclusiveShape and a lot of actors with ...
user avatar
  • 111
-2 votes
1 answer
680 views

Is it possible to make a 2D game using Unreal engine 5?

Is it true that UE5 can't be used to make a 2D game?
user avatar
0 votes
1 answer
57 views

How can I determine which 2d entity was selected from a overlapping pile

I'm using C++ and SDL2 to learn about coding by creating a clone of a 2d tile-based game I enjoy. To setup my problem; There can be multiple items dropped on a tile by the player or other entities ...
user avatar
0 votes
0 answers
35 views

How do I create a texture from a surface in DirectX 8?

I am making a game in DirectX 8 for a retrocomputing game contest. I am creating a Real Time Strategy game, and I am trying to make a minimap, which is merely an orthographic view of the terrain. When ...
user avatar
1 vote
0 answers
93 views

Draw and render a sequence of 3D models with OpenGL

I have an application that will generate a 3D model for a dynamic 3D object (3D mesh + texture formatted as .obj file) at a time, so I end up getting a stream of 3D models (or 4D models?), and I want ...
user avatar
  • 111
0 votes
0 answers
41 views

Projectile Aim Prediction with Target Acceleration and Bullet Deceleration Varying with Angle

I previously asked a question about this topic here, and now I'd want to review if the offered solutions worked, and then frame a new inquiry based on the difficulties and issues that resulted. So my ...
user avatar
0 votes
1 answer
120 views

Intercept an accelerating object with a constant velocity projectile

I want to calculate the time that it takes to intercept a moving target "plane" with a projectile. For example I have two 3 dimensional vectors (2 locations in 3D space). ...
user avatar
0 votes
1 answer
184 views

How to make object follow the mouse OpenGL?

I am trying to move an object on the 2D plane to follow the mouse position. I converted the mouse's XY and depth buffer value to world space coordinates, but the problem is that when I run the program,...
user avatar
1 vote
0 answers
65 views

2D tilebased collision system

Hi i want to implement a collision system (something comparable to super mario) I would like it to have objects which can have any size (the hitbox of it) And it should be reasonably efficient (so ...
user avatar
  • 11
0 votes
0 answers
77 views

unity native plugin: UnityPluginLoad is called but UnityPluginUnload is not?

I created a unity plugin which uses the low level native plugin interface, specifically UnityPluginLoad and UnityPluginUnLoad. Here is my result: When the dll is NOT marked with "Load on startup&...
user avatar
0 votes
0 answers
114 views

Constructing a world ray from mouse coordinates

I've got the following c++ code. It produces a Ray from the mouse coordinates given. However the z coordinate is wrong, I expect it to be on the near plane of the ...
user avatar

1
2 3 4 5
83