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
0answers
13 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
41 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 ...
-1
votes
0answers
55 views

How can I create a custom 3D model format and implement it with OpenGL? [closed]

I want to create a 3D model format which would be easy for me to use and implement it into my game using C++ If it may be necessary, I use Visual Studio Code and Manjaro KDE Linux. as requested by @...
0
votes
1answer
38 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 ...
0
votes
0answers
30 views

How accurately does DirectX9 support DirectX7? [closed]

So far I have only run into one issue when porting this ancient DirectX7 code to DirectX9, but they seem to like each other quite nicely regardless. ...
0
votes
0answers
23 views

what exactly is the science behind mappers and the ppu of the NES? [closed]

I'm a wizard when it comes to emulation of the 6502 processor ( i literally read the entire hardware manual). But despite reading the NES wikia and and a bit of mappers there just doesn't seem to be a ...
2
votes
1answer
58 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
53 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 ...
-2
votes
0answers
119 views
+50

Drawing header and footer area in DirectX 9

I don't know how to draw something like this? I am using DirectX 9.0 currently. Code: ...
0
votes
2answers
31 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
51 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
74 views

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

Here is my code : ...
0
votes
0answers
90 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
39 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
68 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
31 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
68 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
37 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
75 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
44 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
60 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
22 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
101 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 ...
0
votes
1answer
76 views

Why would I add components in code?

Watching a Unreal Course, and the instructor is creating a default pawn c++ class. He is adding all the components with code, but this seems really inefficient to me. Why can't you add components in ...
0
votes
1answer
81 views

Are there any serious advantages for C++ compared to C? [closed]

so I know a little bit about C (read like a few university level textbooks on it, I am not an experienced programmer or anything) and now I would like to learn the ropes of the Unreal engine to fidle ...
1
vote
0answers
54 views

Setting an array in the HLSL shader

I have a array of six float4x4's in my shader. cbuffer pseudeocb { float4x4 Mypseudo[6]; }; I need to set these in my code. ...
0
votes
2answers
111 views

What's the maths behind checking line of sight

I understand in unity there is Phsyics.LineCast(Vector A, VectorB). What's the maths behind doing that, the only thing i can think of is going along the line at small intervals and seeing whether it ...
0
votes
1answer
28 views

Unsure where to right click to delete Unreal C++ class

Trying to delete a c++ class (this should not be this difficult!) and I have deleted the .h, .cpp, and binaries. Next everybody says "now, right click on your .uproject file and select Generate ...
0
votes
2answers
70 views

Should a game object class contain the information for how to render it?

If I have a class called Enemy: // Simplified version class Enemy { float xPosition_; float yPosition_; int hp_; }; Should this class also contain the ...
0
votes
0answers
21 views

Having problems with making a button class (checkIfClick) opengl

Just basing how sfml does it, I get the globalbound of the object and then check if the mouseposition is within the object. I ...
0
votes
1answer
35 views

Get black bars with framebuffer and glViewport

I have read several tutorials and answers regarding framebuffers and glViewport, but I can't seem to resolve this issue I have. I want to take a low resolution framebuffer (400x225) and place it in a ...
0
votes
0answers
32 views

Having trouble with 2d projection (Opengl)

I need to change the normalize coords from -1 to 1 to the width and height of my application. The reason why I want to change the normalize coords is because i think it would be a easier set position ...
1
vote
1answer
48 views

Multithreaded callback

I'm making a multiplayer game where players fight in vehicles, and I am doubting my server architecture. As it will be physics, network and AI intensive I would like to split these 3 topics into their ...
0
votes
0answers
61 views

Game loop implementation

I'm implementing simple Windows game. Here is my game loop, which I've written based on some tutorials found on the Web: ...
0
votes
1answer
49 views

How do I stop a moving object when colliding with a static wall or falling to a static ground

I'm writing my very first 2D game engine in C++ and SDL2. I wrote a very simplistic RigidBody class that computes the resultant force, applies forces and simulates ...
-1
votes
1answer
50 views

Translate code to DIRECTX directxmath

How can i translate the code to directxmath code? ...
0
votes
1answer
53 views

how to move a 2d shape in opengl 4.6 (glfw)

Class Button So from my understanding in order to move a 2d shape you need manipulate the vertices and then update???? If i do need to update the buffer how i would go by doing that? float xpos = 150 ...
0
votes
1answer
151 views

How to update indices for dynamic mesh in OpenGL?

So I am making a 3D batchrenderer for my engine, and the basic concept is that we make large enough VBO and IBO to accompany all the vertex data(positions, normals, uv etc.) and update the VBO using <...
1
vote
0answers
36 views

How do I render halfspace fog?

How do I render halfspace fog? From my interpretation, I have a transparent plane in the scene. Then I use a function that returns a fog color in my shader. Do I render the transparent plane by itself ...
0
votes
1answer
43 views

Memory Usage Issue with declared variables (when swapping between states)

So my problem is that When I make a Shader variable and I swap between mainmenustate and gamestate really fast I notice my memory usage increase alot but as soon I switch my Shader varaible into a ...
0
votes
0answers
45 views

I want the game over screen on this super mario bros C++ remake to trigger arduino/batch file

I found a someone who has listed the source code in C++ for their remake of Super Mario and I would like to know how I could edit the code for the "Game over screen" to trigger my Arduino or ...
0
votes
1answer
36 views

Multiplayer game with differently screen size

I am making a classic ping pong 2D multiplayer and its run on full screen, but i have a problem that the ball touch the limits of screen to one player and other no. Any idea how to solve this ?
0
votes
1answer
102 views

text rendering artifact when rendering in 3D opengl GLfW

Main.cpp ...
1
vote
1answer
121 views

String hashing design

I'm in the process of developing a game engine and I would like to refer to game objects and assets by an integer id rather than by their string name. This should avoid any string comparisons at ...
0
votes
2answers
94 views

Need help with gravity simulation in 2D game engine

I'm writing a 2D game engine using C++ and SDL2 and started implementing a rigidbody component similar to that of unity to my game objects. I have a method in the <...
0
votes
0answers
70 views

C++ Raycast using SFML

I know this isn't exactly C++ related, however, I was just wondering if anyone knew anything about texture mapping onto a raycaster. I'm currently trying to write my own and I'm struggling to map ...
0
votes
1answer
57 views

How to combine bilateral blur passes?

I'm changing to bilateral blur for my SSAO implementation, just wondering how people usually combine the two passes - do you just add them together, or average, or something else? I happen to be ...
0
votes
1answer
60 views

Difference between shader input element classification between D3D12 and Vulkan

I'm confused about the difference between the shader input element classifications in D3D12 and Vulkan. For example, in Vulkan I could have the following declarations: ...
0
votes
0answers
59 views

c++/openGL 3D Bouncing Cube

I'm trying to write a little program with a bouncing cube but I can't find the right values for it. I have these lines: ...

1
2 3 4 5
80