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

learn more… | top users | synonyms

0
votes
1answer
65 views

Game Controller that is constantly changing

I'm writing a game where the main character is a ghost, and therefor can possess just about everything. The problem is, I'm not sure how to efficiently & effectively handle the changing actions of ...
-7
votes
0answers
51 views

STL for games, yes or no? [duplicate]

Every programming language has its standard library of containers, algorithms, and other helpful stuff. With languages like C#, Java, and Python, it's practically inconceivable to use the language ...
3
votes
2answers
134 views

Algorithm for a smooth weather transitions in game weather system

I've been slowly learning c++ and building up a codebase intending to create a simple first person role playing game. I've coded a time management tool to track time elapsed in game, an inventory and ...
0
votes
1answer
67 views

Working but flawed bullet spread (vector math)

I'm trying to implement random bullet spread into my game, and I've managed something that works, but is consistently flawed. The spread doesn't vary depending on the distance the mouse is from the ...
0
votes
2answers
62 views

DirectX map/unmap

In my 2d game i want to use dynamic buffers to render sprites. My question is, when should i map unmap buffer? The 2 possibilities are: #1 //game logic map() fill buffer unmap() render() #2 ...
1
vote
0answers
45 views

When does data move from the system memory to the GPU memory? [closed]

I am starting off with a basic idea. My understanding is when a game loads, the assets are loaded into the system memory, images, sounds, maps etc. So say you have an open world game, AFAIK, the ...
0
votes
0answers
49 views

Simple Bullet Physics Collision Detection

I've been looking into bullet physics a lot here lately to handle my collision detection. I was using XNA collision but once I started to implement momentum into my physics simulation true and false ...
36
votes
1answer
6k views

Why are all OpenGL function calls prefixed with “q” in the Doom 3 source code?

Why is every OpenGL call prefixed with a "q" in the Doom 3 source code? Are they custom functions or a different library, and if so, why use that over OpenGL? Any Google search comes up with the Qt ...
0
votes
1answer
63 views

2d canvas representation in c++ code

I would like to create a basic 2d graphics program to do very simple editing of in game assets. My question, starting out how could I represent the canvas? Let's say I know i'll need a canvas ...
-1
votes
1answer
57 views

Leading Zero's in int returning weird number c++ [closed]

I'm doing UTs on a class of mine, and I tried the edge case of putting 05421 in the ctor instead of 5421. As far as I know, putting a leading zero in an integer results an octal number, but seeing as ...
0
votes
2answers
64 views

Is Global location using OpenGL bound by the shader?

I have recently started writing a game engine in C++ with OpenGL and using some tutorials online. So far from what I have seen, shaders are the way to manipulate an object's position in worldspace. Is ...
0
votes
0answers
19 views

Adapting qml-box2d to work with QGraphicsScene: transform origin is incorrect

I'm taking the convenient QObject wrappers from the Box2D QML Plugin and using them with a QGraphicsScene-based game. My motivation is to save time writing them myself, as I need to expose stuff to ...
0
votes
1answer
62 views

glDrawElements and Texture Coordinate

I just move on from Immediate Mode and try Vertex Array method using glDrawElements and I got the texture is mess. How to draw the texture correctly? This is a piece of my render code ...
2
votes
1answer
117 views

Creating a Collision Detection system [duplicate]

I'm currently working on 3D project (C++) and I have now come to writing the collision detection systems. Basically my question is regarding how to architect it. All the collisions are either ...
-2
votes
1answer
41 views

how to rotate a sphere around centre (x y z) [duplicate]

I have centre of sphere at x y z. now I want to rotate any point (a b c) on the sphere about centre. how can I do it in c++.
1
vote
0answers
83 views

OpenGL Texture Loading

I've been using OpenGL for a bit so I have a general idea of what I'm doing. Recently, I've been working on a framework to let me test stuff more easily. As part of the framework, I split up loading ...
1
vote
1answer
85 views

Game Object, components priority?

