Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [c++]

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

2
votes
2answers
2k views

Calculating vertex normals in OpenGL C++

Does anyone knows a simple solution for calculating vertex normals? I've been looking for this on the internet but i cant find a simple solution, for example, if I have some vertices like this: ...
0
votes
1answer
50 views

Can't figure out why my mouse picking code doesn't work

I am trying to create code to check for intersections between bounding spheres and the mouse. I get a mouse ray but it doesnt seem to point in the direction you think it should Attached is a ...
-1
votes
0answers
74 views

OpenGL: Depth Stencil buffer won't write underlying texture attached

I'm currently developing an emulator and I got some games using GL_DEPTH24_STENCIL8 (D24S8) as depth buffer. The depth buffer works fine and all but the underlying texture does not seem to be written. ...
0
votes
1answer
34 views

mouseButton.y and mouseButton.x is -858993460 for every event except MouseButtonPressed

Using SFML, every event type will produce a large negative value for x and y of -858993460. ...
0
votes
0answers
47 views

Array-Backed Entity Component System with Component Polymorphism

I'm tinkering with an array-backed ECS in C++ along the lines of EnTT. Components are stored in a struct-of-array fashion where each component type lives in its own homogeneous contiguous memory block....
0
votes
1answer
89 views

Game Engine Renderer Architecture

I'm currently building a game engine renderer but I got stuck when I had to separate engine and client code. I had been following OpenGL tutorials to learn about buffer creation, etc so all my code ...
0
votes
0answers
39 views

Is there any best book or site(instead of docs) for unreal engine core system in c++ source code level? [on hold]

