Questions tagged [c++]

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

Filter by
Sorted by
Tagged with
-2
votes
2answers
95 views

Loading the map from an image file in C++

For my platformer tile-based game I want to be able to load the game map from an image file. Consider the following 25x15 px .png (enlarged) representing some level: Assume that each specified ...
1
vote
1answer
85 views

SIMD and Inverse Tangent

I'm calculating spherical UV coordinates in a loop, trying to get GCC to vectorize the code. Here's a compile-able example of what it looks like. ...
1
vote
0answers
35 views

Bullet Physics stops detecting collision after a few steps

Let me start off by saying that the usage of Bullet here is slightly unconventional. I'm writing a server emulator for a game, and the server is only keeping track of the triggers, players and enemies....
0
votes
0answers
21 views

How to static link modules using static variable constructor?

I'm trying to make my game engine supports both static and shared linked modules. Basically I have a CREATE_MODULE macro that have 2 implementations. This is based on Unreal's method. ...
0
votes
1answer
133 views

Unreal C++ Detecting new Key Down during current Key Hold

I am currently working on a combat system and I wanted to be able to have key combos to execute combat moves and such, and I am detecting key input type as well for example, if the key is tapped, or ...
0
votes
0answers
6 views

Explicitly Loading a Ogre3D DLL wrapper with OgreMainStatic.lib linked crashes when loading a mesh with CreateEntity

I have a Ogre3D 1.7.x DLL wrapper project that explicitly loads Ogre functions and works ok using the OgreMain.dll + D3D9 Renderer plugin.dll which loads a mesh without any problems. This is my setup: ...
1
vote
0answers
72 views

Trying to Rotate terrain

