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

How would I go about coloring marching cubes terrain?

I'm making a game with marching cubes terrain (I know very original idea) and I don't exactly know how to color it. I have a system to do it, I just need to know how to interpolate it where it's not ...
1
vote
0answers
17 views

Creating an external tool to edit Unreal project optimization settings

INTRO I am creating a C++ app that will help users to set up optimization settings in the Unreal game engine. I want to let the program make all this work on its own. This application is being written ...
0
votes
0answers
17 views

PBR GLSL shader incorrect lighting. Half being shaded

I have been following the tutorial at LearnopenGL to implement physically based rendering into my Vulkan game engine, and have gotten the following incorrect lighting results: The light is overhead, ...
1
vote
0answers
13 views

How to create a joint, where the rotation of one object is relative to the other?

I would like to create a top down view scene, with one rectangle (top) is on top of an other (base). There is a joint, where ...
0
votes
0answers
29 views

What does glBlendFunc(GL_DST_COLOR, GL_ZERO); mean?

I need to write a description about a filter method I made but I don't know what glBlendFunc(GL_DST_COLOR, GL_ZERO); means.
0
votes
0answers
16 views

Chess Programming - Principal Variation and Transposition Tables

Right now I am currently trying to implement a principal variation search algorithm for my chess engine (C++) as well as a transposition table. I have looked at various sources online and have become ...
0
votes
0answers
10 views

Help trying to use TinySoundFont library with SDL_Mixer

I'm using SDL_Mixer in my project currently and I found the following library to play sounds from a soundfont https://github.com/schellingb/TinySoundFont I tried this example which use the normal ...
0
votes
2answers
49 views

Tower Defense: Sorting Algorithm with multiple weights (enemy AI)

I'm writing a sorting algorithm for a tower defense mobile game. As a quick synopsis, I have a "tower" that can shoot at incoming threats that are within X distance from the base of the ...
0
votes
2answers
53 views

How to vertically flip a DDS texture on import?

I have a program capable of rendering 3D graphics using Direct3D11 and it is currently compatible with two different texture formats, TGA and DDS. The code to read and load a TGA texture in memory I'm ...
0
votes
0answers
22 views

Single Texture Array, multiple wrap modes

I have a texture array of which I would like some of its sub-images have wrap modes of GL_REPEAT and others to be ...
0
votes
1answer
36 views

Distance between moving, rotated rectangles in snake game

I am trying to implement basic Snake game with movement based on timestep. For now I've got something along those lines: Update function: ...
0
votes
1answer
47 views

How do I contiguously store and iterate over ECS components in C++?

I'm writing an entity component system and want to store each type of component separately and contiguously in memory in a way that's easy to iterate over. Component...
0
votes
1answer
69 views

How to perform a fast ray cylinder intersection test?

I need an algorithm in c++ to get the intersection point of a line if there is an intersection. My cylinder is defined by a 3d vector center point, a float height and radius. I don't need to take ...
0
votes
1answer
25 views

What to do with d3dx9math.h when converting to DirectX11?

I'm converting an old game from DirectX9 to DirectX11 and I have a question: What I should use instead of d3dx9math.h? Do I have to convert everything for ...
0
votes
1answer
31 views

Trouble with Raylib install on Arch Linux

I am learning Raylib game library, but in the "First Person Maze" example the images cannot be found, for example:  ...
2
votes
0answers
31 views

OpenGL : Blending & feedback effect

I'm struggling on a simple project, as an example/sandbox, I'm rendering a small oscillating rectangle on my output. I'm not using glclearcolor() but instead, on ...
0
votes
0answers
30 views

How to include a FX shader to my game?

I have an old game source from 2004, the game runs DirectX9, and I want to improve the graphics. I downloaded NVIDIA FX Composer 2.5, and I created a “...
0
votes
0answers
14 views

DirectX9 HLSL .cso file import to Visual Studio

