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
53 views

Batch rendering model matrix to shader

I'm working on a batch renderer. I'm limited to using one shader per batch (one draw call for everything). I want to use a TBN matrix for my lighting. To calculate the TBN matrix for each object I ...
  • 101
-1 votes
0 answers
55 views

Solution for minting digital assets to NFT [closed]

I'm looking for a solution for minting in-game digital assets to NFT by connecting Web2 games to Web3. Are there any tools you use? I couldn't find anything free. I'm thinking of building a free tool ...
0 votes
0 answers
15 views

When calling SDL_CreateTextureFromSurface using SDL2 it sets all other textures to be white boxes

I have a game loop which shows 6 heroes, and 1 is assigned to the user; if the user clicks the left mouse button, I want to spawn a bullet. All of the heroes show fine and render works when the game ...
  • 1
0 votes
0 answers
22 views

How do I generate Landscape actor based on player coords in UE5.1 c++?

After searching everywhere and only finding blueprint ways to do something similar using regular meshes in UE4, I've landed here. I tried RTFM but I have severe ADD and get lost in tangents that never ...
0 votes
0 answers
29 views

UE4 - How can I show in image using Slate?

I am working learning Slate for doing the UI. I am having a problem setting a background image. The background is all black and I do not see the image anywhere. What am I doing wrong? I have done ...
0 votes
0 answers
40 views

2D physics engine collision issues

I'm currently stuck developing my own simple physics engine. I'm getting an issue where objects wont come to rest. Instead, they jitter and eventually are shot off into the distance, and some even ...
0 votes
2 answers
49 views

Interactable actors should be implemented via components or inheritances?

