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

learn more… | top users | synonyms

11
votes
2answers
1k views

Removing delay at start of a key press

I'm making a simple game, and one of the problems I encountered is the annoying delay when pressing a key continuously. So basically, when I press (for a very long time) for example Up, my object ...
0
votes
1answer
46 views

Load 2 triangles in a simple DX11 example

I'm following this tutorial, where they show how to setup a simple dx11 demo with a green triangle in the middle. I'd like to be able to modify it so that it shows 2 triangles instead, i modified the ...
3
votes
0answers
89 views

Tick frame: update order problems

Sorry, it's a bit long story but I hope you can help me. First of all: I have an entity class called SceneObject. The SceneObject has components (eg. RenderableMesh, Camera) and transformation data (...
1
vote
1answer
90 views

C++ Data structure pattern preferability?

So im looking at ways of handling large amounts of data in situations such as an entity manager or particle system. So i have concluded to use an object pool, and there are two things that I could do ...
0
votes
1answer
73 views

QuadTree nice design for nodes

I'm using c++ and have some problems with the QuadTree design. I have some components which are not related to the QuadTree directly. These components are eg. RenderableMesh, PointLight, etc. Some of ...
1
vote
1answer
82 views

Shooting Projectiles

I am using cocos2D-x and am trying to achieve the effect of enemies going past and shooting projectiles at the player who is moving around the screen. I am using the code below, which is based on this ...
3
votes
1answer
130 views

When should i use GL_TRUE or GL_FALSE values?

When using GLboolean, should i just use true and false or should i use GL_TRUE and GL_FALSE, when should i prefer using GL_TRUE and GL_FALSE? or maybe i shouldn't care at all (Because both works)? ...
1
vote
0answers
158 views

OpenGL ArcBall Camera

I'm currently working on a OpenGl Project and I have alot of difficulty understanding how arcball camera work. From what I have read online, all I have to do is to rotate a camera around a target and ...
0
votes
1answer
48 views

How to rotate a 2d line?

