C is a general-purpose computer programming language used for operating systems, libraries, games and other high performance work.

learn more… | top users | synonyms

0
votes
0answers
33 views

2D day night mapping

I'm looking for this kind of effect MINUS the lights and snow (Another problem). It needs to change depending on the time of year. Doesn't need snow or city lights. Now I'm pretty new to shaders ...
1
vote
1answer
38 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 ...
-1
votes
0answers
27 views

Can I develop games like flappy birds or super mario using C language only? [duplicate]

I'm a second year student pursuing B.Tech in Computer Science. So, as a minor project I have to program a game using C only. I have heard of people discussing about the games like flappy birds and ...
-1
votes
2answers
56 views

Is there any easy way to understand the Alpha Beta for Othello?

I'm stuck with coding the Alpha Beta algorithm for a console-based game I'm developping at the moment. I tried to understand how it works for a week but still no idea how to get started with it. Here ...
1
vote
2answers
122 views

Are SDL games trivially portable from Linux to Windows?

I have a small game made with SDL2 and I want to port it to Windows. Would I hav eto write a lot of #ifdefs to port it or will the very same code work on Windows and Linux? Or is it more complicated? ...
0
votes
2answers
103 views

What's the correct way to move 2d sprites in opengl 2.1?

I'm getting into Opengl 2.1 and wanted to know how can I move 2d sprites. I already created my vbo and ibo, and the vertex data is already there. But, how can I move a sprite once it's already drawn? ...
1
vote
1answer
88 views

opengl : Running at least 25 windows with different Draw callback

I need to run at least 25 windows concurrently with each window rendering a different game state. I am storing all the 25 game states in the array of type GameState allGameStates[25]. For each of the ...
2
votes
2answers
105 views

Rogue Door Connection logic

I'm having a bit of trouble developing code to figure out which doors connect in Rogue which is written in c. Not the actual path making. I just dont understand how they link to each other. If rooms ...
3
votes
1answer
129 views

Where can I find OpenGL state changes profiling?