I am new to game development and I am learning Unreal Engine right now. When a player character APlayer wants to interact with other actors (such as ...
0 votes
2 answers
174 views

Defining path for tower defense game

I'm currently developing a tower defense game as a part of a group project in school. This game will be programmed in C++ using SFML. We are having trouble with finding a good way to define the path ...
0 votes
1 answer
85 views

OpenGL 4 tracers

We have implemented a glow map into our renderer. It basically uses a blur filter on the glow map pass. But, I cannot figure out how to do tracers in OpenGL. Someone suggested using a couple of ...
1 vote
1 answer
121 views

Why is my Moon not orbiting Earth in my physics demo

I am in the midst of making a gravitational body demo for my physics engine. For the demo, I am trying to simulate both all the inner planets' (Mercury-Venus-Earth-Mars) orbits around the sun, as ...
  • 13
1 vote
0 answers
46 views

Improve performance of hexagonal tiles

I am trying to create a game similar to a board game on a hexagonal grid (also similar to Civilization game). I want the tiles to be able to display various textures and of course be able to detect ...
2 votes
0 answers
52 views

How can I write a fold expression in Unreal 5?

I'm trying to write a variadic function template that would fold a parameter pack over an expression in UE5. However, the compiler fails on the fold expression. Since my function is a little complex, ...
0 votes
1 answer
74 views

OpenGL 4 depth of field

I am implementing depth of field. My fragment shader has the following code in it: ...
0 votes
1 answer
46 views

Calculate the Right and Up vectors using yaw and pitch in right-handed coordinates

I have an assignment where they ask me to calculate Vector Right and Vector Up, it's for a camera creation using C++ and DirectX. For the Vector Right, they specify I should use 90-yaw, so I got: \$ ...
0 votes
1 answer
57 views

OpenGL 4 hidden line removal

I'm having trouble with hidden line removal in OpenGL 4. I use a vertex/geometry/fragment shader to draw the lines. I call glDepthRange(0.01, 1.0); before I draw ...
0 votes
1 answer
120 views

How to set up server architecture using C++

I'm trying to make a Multi User Dungeon (MUD) game, and obviously a pre-requisite to that is a server. I've seen stuff like this: ...
0 votes
0 answers
71 views

Server-Client Communication

I have a client, and it's basically a potato client. What I mean by that is it's code is something like this: (This is a junky version of the code, just to make a point) ...
1 vote
1 answer
102 views

How to replicate damage between users in a MUD

I'm working on a text-based MUD (Multi-User-Dungeon) in C++, but the most important thing in a MUD is the MU (Multi-User). Is there any easy way to implement these mechanics? I want a player on one ...
1 vote
0 answers
45 views

Object::cast_to in godot still casts even when the cast is invalid

I have a class for a projectile defined like this: ...
0 votes
0 answers
53 views

C++ Problem With Separating Axis Theorem When Using Rotations

I started writing small game that uses some collision detection. I have been able to implement a working SAT collision detection prototype, but I figured out that it stops working properly, when some ...
0 votes
0 answers
45 views

How would I go about fixing my variable rate SDL timestep?

I my gameloop is going around 10x faster than what it should be and I have no idea how to fix it. I tried multiple different other variable rate timesteps but none seem to be as effective as this one. ...
  • 1
0 votes
1 answer
41 views

Viewport offset from top also creates a gap at the bottom

I am trying to do something really basic with sf::View. On a 1280x720 pixel window. I need to place a viewport which is 560x560 with a 160px gap from the top. What ...
  • 13
0 votes
0 answers
67 views

Solution for back-and-forth jitter when sliding down terrain slopes?

I've got a C++ app where the player is represented by a vertical line segment, walking on triangulated terrain. There's some terrain sliding that allows you to walk on the terrain as long as the ...
  • 69
0 votes
0 answers
58 views

Directx12 command list reset close memory leak

I simply reset and close the command list but my memory usage goes up 5 gb per second. This is the simple list of things I do Reset command buffer Close command buffer Reset command allocator I feel ...
  • 48
1 vote
0 answers
40 views

How to add oblique frustum (lens shift) to UE5 camera?

I want to make a game with an oblique frustum instead of a standard frustum. Unity camera has lens shift option for an oblique frustum. But UE5 does not have such thing. In this Unity document, I can ...
  • 111
0 votes
1 answer
43 views

How to get my node to only execute _process_physics when the game is NOT paused and never in the editor?

I have implemented a simple "rocket" in 2D, it accepts UP and DOWN for acceleration and left/right for rotation. The implementation looks like this: ...
0 votes
0 answers
23 views

How to use key bindings in Godot from C++ extension code?

I have created a simple C++ "game" in godot. Lacking any good documentation, I based my work off examples on the internet, and for input I have this: ...
0 votes
0 answers
36 views

How to automate strafe jumping?

I'm a complete noob when it comes to math so excuse my ignorance. I've trying to automate strafe jumping (from the quake engine) into another quake engine based game. I've tried a fair bit to get this ...
0 votes
0 answers
29 views

What do I need to do in order to use RenderDoc to capture a frame in an android app(openglES or vulkan)

I used visualstudio 2022 to create a native activity template project. This project by default, when running on an Android phone, will keep changing the screen colour. After building it to an Android ...
0 votes
0 answers
20 views

How to determine whether an image in 2D is moving in clockwise direction or anticlockwise direction with cursor movement by dragging the mouse? [duplicate]

I am able to rotate a medical image individually one by one i.e by commenting the clockwise rotation code it is getting rotated in anticlockwise direction and by commenting the anticlockwise code it ...
0 votes
0 answers
41 views

The player gravity decreases when I add linear damping

Recently I added p_pBody.body->SetLinearDamping(8.0f); code to my player's instantiate code to prevent my player from sliding after I move right or left. Now the ...
  • 1
1 vote
0 answers
38 views

Odd SDL VSYNC behaviour when monitor is set to 50 Hz

I am observing strange behaviour with VSync in SDL. I have this code: ...
  • 201
0 votes
1 answer
40 views

Arrow key presses stop affecting game after pressing them 4-5 times

I'm trying to program a simple space shooter and my goal right now is that when the player presses down and holds a key, the ship accelerates to a max velocity. I have that somewhat; the problem is ...
0 votes
0 answers
48 views

How to allow objects in a list to access the object that owns the list?

I'm trying to make a voxel game while learning about OpenGL. The world is made up of many chunks of voxels. Therefore there is a Chunk class, containing an array of ...
0 votes
0 answers
21 views

Player Camera and Map Scrolling not working as intended

I'm creating a top-down 2D rpg game in c++, and I can't seem to wrap my head around the concept of map scrolling. My camera system is centered on the player every time my player moves, (cameraPos = ...
0 votes
0 answers
17 views

UProperty of AStaticMeshActor type resets to "None" after picking in Editor

I have an C++ class “Manager” that derivatives from AActor. Inside of it, I have a property of type AStaticMeshActor: ...
21 votes
6 answers
3k views

Consistent cross platform procedural generation

What techniques have people successfully used or can suggest to deal with a consistent cross platform math for procedural world generation? Also, if you have done this, what were the pros and cons of ...
  • 458
0 votes
0 answers
42 views

Rotate game object to the mouse pointer

I am making a game from scratch using OpenGl and GLFW. Since my motivation is to learn computer graphics, I am using my own explicit math functions for rotation and translation. My current rotation ...
0 votes
0 answers
93 views

Getting start with Rider for Unreal - Why can Header file not be found when it is within same directory?

I am just getting to grips with the Rider editor. Why does this .cpp file fail to find the #include header file? It is in the same directory tree. Certainly they are not required to be in the same ...
  • 1
0 votes
1 answer
94 views

Barycentric coordinates outputting coordinate outside of triangle

So I am trying to draw and fill a triangle on the screen using the barycentric method, but my barycentric implementation seems to be outputting outside triangle coordinates, why? ...
0 votes
2 answers
64 views

DirectX11 creating input layout throws error on input signature not matching shader (instancing)

The input layout ...
  • 131
0 votes
0 answers
15 views

Is is possible to convert C++ to switch? [duplicate]

I'm just wondering if it is possible to make a Nintendo Switch game with c++? Because I am just trying to make a game for pc and Nintendo Switch. If it is possible then how could I?
0 votes
0 answers
23 views

Beginner - Need help with API's etc for video game in C++ [duplicate]

I’m trying to program my first actual good video game that will be an FPS. I’m a beginner at C++ and I have messed with OpenGL a little. I have two parts to this question: What graphics pipeline API ...
0 votes
2 answers
100 views

How to add a save/load game function to a Lua/C++ game engine

I'm curious what the best approach would be to save the current state of my game. The lua scripts contain the gamestate, but also some gameplay related info that doesn't need to be stored as part of a ...
  • 115
0 votes
1 answer
89 views

Why won't my legs rotate at the top instead of the centre

As the title suggests, I'm battling with getting the legs of my model here to rotate properly. They rotate in the middle instead of at the top where the knee joint would be. So far I've tried ...
1 vote
2 answers
374 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 ...
  • 13
0 votes
1 answer
43 views

Passing callback to animation function?

I have the following class that animates a 'fade to black' effect: ...
  • 115
1 vote
1 answer
56 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 ...
0 votes
0 answers
122 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 ...
  • 101
0 votes
1 answer
46 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 '...
  • 115

1
2 3 4 5
83