Its a very simple question. How can i rotate a line by one of its endpoints by the angle rad? Heres my current code ( I couldnt find a different solution ) void displayPlayer() { float rad; ...
0
votes
1answer
47 views

Draw a square given 2 corners

I am at the moment trying to come up with a simple method to extract some data points, given two corners. A*************** **************** ***************B I tried to illustrate my situation above....
1
vote
0answers
47 views

Renderering problem with flat terrain

i was testing out my game engine last night, but stumbled across this unexpected result. Here is a picture: As it appears, it is renderering 1 triangle and not renderering the other triangles. I ...
0
votes
0answers
36 views

sphere to sphere interpolation

I am at the moment trying to come up with an scheme that interpolats between a current state and a desired state. Each state consist of an 3d coordinate and a rotation matrix, orienting an camera ...
2
votes
1answer
149 views

How i can make better jump to my game? - C++ SFML

So, I ask question about my 2D game, actually it is not game, but it is something like poor game. Well i made moving system and now is time to make jump. I made some kind of gravity with tutorial but ...
3
votes
0answers
59 views

“UObject” has no member “BeginPlay”

so I loaded up UE4 to work on a new project. I created 2 C++ classes, one for a bullet, one for a canon. Upon loading into Visual Studio 2015 I immediately get the error "UObject" has no member "...
0
votes
0answers
86 views

Problem with a TinyOBJLoader Renderer

I was working on implementing a renderer for SYOYO's tiny obj loader and when it came to testing time, it failed to render. Here is an image of the result: I believe that i have made the error with ...
0
votes
0answers
19 views

cocos2d c++ Collision between edge physics bodies

I'm working on a game with cocos2d, need to detect collision between two PhysicsEdgeBody. I've created an EventListener for contact and added it to the layer i'm working on, PhysicsContact and ...
3
votes
2answers
137 views

How do i implement a hit box system in a fighting game?

In a fighting game a move that you execute is basically just a series of hit boxes that are enabled and disabled at certain times. I want to know how do you create this hit box system. I have no idea ...
0
votes
1answer
34 views

Cocos2d: Tweening primitive data-types

I asked in SO, but no responses so I'm posting here since it's probably more relevant here. EDIT: SO question closed. I'm trying to tween primitive data-types the way Action tweens position to ...
0
votes
1answer
36 views

Moving at constant speed and angle [duplicate]

The picture illustrates I cannot figure out the math on this. The "arrows" should move at the same speed in both examples.
1
vote
0answers
22 views

trouble getting correct transforms for multiple meshes from assimp importer

I have had excellent success in extracting almost everything i need from a collada file that i imported with assimp, however I am struggling to get the correct transforms for each mesh in the file. ...
2
votes
0answers
38 views

Moving Draw functions out of GameObjects

This is basically the issue as in Tactics for moving the render logic out of the GameObject class with the topic already discussed here and here However I'm not really satisfied with the given answers....
0
votes
0answers
12 views

Update constraint pivot position in world space in Bullet Physics

The task is: we have N rigid bodies connected with each other by point-to-point constraint. In every frame we have new position of point where first rigid should be attached in world space. How to ...
1
vote
0answers
46 views

rendering a terrain

I'm trying to render a terrain using directx 11 and applying a heightmap to it. I load the heightmap then I copy it to a integer vector, then for each vertex position I assign the Y position of that ...
0
votes
0answers
33 views

Box2D + SDL - Weird body positions

I'm having a problem where either my sprite, or my body position is off. Here's a picture so you can see exactly what's going on : (The box has stopped on the picture, probably because it's colliding ...
0
votes
1answer
33 views

Having trouble with EOF in Xcode [closed]

I'm getting an error that says "control may reach end of function" and I have gone through my code several times now and am not spotting the error. It may be something simple too. // loop ...
0
votes
2answers
63 views

The best way to store and protect game data [duplicate]

I'm writing a sandbox-type game and i'm looking for a good way to store game data. I tryed Lua and plain text files, but the have a big minus - player can edit them his self! So how do I protect data ...
0
votes
2answers
45 views

How to create a linear plateform between two points?

I have a set of 2D coordinates. Their positions are regular on the X axis, but unpredictable on the Y axis: I would like to create slim platform between each point in order tu use it as ground for ...
2
votes
1answer
47 views

Normals showing unexpected results

I am making a game in c++ with opengl and glm and was working on my terrain when this happend : as it appears it is renderering just the way i planned it, but my question was, how do i make it ...
2
votes
1answer
101 views

2D infinite grid data structure

I'm currently developing a game, and I'm in a process of experimenting with various data structures to support my game model and simulation. Here are some of the requirements: Grid structure where ...
0
votes
0answers
40 views

3d rotation of a cube using DirectX

I can't solve an apparently simple problem: i have a cube, similar to the one in the following picture I've tried to write a small demo where i can rotate the cube by dragging the mouse, but i can'...
0
votes
1answer
45 views

Terrain not rendering like it should be

i was following this tutorial here: https://www.youtube.com/watch?v=yNYwZMmgTJk, in which i was translating from Java to C++ to generate a terrain, and stumbled across this issue: As it appears, it ...
0
votes
2answers
112 views

Tetris implementing rotation

I am currently at the last stage of the Tetris Clone using SDL library, the only thing left is rotation. For each piece I have a separate class, and in order to move the pieces down I use a method: ...
3
votes
1answer
73 views

How to make expanding ring with constant thickness?

I need to generate this burst or (donut-shaped) pulse. I'm having a difficult time how to generate such shape. At first, I was thinking of scaling the image but that didnt work out because the line or ...
1
vote
1answer
69 views

Parsing .OBJ to fit the gldrawelements() call. c++/opengl

I'm struggling trying to get this to work like it should. Ive been able to make an obj loader that fits the glDrawArrays() call, with uv and facenormals, but when trying to modify it to fit ...
5
votes
0answers
105 views

Diamond-Square algorithm output is random and noisy

I have implemented a rough interpretation of the Diamond-Square algorithm in C++ to create some semi-realistic fractal terrain, but the output just seems like a random y value at each point rather ...
1
vote
0answers
38 views

Swept AABB vs AABB Calculation Error

I'm having issues running simple AABB vs AABB collision detection. I'm able to successfully detect collisions without checking with velocity. But for some reason my code keeps prematurely firing ...
0
votes
1answer
96 views

Bullet: No Bouncing off the walls

I'm using Bullet Physics for Collision Detection in a first person game. The collision basically work fine, I cannot walk through objects. But if I walk against the wall and release the key I get ...
0
votes
0answers
33 views

Defining camera/view space

Im working on expanding my camera class, but having trouble defining camera/view space in the manner of this diagram: What Im trying to achieve is to define the camera as a true object much like a ...
0
votes
0answers
61 views

Weird Collisions in ODE

I'm trying to get a basic OBB/OBB Collision System working. For this I use ODE. My problem is: Whenever I use the dSpaceCollide and pass in my Space and my Callback, my Callback shows me, that a ...
3
votes
0answers
28 views

RWTexture3D in Compute Shader on Intel HD 4000

I'm having some weird issues running a Compute Shader with DirectX 11 on an Intel HD 4000 GPU. The goal is to write different shapes into a DXGI_FORMAT_R32_FLOAT 3D Texture with a size of ...
1
vote
1answer
27 views

Convert Triangle/OBB Test to OBB/OBB Test

I'm using the collision library OZCollide (http://www.tsarevitch.org/ozcollide/) and I want to do OBB vs. OBB collision tests. The problem is, that this function doesn't seem to exist (see my other ...
1
vote
1answer
123 views

Frustum culling takes ages c++

I have two ways of doing frustum culling taken from different web sources. First one takes 200ms to check 10k AABBs, second around 50ms for the same box count. I read some forum answers, people say 0....
0
votes
1answer
69 views

Is window creation decoupled from game engine?

I'm new to game development, and I was wondering about a architecture question. The window creation code in C++ is given by doing the following: Fill out a WNDCLASS struct Register the window class ...
0
votes
1answer
39 views

Why when releasing a DirectX Texture it fail

I have an instance where a class creates a DX9 texture via UINT usage = D3DUSAGE_RENDERTARGET; HRESULT hr = D3DXCreateTexture (m_D3DDevice, 200, ...
0
votes
0answers
13 views

Config SFML in QTCreator with file.pro

I know that are a method with cmake , but i wouldlike config my project in Qtcreator usinig qmake and my doubt is what my file .pro must have for work it ?. I will run in windows , maybe later linux . ...
1
vote
1answer
74 views

How do I correctly shift arrays on a Tetris line clear?

I'm writing a Tetris clone in C++ and I am at the last stage, I need to delete a row when it is full. Once a piece falls it is stored in a boolean array grid[20][10]. For example I check which row is ...
0
votes
0answers
28 views

OBB Collision Intersection Problem

I'm trying to create OBB's around objects and then collide them using DirectX 11 and C++. It all works fine until I rotate one (or more) of the boxes and then the collision detection returns true too ...
59
votes
10answers
15k views

Is UDP still better than TCP for data-heavy realtime games?

I know that UDP is usually recommended for real-time multiplayer games with high data usage. Most articles are serval years old, and since ~80% of all data transmitted on the internet is TCP, a lot ...
2
votes
4answers
602 views

Why is my A* Pathfinding incredibly slow?

I'm trying to use A* to make my enemies move about, but it takes up to 20 seconds to get a path to walk. My grid is only 64*64. This is my code: #include "AStar.h" #include "Node.h" #include "...
0
votes
1answer
102 views

How to Load and Apply a Cube Map with DDS Texture Loader?

So I have been spending a lot of time recently implementing a working skybox/skysphere, and have almost completed it. The last thing that I need to do is to load my given texture, a skybox texture ...