Is there any benchmark that actually measure state changes cost in OpenGL 3.x/4.x and gather an average statics for all graphics cards? (I don't want to optimize only for my old AMD card, I'm not even ...
0
votes
2answers
55 views

Overload how an object instance of a class is treated when used

So I've made this struct that encapsulates a glm::vec4. This is because vec3s are treated as 16-byte in GLSL, but I don't want to assign a vec4 if I only really need 3 components. Anyway, my question ...
1
vote
1answer
189 views

C++ Ray Traversing in 3D Voxel game

I'm currently working on a Voxel game in 3D and need a tad bit of help to figure out what Voxel the player is looking at. This is the data I currently have: GRRLIB_Camera3dSettings(Player.x, ...
1
vote
3answers
83 views

c - Starting an user defined function after the current one ends

The game I am creating displays a menu before starting, the user may select to start the game, or do some stuff. When the user selects an option, I need to call another function which actually does ...
1
vote
1answer
43 views

How can I send matrix data to shaders without the Effects11 framework?

I'm making a Direct3D engine but I'm stuck with this one little problem. I want to not use effect files but instead use shader files. What can I use to send matrix variables to shaders if I don't use ...
0
votes
0answers
13 views

Lua mud using c snippet for protocols? [duplicate]

I've been working on teaching myself to program in Lua for the past couple of months and I've been working on my own MUD using lama as my starting point. I've learned a lot and added quite a bit of ...
2
votes
2answers
468 views

How to detect graphics API at runtime with SDL2?

Using SDL2, is there a way to determine at runtime whether the application is using OpenGL, OpenGLES, or DirectX? EDIT: If there is a way to figure it out without using the SDL2 API, I'm willing to ...
2
votes
1answer
475 views

Emscripten code and three.js

I would like, if it's possible, to use Emscripten code generated from C/C++ with the Javascript library three.js. For example, from emscripten code I want to pass rendering information to the three.js ...
0
votes
1answer
81 views

Can I directly pass a Boost ptr_vector list to glBufferData?

I have a data structure like this: typedef struct vertex_ { float x; float y; float z; float s; float t; }vertex; Then I add to a list called: boost::ptr_vector<vector> vertices; Is there a ...
0
votes
1answer
719 views

Scaling an SDL Surface

I want to create a button for a game's UI. The background uses a gradient and then I blit a surface on top of the gradient and use SDL_SetColorKey to delete the unwanted pixels. The surfaces are not ...
0
votes
2answers
136 views

which quarter of a triangle the point is in

I've got a world made out of squares. The square are devided in four triangles like this: The corners have their heights stored in a 2D array and the center height is the average of the corners. To ...
0
votes
1answer
117 views

SDL Surface clipping mask

I am creating a GUI for my game, so I use some buttons like . So you can see it is only text surrounded by a rectangle. But I currently use a huge png image with all the buttons I need arranged as I ...
0
votes
0answers
97 views

Sometimes my game runs fine, other times it's shaky, why?

I'm trying to learn how to make games. I just did this very simple 3D game where you control a cube that shoots at incoming cubes. Sometimes I start the game and it runs smoothly from start to end. ...
1
vote
1answer
59 views

Accelerated Motion

I'm making a menu for my game with SDL, when you click on an option a sub menu slides down and is shown, just sliding down is really boring, so I want it to accelerate(like if gravity was pulling it) ...
5
votes
3answers
1k views

Is it a good plan to use 2D physics for a 3D racing game? [closed]

I am working on a 3D racing game using SDL and OpenGL. I thought it would be easier to use a 2D physics engine, since I really don't need the 3rd dimension. There will be no flying cars or jumps, they ...
3
votes
1answer
151 views

How to get scripted programs governing game entities run in parallel with a game loop?

I recently discovered Crobot which is (briefly) a game where each player codes a virtual robot in a pseudo-C language. Each robot is then put in an arena where it fights against other robots. A ...
-2
votes
2answers
1k views

Which library to choose between SDL and GTK for C game Development (Begginer) [closed]

Note: I know that this is a opinion based question I've been programming in C it's been some time, now I want to get into game development but I'm not sure which GUI library should I use between SDL ...
3
votes
1answer
141 views

Collision detection in Pong clone

Well I'm trying to create a pong clone using SDL and I had some problems with the frames and some times the ball would go through the paddles despite the fact that at other times the collision worked ...
0
votes
2answers
239 views

Is networking programming quite generic

I have only looked into the basics, at least I assume it gets more complex. So does network code really change from one game to the next or is it pretty much portable. For example I can create say a 2 ...
0
votes
1answer
708 views

Render two images to an SDL_window

I want to create a menu for an SDL game, so I load an Image to an SDL_Window as the background, then I try to load the next image which will be a button but it doesn't display the button to the ...
1
vote
1answer
394 views

Background color gradient with SDL

I want to create a menu for a game using a color gradient as the background. Is there a way to create a gradient background instead of using an image for it (since I don't know what size the window ...
0
votes
1answer
41 views

Problem with .hdr/.pic format

So, everything was clear from the specification point of view, but when I moved to reading through some of the original implementations and reimplementations, I ran into this: f = ...
-6
votes
2answers
112 views

Is padding brackets objectively the best way to write C programs? [closed]

void Function( int, char ) versus: void Function (int,char) My friend keeps saying otherwise. What is objectively the best way to write brackets?
1
vote
2answers
160 views

Using Lua for configuration and localization data

Since my game is already going to be scripted with Lua, I've decided to make all my configuration and localization data defined using Lua tables. For example, this could be a basic locale file: -- ...
1
vote
1answer
127 views

How to draw or translate into world space?

I've been hacking around with OpenGL, but there's a few concepts which I can not find the answer on. I want to draw three GL_QUADS next to eachoter like so: 1[2][3] I know GL_QUADS are deprecated, ...
4
votes
1answer
105 views

Dealing with interpolation and object creation/destruction

I've implemented a game loop similar to that in Glenn Fiedler's Fix Your Timestep! article. I have an update step running at 50Hz and a render step running at 60Hz (monitor refresh rate). To keep ...
1
vote
1answer
317 views

How to adjust a font to fit inside a speech bubble?

I'm creating a game that contains a speech bubble for dialog. The idea of this function is to allow one call to set new text in a speech bubble. The speech bubble will adjust in size of the new font ...
1
vote
1answer
286 views

Update and Render logic with interpolation

I am working with C and SDL2 and just wanted some insight as to how to properly apply interpolation to the rendering. EDIT - some clarification, update() input() and render() are just hypothetical ...
0
votes
0answers
187 views

bones programmatically in assimp

I am trying to animate a 3d hand object programmatically in Assimp, I have the 3d model being export to collada using Blender. But I have no idea how to go from one bone animate it and then go to the ...
1
vote
0answers
68 views

Sampler object not changing texture filter

I am currently binding a sampler object to a texture (GL_TEXTURE12 to be specific) with glBindSampler(12, sampler); and the initial settings are very visible compared to the textures own settings. ...
0
votes
1answer
162 views

Linking error at tessellation shaders in GLSL

I'm testing the triangle tessellation from the link http://prideout.net/blog/?p=48#shaders . All the shader are compiled correctly, but when I try to link the program using the command: ...
1
vote
1answer
133 views

When creating the horizontal blur, how is the vertex shader being called for each pixel?

I am following this tutorial. I am confused as to why the VertexShader is being called each time for the PixelShader. I was under the assumption the VertexShader is called only 6 times during the ...
0
votes
1answer
638 views

Set Sampler states: Linear, Bilinear, Trilinear Filtering/Interpolation

How do you set each of these sampler states in the hlsl Linear filtering Bilinear filtering Trilinear filtering
3
votes
2answers
633 views

Using quaternions, how do I determine if an object is upside down from an original rotation?

Imagine this scenario: An object is laying flat on a horizontal surface, from this an original rotation is determined. Then the object is moved, and at some point flipped upside down and put back down ...
2
votes
3answers
961 views

Is it possible to use DirectX in pure C program?

I want to try something simple with Direct Sound. Just want to know if it's possible. Or maybe I need some other API?
3
votes
3answers
148 views

Should I use select() for networking in my gameloop?

I'm writing a simple networked game in C/C++. To keep things simple I'm using TCP. In my server's game loop I'm using a POSIX select() with a zero second timeout for two things: Discover incoming ...
0
votes
1answer
135 views

Luminance increase in SDL

We have managed to create grayscale picture using the following snippet of codes in SDL. What we need to do now is how to first convert into YUV or YCrCb for it be able to set the luminance value and ...
0
votes
1answer
767 views

SDL gray scale image from a a color image?

I am new to sdl. I have basically have the following codes which can load the images. I know how to access the pixel as below. What I need it to convert the image to 8 bit grey level and 1 bit ...
0
votes
1answer
2k views

Can you use python, c and c++ in udk without plugins?

Im pretty new to game engines and i was wondering if I could use python, c and c++ in udk. I've tried getting the answer all over the internet but the answers i do find aren't very clear. So am i ...
0
votes
1answer
276 views

Creating a fragment shader to darken a white texture over time - OpenGL GLSL

So as a part of learning OpenGL, I've now decided to try and be a bit more creative with shaders, as part of a practice game I'm making using C/OpenGL. I'm completely new when it comes to working ...
1
vote
0answers
249 views

GLX/X11 Changing the rendering resolution

I have made a simple application that creates a window with an OpenGL 4.2 context and takes user input. I have implemented making the window go fullscreen with XRandR and can change the display ...
1
vote
1answer
792 views

Understanding the z-axis vector from OpenGL modelview matrix

I would like to shoot spheres in the current view direction in a simple scene. I use an FPS camera, so no z-rotation. The vector pointing in the correct direction should be (m[8], m[9], m[10]) where m ...