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
2answers
45 views

In Unreal Engine 4, how do I get the component's “game object” via C++?

I have an ACharacter instance with a weapons component that inherits from UActorComponentattached to it. I'm currently writing ...
0
votes
1answer
166 views

Why separate data from logic?

I don't understand the purpose of separate SystemClass for functions. My composition looks like this: ...
0
votes
2answers
94 views

How to load assets into the game engine editor fast?

I am making a game engine with C++ and OpenGL. Currently I'm stuck making the asset explorer. I would like to be able to import assets into an engine project and then when I open the project just use ...
0
votes
1answer
60 views

Problem with IsKeyPressed 2 times [closed]

i tried to make thing to show menu up by doing VK_MULTIPLY and close it by doing VK_MULTIPLY, but this does not work.. Anyone can help :) ? ...
1
vote
1answer
227 views

Do I need a rendering system in my engine?

I am planning to create a cRPG game engine that would allow to easily create games like Baldur's Gate. I already tried to do that once, but my knowledge was vastly insufficient at the time. I settled ...
0
votes
0answers
52 views

Box2D with SDL2 not working properly (Collision without rotation and problems with MKS)

I already have some expirience using SDL2 so I thought I will add a Physic Engine to my game - I chose Box2D. I managed to setup everything and to build a small program using SDL2 and Box2D. But now ...
-2
votes
1answer
71 views

Can't initialize array in C++ using const int value? [closed]

I am making a text based game. I want to make a 2d array of 'Rooms' in my 'GameWorld' class. I'm used to using C#, but am using C++ in order to learn it. The code I wrote I expected to work, but it ...
2
votes
1answer
147 views

How to preserve Arcball rotation in c++ OpenGL?

Firts of all want to say that I've already searched for other people's answers here as same as Google and didn't found anything about it there. Also tried some others arcball implementations but none ...
0
votes
0answers
75 views

What is the most efficient way of rendering a large number of SDL2 objects?

I'm trying to find the most efficient way of rendering a large number of SDL2 objects to the screen. Each of my objects have their own sprite sheets which are stored as SDL_Texture*. Currently my ...
0
votes
1answer
83 views

Why do i get this error in VS2017 but game compiles and works as expected?

I have this error, yet the game works and that variable ActorThatOpens get assigned correctly. In my header the includes are: ...
0
votes
1answer
91 views

Confuddled with learning C++ / UE4 . Why can't I access this AActors properties?

Hello all I decided to punish myself further by now adding C++ to my list of things i know a little bit about. Some of it looks familiar having dealt with C# quite a bit, but i am getting caught out ...
21
votes
5answers
4k views

Improving an O(N^2) function (all entities iterating over all other entities)

A little bit of background, I'm coding an evolution game with a friend in C++, using ENTT for the entity system. Creatures walk around in a 2D map, eat greens or other creatures, reproduce and their ...
0
votes
0answers
58 views

Using a PBO glTexSubImage2D with GL_PIXEL_UNPACK_BUFFER gives GL_INVALID_OPERATION

I plan to develop a tool for realtime video manipulation using C++, QT 4.7.4 and OpenGL and i'm on visual studio 2008. I check many web site but my code doesn't work since I try with PBO. At the ...
0
votes
0answers
44 views

How can I spawn objects in a volume without intersection?

I am generating a 3D scene that involves spawning lots of 3D objects in a finite volume. I need to avoid intersection of objects.
0
votes
1answer
50 views

Does SDL_SetThreadPriority work with std::thread

I'm trying to set the priority of my threads so that my UI thread can be given priority over background calculations. I noticed that SDL has a SDL_SetThreadPriority ...
1
vote
1answer
76 views

Opengl Airplane Camera

I am making a game in opengl and am trying to get a camera to follow an airplane. How can I get the camera to match the roll, pitch, and yaw of the plane? I am using glm as my math library. Thanks!
1
vote
1answer
107 views

How to set up an architecture and a strategy allowing the persistence of the data of a MUD in a relational database?

How to set up an architecture and a strategy allowing the persistence of the data of a MUD in a relational database? Type of game: My question relates to the design of a Multi User Dungeon (MUD). ...
1
vote
1answer
39 views

Find angle (slope) of collision plane?

I have implemented a collision and response system based on the famous "Improved Collision detection and Response" paper. However I'm having an issue with objects sliding backwards on slopes. I ...
2
votes
2answers
260 views

How game engines generate single executable games?

I was taking a look at Cryengine's and Unreal's code and when built both engines generates lots of dlls. Inside Cryengine's System code I could see that it calls LoadLibrary to load the dlls and ...
1
vote
3answers
260 views

Is it possible to avoid global data in a Multi User Dungeon (MUD)?

I am currently designing a Multi User Dungeon (MUD). For those who do not know what it is, they are the ancestors of MMORPGs. There is no graphics, everything is played in a console by typing commands....
6
votes
2answers
721 views

Architecture of networked game engine

So after working on my game engine for 2 years, I've decided to step into the networking environment. I just don't know if it's a good idea to rewrite the engine, or how much work it will take (but ...
-4
votes
1answer
82 views

How can I execute a C# script even if my game is closed?

I've made a game with Unity and I want to execute a C# script that runs even the game was closed. I searched a lot but didn't find anything.
0
votes
1answer
76 views

Bullet Physics DebugDraw Unexpected Results

I'm integrating Bullet Physics into my project for collision detection and have just gotten some debug draw functionality to work. However, the results are not what I'm expecting. I have tried to draw ...
0
votes
2answers
122 views

Game movement in 2D SFML game

I am making simple 2D game, imagine it as 2D Minecraft where you can dig blocks and build other things. Currently I am struggling with movement. I have none experience in game development, but I am ...
3
votes
1answer
98 views