I started to learn HLSL because I want to upgrade the graphics of an old game from 2004. The game uses DirectX9, so I created a Vertex Shader with shader model 2.0 and now, I have two questions: ...
3
votes
2answers
84 views

Given a base class and many derived classes with additional features, what's the best practice for accessing those features?

This might sound strange, but let me explain. Say I want to write a safari program. In this safari there is an object pool of 10 animals (Animal*): 2 ostrich, 5 ...
0
votes
0answers
6 views

DirectWrite and Set Character Spacing - Trouble using extended DW functionality

I'm having a hard time grasping the problem getting the newer/extended functions in dwrite_1.h to work with my existing code and hope that someone here can shed some light. This is my existing set up.....
0
votes
1answer
41 views

How do I implement an input wrapper like Unity's in SDL2?

This is my first time actually trying to wrap the the SDL event handling functions in a class of my own. I'm trying to achieve a design similar to unity's where you have this static Input class and ...
0
votes
0answers
17 views

How do I determine that the edge of the camera intersects the edge of the background sprite? UE4

I'm trying to make sure that when the camera reaches the border (left or right) of the sprite's background, a copy of it is spawned from the corresponding side. But I seem to be missing something in ...
0
votes
1answer
24 views

How to read ARGB pixel data from SDL2 surface and store them in an array?

I've been trying for hours now to figure out why this piece of code is giving me seg fault, but can't figure out why. ...
0
votes
0answers
35 views

Octree LOD without traversing the entire tree

I am working on a voxel engine that uses a huge Hashed Linear Octree that reconfigures when you move. Each octree leaf is a voxel. The world is procedurally generated using 2D Perlin noise. The octree ...
1
vote
0answers
22 views

Unreal Engine Procedural Mesh causing crash when rendering chunk size too large

Hey guys im pretty new to unreal but id consider myself a fairly advanced programmer. Im really stuck on rendering my chunks for my voxel game. The implementation is pretty simple and everything works ...
1
vote
2answers
68 views

Centering Image inside ImGui window causes bug

I've tried drawing RenderTexture directly to the ImGui window and I've stumbled upon a bug. Everything is drawn correctly until I center ImGui Image inside the ImGui window. Centered Image: Not ...
0
votes
1answer
61 views

How to implement drawing only to the specific area of the window?

I'm trying to implement "canvas" where I will display loaded texture and select specific parts of it so I can put them on tilemap, I'm also trying to add zooming and panning only in "...
0
votes
1answer
31 views

Octree Terrain Destruction and LODs