So, my first attempt to create a component based game object is this: class GameObject; class GameObjectComponent { public: virtual ~GameObjectComponent(); virtual void Update(GameObject* ...
0
votes
0answers
36 views

Awesomium Input + SD2

In my project I use Awesomium GUI and SDL2. I want to create simple button. In HTML document I write <html> <body> <button onclick="app.sayHello()">Say ...
1
vote
1answer
74 views

Game is unable to load assets

I programmed a game in c++. Now I want to pack the finished product. Game runs fine from within the compiler. But how can i link the assets(like images, music etc) of the game to the exe ? When I run ...
1
vote
1answer
89 views

How to import Cocos2d-x in codeblocks ide?

Is it possible to import cocos2d-x in codeblocks just as in xcode ?? How can I do that ? I use ubuntu. It is not possible to use xcode in ubuntu. Cocos2dx is in c++. How can I use codeblocks for game ...
0
votes
2answers
170 views

Good design for skills (heal,dmg etc)

I'm trying to create a good designed "skill system" for my game, but curious if anybody knows a good design? Skills can Heal,Damage ofc, they can be single target,multiple(chain), AOE. Instant ...
0
votes
1answer
41 views

useful way for coloring 3ds object in opengl

I have been working in making plane in blender and it has many materials over than 90 , and now I need it in an opengl project with c++ , but as you know if I but the 3ds file the plane color is ...
1
vote
0answers
36 views

Find camera coordinate of vanishing point

Given a vector and a camera (position, angle, up vector, field of view, etc), how would I find the vanishing point of the vector in camera space?
1
vote
0answers
31 views

Passing an SDL KeyboardState(Uint8*) to Lua

I'm working on my first big project and I've decided to integrate Lua with my C++ framework. Everything's worked out so far, but the only way I've managed to pass the SDL_GetKeyboardState(NULL) array ...
0
votes
1answer
27 views

How to set a struct as a Direct3D9 vertex shader constant?

I have a vs_2_0 shader like this: struct ConstantBuffer { float4 diffuse; float4 specular }; shared uniform ConstantBuffer g_cb : app_constantBuffer; void PS(out float4 Color: COLOR0) { ...
1
vote
1answer
57 views

Will Frame Independant Movement break collision

Using my game loop to give my game movement which is independant from the framerate, has been working fine for me but, I've started to consider my games running on machines which cannot keep up with ...
0
votes
0answers
25 views

SDL_ShowCursor not showing in Mac

I have the following code to create a software cursor in SDL: void Breakout::createAndActivateCursor() { int i, row, col; int hot_x, hot_y; Uint8 data[4*32]; Uint8 mask[4*32]; static const char ...
1
vote
1answer
57 views

Registering a C++ callback with Lua API without additional libraries

Basically, I'm trying to register a callback into a Lua state like this: class MyClass { public: int myLuaFunction(lua_State* L) { //do something } }; I ...
-3
votes
1answer
152 views

Performance of programming languages and frameworks [closed]

I want to program an online 2D MMORPG with graphics like in this game. Since I develop in javascript and python mainly I chose python for my first games and the game library pygame which is pretty ...
0
votes
2answers
240 views

Map Generation Algorithm [BOMBERMAN]

I'm looking for some wise tips concerning a specific game development : Bomberman-like. I am currently implementing a "random map" generation for the game, but I feel like I'm not doing in the best ...
-1
votes
1answer
35 views

Direct3d 9 z-buffer fails drastically [closed]

I have just completed my custom mesh class and my engine is very basic right now, but now I am facing this strange issue. I have posted the pictures bellow, it seems like z-buffer is not working ...
0
votes
5answers
167 views

How to properly pass sprites to a std::vector without destroying the sprite's texture in SFML?

From the official SFML tutorials, The White Box Problem:- "When you set the texture of a sprite, all it does internally is store a pointer to the texture instance. Therefore, if the texture is ...
0
votes
1answer
78 views

loading a texture in Opengl

I am working on a graphics project I want to make a city using opengl with c++ anyway in the last few days I have been trying to load a texture but it didn't work with me in any way I have tried many ...
1
vote
0answers
157 views

How to architect systems is Enity Component System, in C++ [closed]

When creating an ECS in C++, what are good, simple approaches to architecting the systems. Should each system be a static function of a dedicated class (is this semantically different than just ...
1
vote
2answers
39 views

glutPostRedisplay() is not redrawing after updating model view matrix

I am trying to change the rotation of my object with keyboards, when I move the object in the direction of x, y or z it is okay, it is responding correctly. But when I try to change rotation, it does ...
9
votes
1answer
517 views

Is it possible to use the Unreal Engine as a big C++ library, without using the editor?

I want to write a game entirely in C++, but I would like to profit from the possibilities offered by the Unreal Engine, especially in terms of graphics and physics. Nevertheless, I strongly dislike ...
1
vote
1answer
212 views

How do I Rigidbody.AddForce(Vector3) in Unreal Engine?

I am coming from the Unity Engine, and trying to get my feet wet with Unreal Engine 4. I want to add a one-time force to an object. To accomplish this in Unity 5, I would use: void Start(){ ...
1
vote
0answers
36 views

SDL_Mixer - Mix_LoadWav_RW returns NULL (Unrecognized sound file type)

I am loading sounds from resource file (Doom2.wad from game Doom 2: Hell on Earth), converting them into WAVE and then trying to play them using SDL_Mixer. If I save the converted sound into a .wav ...
1
vote
1answer
89 views

Bullet Physics - Collision not working when moving btBvhTriangleMeshShape

I have a robot (btTriangleMeshShape for each component) and a chain of boxes used as a cable, which is anchored on two components of the robot. I want to rotate a robot component and when this ...
3
votes
1answer
108 views

Optimizing the “visibility cone” calculations for a 2d game

I'm creating a simple 2D game and got a little bit stuck with this algorithm. What I wanted to achieve - and achieved - is to draw a visibility cone influenced by walls and other obstacles on the map. ...
0
votes
1answer
54 views

Calculating density of an object

I'm using Box2D for physics in my game, and one of the things it needs to know when creating a shape for a physics body is the shape's density. I had no idea what value I should specify, so I went to ...
2
votes
1answer
243 views

Communication in a simple GUI (C++ / SDL2)

I've spent a few months now working on a fairly simply 2D game engine with SDL and C++. I'm now trying to develop a simple but well-featured GUI suitable for most games. Right now I'm really ...
0
votes
1answer
90 views

How to Load a Level for use with the Bullet Physics Library

I am trying to use a level in .obj format loaded with Assimp to generate a btBvhTriangleMeshShape to use with the Bullet physics library. I can successfully load btConvexHullShapes as well ...
0
votes
0answers
45 views

OpenGL - Cubemap “Rotating” Proportional To Camera Movement

I'm doing a simple planet rendering project and am running into an issue with accessing cubemap textures correctly. The planet terrain is generated using the diamond square algorithm done 6 times and ...
1
vote
1answer
46 views

Modern OpenGL Texture Displaying Incorrectly [closed]

I've been working with this code and have simplified it to the most basic form possible, and even then I cannot get a texture to display properly at all. Here is the code: ...
1
vote
1answer
83 views

Improving performance for flocking behavior?

I have a game that I am trying to make. It is a twin-stick shooter that I want to design to have a LOT (Up to 500) of enemies on the screen. The game's base design comes from that of Geometry Wars, ...
2
votes
3answers
126 views

How does Unity call “update()” in the scripts?

I understand that you can expose your C++ code to a scripting language such as ChaiScript. From this you can call code that you've made in C++. In Unity, however, they have functions in the script, ...
0
votes
1answer
111 views

Handling input with callback functions

I'm not sure if I understand callback functions completely - they are functions that another function calls? This seems like a powerful tool, especially w/r/t handling input. I've written up this ...
0
votes
1answer
168 views

How can I store additional attributes on DCEL edges?

I am currently working on a city generator, and I've ran into some issues with data storage while working on the roads. I currently use a doubly-connected edge list (DCEL for short), to store the road ...
1
vote
1answer
85 views

3D GUI Shader Problem

So I want to create one of these in my directX11 project. The little axis there that shows you the direction. I have a nice 3d shader for my world geometry that I tweaked from Frank D. Luna (He ...