I'm new to OpenGL and don't really know how to rotate a terrain. For my graphics class, I have a project I need to do that is making a tire using OpenGL and work that we done in class (my framework is ...
0
votes
0answers
53 views

Need help with a 'Read access violation' exception in an SFML/C++ project:

I'm recently learning to make a 2d game in SFML using a tutorial series on youtube by Suraj Sharma(Video 57): https://www.youtube.com/watch?v=kwd_AVCkvXE&list=PL6xSOsbVA1ebkU66okpi-KViAO8_9DJKg&...
1
vote
1answer
75 views

C++ SDL2:2D tilemap with every tile has its own behavior

I am working on 2D tile based game. I want to render the tilemap from a file but every tile has its own behavior for example: magmablock : poorlava(); slimeblock : knockback(); I have this ...
0
votes
1answer
37 views

Recalculating normals on a tesselated cubed sphere with heightmap applied

I'm learning about the graphics pipeline using C++, HLSL and DirectX 11 for my course. I'm currently tesselating a cubed sphere with an applied height map. My issue is figuring out how to recalculate ...
0
votes
1answer
64 views

Four (4) color channel png has black “background”

I am experimenting with C++ code to load a png file, using libpng. When I get to the color data in the file, I load it into a std::vector. I have found that the ...
0
votes
1answer
73 views

How to use TEnumAsByte Unreal 4.22

The problem I am attempting to use a TEnumAsByte in one of my class headers: I get compilation errors: Code sample I have included everything relevant to the ...
0
votes
1answer
92 views

How to pass renderer through classes?

I am making a game with SDL and C++. I am trying to render simple image to the screen but I can't. I am not getting any error but I see only black screen. I think because the renderer in ...
0
votes
2answers
140 views

Parsing “pick up” action in a text-based RPG

I’m coding a text-based RPG and I have my controls working: I have a string checking what you write in against an array of if statements. It can get it right with ...
0
votes
0answers
66 views

Can't load textures to the game

I am making a game with SDL and C++. I am trying to render simple image to the screen but I can't. I don't know why, I am not getting any ERROR but I see only black screen. Here is my code: game.h <...
0
votes
1answer
48 views

OpenGL object load in reverse

I am trying to load a model and it is loading it in reverse. When I am trying to rotate it 180 degrees it changes the lightning as well. I am not sure what I need to do to change the position that eh ...
0
votes
1answer
35 views

UE4.23 - Cast of child of GameUserSettings fails

I've derived GameUserSettings to add a bunch of custom properties to it. I tried making accessible in blueprint by creating a static method that returns the current GameUserSettings cast to my Child ...
0
votes
0answers
12 views

How to use mip mapping with SpriteBatch in DirectXTK

For a C++ .dll project of ours, I am able to render different sprites from a spritesheet into a texture using DirectXTKs SpriteBatch() method. But then, we came to notice that the sprites start to ...
0
votes
2answers
84 views

C++ inheriting functions problem

So I am creating a game with C++ and SDL. I have a "gameobject" header file and no cpp (I do not need it) the game object has 2 functions void render() & ...
0
votes
0answers
33 views

Grappling hook force resolution

Our team is creating a 3rd person adventure platformer in Unreal 4.22. One of the mechanics is a grappling hook. Think less-so a 'pull-to-point' grappling hook (Widowmaker, Just cause etc.). However ...
0
votes
1answer
96 views

Identify an object currently selected in the game

I am making a 2D isometric game that uses the mouse. When I left click on an object, this object should be selected, but how do I determine what object that's currently selected and show a halo around ...
0
votes
1answer
56 views

Only one triangle drawn

I am trying to render a quad with gl render mode GL_TRIANGLES with using element array buffer. Here is some code to explain process. Only the first 3 elements of indices array are drawn as expected. ...
1
vote
2answers
57 views

Parts of 3D model disappear during animation

I'm trying to properly play an animation done in Blender 2.8 inside my OpenGL application. When the animation is running, it happens that at some particular frames, some parts of the 3D model "...
0
votes
1answer
53 views

Add impulse and torque to a cube

I would like to spawn a cube if I press space and apply a short impulse of force and torque to make the cube rotate. I have some calculations for the impulse but I think they are wrong since the cube ...
0
votes
1answer
85 views

How is tile offsetting accomplished in 2d side scrollers?

The idea is to work with tiles that together make up a larger image, or world so to speak. but im confused as to what the methods used are to offset the tiles, and whether is a good idea to draw ...
0
votes
0answers
31 views

Need help with a Lnk2019 error in an SFML/C++ project

I'm currently making a 2D video game using the SFML library on Visual Studio 2019 community with the help of a Youtube tutorial series by Suraj Sharma: https://www.youtube.com/watch?v=IdKZpv6xqdw&...
0
votes
0answers
27 views

Need help with sluggish sprite movement in an SFML-C++ project:

I've recently bought an SFML course on Udemy.The course is teaching me to make a game where you are chopping a tree while avoiding falling branches. Right now i'm learning to animate moving clouds ...
0
votes
0answers
23 views

D* lite optimized: what is wrong in my implementation of Search() function?

I'm trying to implement the D*-Lite pathfinding algorithm, as described in the 2002 article by Koenig and Likhachev for grid-based navgraph. But I stuck with problem. My ComputeShortestPath (in my ...
0
votes
1answer
137 views

Projection Matrix Causes Clip Cuttoff Problem

I'm trying to setup my renderer and I'm configuring the matrices. I currently have a View Matrix and a Projection Matrix which I then multiply and send to the shader(there's no need for model matrix ...
0
votes
1answer
215 views

Need help with an 'Exception thrown:write access violation:this was nullptr' in a c++ - SFML project

I'm currently learning how to program a 2d game with SFML using a tutorial series by Suraj Sharma.This's his channel: https://www.youtube.com/channel/UC2i39AOpDSlO1Mrn1jQ8Xkg The tutorial series: ...
0
votes
0answers
22 views

Implement a scale factor to apply to UCharacterMovementComponent::JumpZVelocity in Unreal Engine 4

I'm creating a my own movement component inherited by UCharacterMovementComponent. I should implement a scale factor (I called it JumpZVelocityScale) to apply the JumpZVelocity (and I don't want ...
1
vote
1answer
22 views

How do the PhysWalking and similar functions actually handle input?

As the title may suggest, I'm developing a CustomMovementComponent and I'm on the stage where I am developing my own PhysCustom ...
1
vote
1answer
81 views

In a MovementComponent, where should I initialize member variables?

I have a MovementComponent derived from CharacterMovementComponent MovementComponent, ...
0
votes
0answers
28 views

How to use a derivative of CharacterMovementComponent

I'm developing a 3rd person platformer. My Character class (the default third person template class): PlatformerCharacter : ACharacter My MovementComp class: <...
0
votes
0answers
37 views

Retrieving shader byte code using D3D11

I have a shader as an 'ID3D11VertexShader' (or generally any 'ID3D11*Shader') instance. For my application I would like to read the shader byte code that is associated with this instance. The goal is ...
-2
votes
1answer
44 views

Models /textures/music corrupted!

I'm making a 3d rpg game. Everything seems to work on other computer. But when I open my game in my computer, the polygons gets crazy everywhere filled with random polygons. Textures will get rainbow ...
0
votes
0answers
46 views

How does CharacterMovementComponent::PerformMovement work?

I'm developing an adventure platformer. As such, the manipulation etc. of the CharacterMovementComponent is going to be crucial to the game. I have seen the more ...
0
votes
1answer
53 views

How can I scale my window in SDL 1.2?

I'm trying to scale my window, for example from 440*420 to 320*240. How can I easily do this?
0
votes
1answer
178 views

Need help with a C26495 warning and E0513 error in a C++ SFML class

I'm currently learning to program a game with the SFML library.I dugged up a bunch of SFML tutorials on Youtube and found a really good one by 'Suraj Sharma': https://www.youtube.com/channel/...
0
votes
1answer
50 views

Unreal MouseWheelAxis negative axis does not work

Would like to avoid using separate action mappings i.e. MouseWheelUp and MouseWheelDown for a system I'm developing. I noticed <...
4
votes
1answer
231 views

How can I create a templated function to add components to their necessary containers using an ECS system?

I had implemented a basic ECS system and was then informed that it should be changed as each system should not directly store their required components. I have created a ...
0
votes
0answers
25 views

Numerical errors in Player collision offset causing player to fall through the ground the next frame, how to avoid?

I'm trying to implement player physics with arbitrary objects, in this case, a bunch of cubes. I wanted to add a "floor" so in my cube collision function, I added the following following lines: <...
0
votes
0answers
51 views

UE4. Reload CDO default values?

My aim is make difficulty system that will edit Class Default Object values for any specified class. It's fastest way to make any properties that will dependent to difficulty by game designer (Class. ...
1
vote
1answer
51 views

Passing by pointer-reference in blueprints with C++ definitions

MyFunction( Class *& foo ) Inside a derivative BP of the above C++ class: foo shows up as an output rather than an input. Why?
1
vote
1answer
55 views

How do I access a struct that resides within a struct in blueprints?

I have a struct: "FOuterStruct" This is defined in code such that it contains another struct type: ...
2
votes
0answers
112 views

Using shared memory instead of marshalling for C++ native plugins in Unity?

So I'm a C++ developer who has been playing with C# for a week or two in order to get acquainted with Unity, and I'm curious about the marshalling process used to transfer data for use in C++ native ...
0
votes
0answers
80 views

Best practices for interaction between game objects

I’m in the process of developing a game. My problem is this.. I’m going to implement the observer pattern to have my game objects “subscribe” to events that happen. For instance one character shoots ...
0
votes
1answer
48 views

Why can't a blueprints project edit BPs derived from c++ classes?

I am working in a relatively small team. Now, because our IT guy is incredibly unhelpful, we don't yet have VS on all the machines (as I know this would solve the error). However, I'm still curious ...
0
votes
1answer
34 views

Directx11 batching verticies to draw later

I have several draw functions in my renderer to draw primitives e.g.: Drawing a Quad: ...
0
votes
0answers
87 views

How to support JS/Python scripting a C++ game engine?

I'm currently writing an Entity/Component/System architecture game engine in C++, and I have the beginnings of a lua scripting system in place, which seems to be quite popular, but I feel Javascript ...