Meet my octree world: My end goal is to have this world destructible, and I am having an issue warping my head around how this can be done when you have LOD. The basic principle of LOD (as I ...
0
votes
0answers
46 views

Benefit of storing chunks as Octree leafs vs single block as Octree leaf

I saw many voxel game developers opt for a strategy that involves using an octree whose leaf nodes include a 16x16x16 (or 32^3 or 64^3) chunk instead of having leafs represent a single voxel. What is ...
2
votes
0answers
31 views

How to get struct layouts from vertex shader input using ID3D12Reflection

I am attempting to write a code generator that builds C++ structs/classes from D3D12 reflection data built using DXC. Given a simple vertex shader signature: ...
0
votes
0answers
20 views

Unreal Engine 4: Referencing an asset with asset user data instead of a class?

I created a subclass of Uassetuserdata, creating a new type of asset. Now I can reference this new class in the user asset data section of my skeletal mesh. I noticed that I could create a blueprint ...
-1
votes
1answer
51 views

Why are vertices coordinates are always between -1 and 1 in 3D Models

I'm writing my very first 3D rendering engine in C++ using SDL2, and I've been following this book that has multiple code examples that has 3D models with vertices that all have coordinates between -1 ...
0
votes
1answer
41 views

It is possible to process data on relay servers?

I have a small game engine done in Java, and re-creating it on C++. While re-creating it i've decided on adding basic p2p online multiplayer. However, after reading more about networking, there are ...
2
votes
1answer
68 views

Predicting trajectory of Box2D physics body using both: linear dumping and gravity

I would like to calculate position of physics body after some time because of predicting shots trajectory in my game. I found some great answer here where Iter Ator provides equation to calculate ...
1
vote
0answers
66 views

Will using a fixed point library in C++ give me 100% deterministic replays?

I'm working on a scrolling arcade shooter in C++ with SDL2 and I'd like to have a replay function so players can save, share, and replay good runs. I understand that floating point math is not ...
0
votes
2answers
44 views

OBJ file has more vertices than normals

Here is a Pastebin of my OBJ file created using Solidworks 3D https://pastebin.com/6MgQBF8J I don't understand how the number of vertices (645) can be larger than the number of normals (306) I ...
0
votes
1answer
65 views

How to create same paradigm of monobehaviour and processing in C++

Having worked with monobehaviour and processing before, is it possible to create the same paradigm both frameworks use which basically is writing all code in two main functions, start/setup and update/...
0
votes
0answers
78 views

How to draw a rectangle at x,y where x & y are in pixel?

Here is my code : ...
0
votes
0answers
94 views

Supporting multiple graphics apis

I would like to provide support for switching between both OpenGL and Vulkan in my game (and potentially DX12 later). Currently I only know OpenGL so I am working on that. I have read a lot of posts ...
1
vote
1answer
51 views

Problems with porting LWJGL code to C++ (glDrawElements call returns error 1281/GL_INVALID_VALUE)

So, as the title might suggets, I'm currently trying to port a gui stack for my game engine from LWJGL(Java) to C++.I originally had this following code in java: ...
1
vote
1answer
88 views

OpenGL - Debug version runs faster than Release version

My Visual Studio 2019, 64-bit version of Tetris using OpenGL runs significantly faster, 3X, in Debug mode than in Release mode. The image above shows the board. Each cycle of the rendering or game ...
0
votes
2answers
45 views

Rotating an object to face the same direction as another object

Feel like I should know this, maybe I'm just over thinking it. What I'm attempting to do is create a bullet hole plane/texture object on top of an existing mesh when a ray cast returns a hit point. I ...
0
votes
1answer
98 views

Looking for a game engine to make a game like “Ikariam” or “Ogame” [closed]

I'm an IT student and currently in my spare time I want to start a project. I would like to make a game that resembles a browser games like "Ikariam" or "OGame". I don't want this ...
0
votes
0answers
40 views

Best way to save screenshots in a game?

I'm making a game, and I'm adding a screenshots feature. Currently I save screenshot files to <Home Directory>/Pictures/MyGame/. However, I'm not sure if ...
2
votes
2answers
83 views

SDL_SetColorKey in SDL c++ removes most of the white pixels but there is a border around my character

I have drawn all of the images of my sprite in paint. Is there a way to remove all white pixels? ...
1
vote
0answers
51 views

How can I implement better system for ECS?

How can I implement better system/viewer for every entity that has components I specify in, let's say, a variadic template? I've tried to do it myself. What I started with: ...
0
votes
0answers
34 views

Regarding static collision resolution between two circles

I have some code that resolves the positions of two circles when they collide: ...
0
votes
1answer
67 views

Reference counting with resource handles

I have implemented a resource handle and resource cache class. The handle stores an integer id. The cache stores a vector of objects e.g., Textures. The handle id acts as an index into the cache ...
1
vote
0answers
26 views

Fast Occlusion Discovery in 3D Point Cloud

I am trying to find occluded objects given a view point at x,y,z in the scene. For instance in the example below all the points constructing trees should be ...
0
votes
1answer
105 views

How can I avoid coupling between units and their environment?

Currently in the process of making a game like Dwarf Fortress, so without graphics. I'm mostly thinking about how I want to implement everything. While writing code I keep stumbling on general game ...

1
2 3 4 5
80