Shader is distorting a Texture of a sprite it's working on

I've been testing out fragment shaders in SFML, trying to learn how to write and use them and I've run into a recurring problem. Every shader distorts the texture. Top left is the distorted test ...
1
vote
1answer
63 views

rotation matrix problems - opengl and own types

In an effort to learn things deeper I'm writing my own mathematics for the first time instead of using libraries. As far as I can tell my matrix multiplication is correct, and translation and scaling ...
4
votes
1answer
176 views

Fixed Timestep with Interpolation | Blurry & Choppy

I've been implementing a game loop with a fixed timestep which uses interpolation as described in the (legendary as I have come to find out as it is referenced in almost every post I have read trying ...
0
votes
1answer
63 views

Apply 2D Texture on all faces of a 3D Cube

I am trying to render a 3D cube, and apply a single texture to all the faces of the cube. I feel like I am missing something critical here as it is applying to the front and back faces of the cube, ...
0
votes
2answers
23 views

Unity crossplatform native plugins

I need to create a c++ native plugin for my game. If I want to support macOS and Windows, do I need to write my plugin twice - one in XCode with a bundle project and another in VS for windows or is ...
0
votes
1answer
164 views

C++ Mouse picking for ray to plane intersection

I'm making a C++/OpenGL application (decidedly without GLM), and I'd like to understand how to create a ray from the camera eye to the mouse pointer, as well as detect an intersection point from the ...
0
votes
0answers
34 views

Yaw on a spherical world

I am trying to make a game where the player can walk along the surface of a spherical planet, and am not sure how to handle orientation. Pitch is relatively easy, as it is simply how much "above" or "...
1
vote
1answer
53 views

How to parse User-defined types from String?

I am trying to save data about various entities in each Level in my game in a JSON file and load it at Runtime(Like a Scene file in Unity). I can save simple stuff like floats and ints and parse them ...
0
votes
2answers
54 views

SDL2 Block collision with player Bug

I am currently working on a small 2D Games Engine with SDL2 for fun. The engine works in a way, that you can define a tileset, which accesses the engine and allows you to place tile by tile on the ...
0
votes
1answer
51 views

Why is integer value not updating as a text?

I have a space shooter game and I am trying to create a shield power for the player ship. My mechanic for shield is working. When I press the shield power button(P), the shield power decreases from ...
3
votes
1answer
343 views

Handling input in a custom ECS engine

I've been implementing an Entity Component System into my custom toy engine so I can learn more about it. Currently I have the following problem: I can't think of a way of implementing input as a ...
2
votes
1answer
209 views

RogueLike - Map and Entities - how to store it?

Started to write my own RL, and already fell into analysis (paralysis?) when implementing map class. My TILE class looks like: ...
-1
votes
1answer
911 views

Convert 3D direction vectors to yaw/pitch/roll angles

I have the code below that takes a set of yaw, pitch, and roll rotation angles (in degrees), and populates forward, right, and up basis vectors to express this rotated orientation as a Cartesian ...
0
votes
1answer
49 views

Set / Get UserPointer - What Do They Do?

I see a lot of talk about glfwGetWindowUserPointer() and glfwSetWindowUserPointer() but I can't for the life of me understand what these functions actually do. From http://discourse.glfw.org/t/what-...
9
votes
2answers
4k views

Storing voxels for a voxel Engine in C++

I am trying to write a little voxel engine because it's fun, but struggle to find the best way to store the actual voxels. I'm aware I will need chunks of some sort so I don't need to have the entire ...
0
votes
2answers
138 views

Problem Implementing SAT Collision in 3D, OBB vs OBB

I am trying to implement SAT collision detection between 2 OBBs, however, I am getting a lot of false positives, can anyone help me figure out what I am doing wrong, thank you in advance. This is my ...
0
votes
0answers
47 views

How can I handle mouse input and cursor in a WinAPI window?

Hello I'm studying game engine programming, but I got stuck with mouse input. As for now I have only WinAPI window, which has a message pump and processing. For the mouse I used RAWINPUT, but there ...
1
vote
1answer
91 views

Move and rotate one object to another C++ [3D]

I have two object, need attach 'TWO OBJECT' to 'ONE OBJECT'. I have vectors 'angle' 'origin' of ONE and TWO objects. I tried do "TWOOBJECT.origin += ONE.origin - ONE.oldorigin", this just attach ...
0
votes
0answers
33 views

Update movement actor with collisions in 2D game

I have the algorithm for moving an actor. The actor has: 4 states: Stay, Move, Jump, ...
0
votes
2answers
84 views

SFML - How to animate two Sprites with the same Clock?

I'm making a basic Street Fighter style game in SFML, and I use Clock and Time() from SFML to time the animations. Here's the ...
3
votes
1answer
94 views

How to load game resources correctly regardless of the working directory?

I am writing a resource manager for a hobby game project that reads textures/fonts etc. Up to now, I was giving the location of the files relative to the executable path, like: ...
0
votes
0answers
65 views

Keeping track of moving sprites in 2D grid

I'm working on a 2D tower defence game in C++. The game world consists of a grid of Cells, that are managed by a Map: ...
0
votes
1answer
156 views

God rays shader - Trouble with sun position

I have found a shader that I like here: https://www.shadertoy.com/view/4dyXWy The code for the fragment shader from the link above is: ...
1
vote
0answers
65 views

ImGui, how to get value that the mouse is pointing at in a VSliderFloat widget

I am using ImGui::VSliderFloat to create a vertical slider in the GUI of my application. To do this I just copied the imgui demo code (imgui_demo.cpp), which reads something like ...