Is there any best book or site (instead of docs ,wiki..) for unreal engine core system in c++ source code level? I want something like overall unreal engine code architecture (not for gameplay, just ...
0
votes
0answers
32 views

initialising constructor

I am using the SFML library to create a 2D grid. i use grid cords so I can place my players on the grid: I use struct to hold information of the nodes ...
0
votes
1answer
32 views

How to use This Keyword and using iterators to call class methods?

I've been over this for a long time, I can't seem to understand what is wrong, is the use of the this keyword right? I want to add the instance of the class that is being created to the vector '...
0
votes
1answer
31 views

Direct3D & Assimp Texture is inverted weirdly!

I'm working on a rendering engine but even on the first mesh is something wrong. I use assimp for mesh importing! In the Assimp Viewer it looks correct: And in my software it looks like this: Look ...
2
votes
1answer
130 views

What is the most efficient method to load 2D dynamic chunks?

Information/context I'm writing a 2D sandbox game - similar to Terraria. The world is made up of many chunks, in a variable like this: vector<Chunk> chunks; ...
0
votes
0answers
20 views

SDL_WarpMouseGlobal does not work in game

I tried to use SDL to move mouse in game. The function works fine only in menu, when I join a game, the function does not work. I checked coordinates with ...
2
votes
1answer
51 views

SDL render surface from byte array efficiently

In my current project I need to fill a 256x224 screen with the pixel values from an array. The array is declared this way: uint8_t *vram = new uint8_t[7168]; So ...
0
votes
1answer
43 views

draw concave polygon from set of edge points

I'm having troubles trying to rearrange a set of points where each point is part of the edge of a concave polygone. My set of points is not sorted in any order, they are just randomly put in an array. ...
36
votes
7answers
22k views

How can one implement hot-swappable C++ modules?

Fast iteration times are key to developing games, much more so than fancy graphics and engines with truckloads of features in my opinion. No wonder many small developers choose scripting languages. ...
3
votes
2answers
1k views

Quaternion based camera pitch freaking out, and Z-axis drift

This is the code I use to control my (first person) camera's movement and rotation. Translation successfully keeps orientation in mind, so that up and left and such are always in the expected ...
3
votes
0answers
61 views

Linking Unreal Engine with OpenCV libraries built with RTTI on Linux

Unreal Engine has a plugin for integrating with OpenCV. Currently that plugin works on Windows. I'm trying to modify this plugin to work on Linux. I've worked through many issues but I have one I can'...
11
votes
4answers
2k views

How would one generate a Navigation Grid for a 3D world?

I am attempting to find a solution to this problem. I'm trying to build a navigation mesh in the format of a grid of vertices locked to x, y floored coordinates in the shape of squares for 3D space. ...
0
votes
0answers
30 views

How to make the screen not flicker?

I want to be able to draw all my text, lines , triangles and other stuff to screen and then clear the screen and draw something new, BUT this method makes the screen flicker, and all the drawings dont ...
7
votes
3answers
15k views

SDL Function for Loading PNGs

I'm learning SDL 2.0 at the moment and I've seen this method for loading BMPs: ...
3
votes
1answer
63 views

How to access internal data from separated rendering-layer?

I am currently rewriting a project I have been working on last year and I’m utterly stuck trying to "correctly" separate the game-logic from its representation. I know why this is beneficial and I ...
2
votes
0answers
83 views

Glowing Effect and Blending [duplicate]

I am using C++ and SDL and I am trying to get lines with a glowing effect as provided by the image of the game Defcon on the continental outlines. How could I achieve this glow and blend of the ...
0
votes
0answers
20 views

DirectX 11 - Input Assembler - Vertex Shader Linkage error - SpriteFont

I'm trying to render text in my DX11 project, by using SpriteFont and SpriteBatch. Everything worked before adding the code in,...
0
votes
1answer
44 views

Vulkan - preallocating chunks of memory and resource memory requirements

I would like to allocate a bigger chunk of memory and then suballocate from it but I don't fully understand how memory requirements work, is there a chance that when I allocate a piece of device local ...
1
vote
1answer
645 views

Indoor 3D game worlds

I'm looking for a little direction. I'm building a game engine as a part of my university project, and I'm having a little trouble about what to look for when it comes to indoor 3D game worlds. Now ...
0
votes
0answers
29 views

Lua/LuaBridge with C++: No matching function for call to 'luabridge::FuncTraits::call'

I'm trying to implement cutscenes for my game using LuaBridge. Right now I'm setting up the Cutscene State, which creates a Lua state, stores it, and loads a script. I'm trying to set the functions up,...
0
votes
1answer
610 views

Camera rotation around point, but without centering

Let's say i have the following: Point somewhere in space Camera with position and orientation (up, right, forward) I want to rotate camera around the point, but also keep this point in same place on ...
4
votes
2answers
3k views

rpg 3d open world map & entity loading-streaming

Hello I'm a web developer and recently I started reading about game development. I followed some tutorials regarding c++ and openGL (whatever I could find online because as you know not many up to ...
0
votes
1answer
76 views

Sprite Management

I'm working on a game right now using my own engine. In the engine, I have a State Machine which handles input for, updates, and draws the current State - the one at the back of the vector. The game ...
0
votes
0answers
50 views

OpenGL mouse to world position

I'm trying to implement an editor like placing mod with opengl. When you click somewhere on the screen an object get placed in that position. So far this is my code ...
1
vote
1answer
68 views

How can I exit an Unreal game with a specific exit code?

How could I quit out of a Unreal game with a specific exit code? In Unity you can just Application.Quit(exitCode); but I could not find anything regarding Unreal. ...
0
votes
0answers
66 views

Game Engine Class and Subsystem Architecture

I have a quick question for those who have experience coding their game engine and such. I was wondering what a better approach would be when designing my own game engine. Right now I plan on having ...
0
votes
1answer
85 views

SDL Sliding Collision

I'm working on a 2D SDL C++ project, and I'm having a bit of trouble with collision detection. Currently the player collides with the edges of the level and with the SDL_Rect objects in the level, ...
9
votes
2answers
32k views

Making a 2D Platformer in C++/SDL. Looking for tutorials/examples/resources [closed]

I have a lot of experience with C++, but I have no experience with game programming. This summer I plan to create a 2D platformer from scratch using C++/SDL for the learning experience. I am looking ...
0
votes
1answer
30 views

Replacement for glDrawElementsBaseVertex in OpenGL ES?

I am porting my game engine(c++) to Emscripten, which unfortunately only supports OpenGL ES 3.(Not 3.2) Therefore I don't have access to glDrawElementsBaseVertex, which is needed by my renderer(...
0
votes
0answers
54 views

what is the sequence in using the “send” and “read” commands on the game client and server? boost asio

I have a voxel game in which you can run on blocks (chunks), jump and set/delete blocks. I want to write an asynchronous TCP server for it and choose boost asio as the network library. I have two ...
3
votes
3answers
4k views

Optimized rendering of a cube mesh world

I want to render a cube-mesh (a.k.a. Minecraft-style) world. If I render each existing cube it will eat up FPS pretty quickly. How can I optimize it? I understand that the point is to not render ...
0
votes
0answers
29 views

Center of World Map not the same as the center of my Bullet Physics World

As you could see in the image, the center of my map should be located at the intersection of the diagonal lines. When I import 3D buildings within the area into my Bullet physics world, I want to set ...
1
vote
1answer
48 views

Getting AABB Collision to work - C++

I've been trying for weeks to get AABB collision set up on my DX11 project. So far, I have a 'condition' set up in place, so that when both cubes collide the 'light' cube will show within the scene. ...
24
votes
2answers
20k views

How do you add a scripting language to a game?

Let's say I have a game written in C++. But I want to add some modding or scripting functionality to it. How would one go about adding a scripting functionality to your game?
14
votes
6answers
10k views

What scripting language would you recommend for a C++ game project? [closed]

By scripting here I mean not just putting config data in a script, but scripting parts of the project like some class methods, test specific game loop, etc. This would be not just to accelerate ...
2
votes
2answers
1k views

Example/Tutorial of passing structured data over network C++

This is very general question, about strategies how to pack same information about state of my game-world on server ( e.g. position/orientation of players, projectiles, etc. ) into data stream so that ...
0
votes
0answers
25 views

Dual Quaternion - How to apply the dual quaternion as a transform (Without converting to a matrix)

I've been trying to implement dual quaternions for a bone system and I have a few questions about them. I started by reading the beginners guide to dual quaternions (link: http://wscg.zcu.cz/wscg2012/...
0
votes
0answers
41 views

How to organize data transfer between the client and the game server?

I have a game like minecraft, I can run, set and delete blocks. The world consists of a limited set of chunks. I want to write a server for it with the help of a library called boost asio. I need help ...
2
votes
1answer
103 views

Overlaying Menus with a State Machine

I'm working on developing a game with C++, SDL, and OpenGL. I created the engine from scratch, and implemented my own state machine to handle menus and general gameplay. Each State gets pushed into a ...
1
vote
1answer
616 views

Why can't this simple SDL app be closed without task manager or rapid clicking of x button?

I wrote a simple app that generates a window, a raster, and redraws the raster once every 16ms. Right now the calculations are empty, it just draws a solid color. I don't know how, but I have created ...
0
votes
0answers
14 views

combine two translation/rotation/scale triplets without matrices

Let t1/2, r1/2 and s1/2 be two sets of transformations. Translations are vec3, rotations are quaternions and scales are vec3. Lets assume that all common operations are defined (overloaded operators ...
69
votes
10answers
23k 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 ...
0
votes
1answer
34 views

I can't make the cube map to use shadow mapping - or it seems so

Basically, I'm following tutorials as I'm very new to OpenGL. I managed to perform shadow mapping towards just one direction, meaning I created 2D texture depth map. Now with omnidirectional shadow ...
24
votes
2answers
22k views

I can't figure out how to animate my loaded model with Assimp

I have loaded in a model to my C++ OpenGL game. It is a COLLADA file type that I have loaded, and I setup an animation under blender for the file. The problem is I don't know how to animate the model. ...