The C programming language.

learn more… | top users | synonyms

39
votes
12answers
14k views

Is it reasonable to write a game engine in C? [closed]

Even though C++ appears to be king, from what I've been told C is still widely used in games, especially on the consoles. However, would writing an entire game engine in C be unreasonable today? What ...
33
votes
5answers
5k views

Any tips for creating cross-platform games? [closed]

Do you have any tips/recommendations when creating a cross-platform game in C/C++?
20
votes
2answers
14k views

A good way to build a game loop in OpenGL

I'm currently beginning to learn OpenGL at school, and I've started making a simple game the other day (on my own, not for school). I'm using freeglut, and am building it in C, so for my game loop I ...
18
votes
3answers
5k views

How much assembly is really used in modern game code?

On average, how often is assembly used in modern game code? Specifically on platforms that already have good C++ compilers, like x86, PPC, or ARM--because I assume games on embedded systems make ...
12
votes
10answers
15k views

Game Development In C Only. Is it possible? [closed]

I am a first year college student in India and want to make a small game as a this semester project. I am quite good at C and am learning it rapidly but I wanted to ask if developing a game entirely ...
12
votes
1answer
5k views

How can I tell how much video card memory I'm using?

I want to programmatically determine at runtime how much video card memory is being used by my program. Specifically I'm wondering about how to do it on a Windows machine using OpenGL, but am ...
11
votes
2answers
457 views

How can I generate a texture that looks like left-over tea leaves?

We are working on a project for iPhone and Windows Phone 7 where we'd like to be able to generate tea leaves at the bottom of a cup. It doesn't have to look photo-realistic, and actually cartoon-y is ...
10
votes
3answers
2k views

Is GNU GCC used for AAA games?

GNU GCC is a very common compiler, but it seems like almost no one uses it for bigger projects like AAA games. To me, it's works just fine, never had a problem with it. But I wonder why all AAA games ...
10
votes
2answers
219 views

Should the color of a texture be adjusted for display on a television?

If a 24bit RGB image with a range of 0-255 per channel is displayed on a television that displays a range of approx. 16-235 per channel, color detail will be lost, correct? If so, should images be ...
10
votes
2answers
481 views

Can I call c functions within the XNA framework?

I would like to make a 360 game and was just wondering if I could re-use some existing C code I have or whether I need to re-write everything in C#. Any help is appreciated.
9
votes
2answers
4k views

What are the best ways to serialize and unserialize network messages for C/C++ multiplayer game?

We are using JSON right now and want to move to a binary format for some types of messages between client and server. Should I just read structs into the socket? Use proticol buffers/thrift? How ...
9
votes
3answers
20k views

Writing Game Engine from scratch with OpenGL [closed]

I want to start writing my game engine from scratch for learning purpose, what is the prerequisites and how to do that, what programming languages and things you recommend me? Also if you have good ...
8
votes
1answer
798 views

Processing component pools problem - Entity Subsystem

Architecture description I'm creating (designing) an entity system and I ran into many problems. I'm trying to keep it Data-Oriented and efficient as much as possible. My components are POD ...
7
votes
4answers
5k views

Why has the industry switched from C to C++?

First of all i would like to have a real answer, i'm always trying to get more from various sources and articles, and when I read things like C++ is slow because it has virtual functions and because ...
7
votes
7answers
5k views

Library to load images into textures, Linux, C and OpenGl

I am looking for simple, self-contained C library for Linux to load images from files into OpenGL textures. The licence should be quite liberal: zlib, bsd, mit or something. I have found SOIL, however ...
7
votes
6answers
554 views

Is it possible to write a game that doesn't require a GPU?

I already know many computers today have a GPU that supports DirectX and OpenGL. But what about computers that don't? Can I write a simple 2D game that does not rely on the GPU, so that it works even ...
7
votes
1answer
2k views

Which c/c++ model animation library for OpenGL [closed]

I'm fairly new to game development, played around with xna before and just learning OpenGL & c now and I'm interested to know which c/c++ based model animation libraries are out there and which ...
6
votes
4answers
2k views

Is there a sound library for C to generate sound samples from code? [closed]

I'm working on an engine for a retro-style game in C. I'm looking for a sound library that would produce chip sounds from code...I want to make my own simple chiptune tracker for the engine to create ...
6
votes
6answers
857 views

What is the story of game programmers beside gaming history?

Nowadays, game programming is like a big business-ish, technological, academical, programming havoc. There are dozen of engines, free or not, don't-reinvent-the-wheel dos and don't, plenty of ...
6
votes
2answers
1k views

Sending a struct containing a string over network

I'm trying to send structs as neatly sorted packets using iPhone Game Kit.. I have a struct which looks like: typedef struct { int coolStuff; char playerID[100]; } MyStruct; Then I'm using ...
6
votes
2answers
219 views

What does the Sys_PageIn() function do in Quake?

I've noticed in the initialization process of the original Quake the following function is called. volatile int sys_checksum; // **lots of code** void Sys_PageIn(void *ptr, int size) { byte ...
6
votes
1answer
1k views

Floating Point Precision (fp:precise vs. fp:fast)

In C or C++, does the compiler option of floating point precision really make a difference in real world (small/indie) games? From my observations, setting fp:fast is many times faster than ...
6
votes
2answers
1k views

How do I build games with scripted actors?

The idea I have an idea for a game. A few games, actually, that can built on top of the same general design. There is a game world that the player and the other actors exist in. The player can get ...
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 ...
5
votes
3answers
2k views

OpenGL Vertex Attributes - Normalisation

Alas, I have searched, and have found no definitive answer. When would you normalize the vertex data in OpenGL using the following command: glVertexAttribPointer(index, size, type, normalize, ...
5
votes
2answers
5k views

Constant game speed independent of variable FPS in OpenGL with GLUT?

I've been reading Koen Witters detailed article about different game loop solutions but I'm having some problems implementing the last one with GLUT, which is the recommended one. After reading a ...
5
votes
1answer
3k views

State Machines: State Object versus sequential check: what are the pro/cons?

I dont know much about finite state machine in AI or other game behaviors in game, except this quick tutorial with a Miner: http://www.ai-junkie.com/architecture/state_driven/tut_state1.html which is ...
5
votes
2answers
1k views

3D primitive rendering library

I am looking for a library which would easily allow me to render shapes (cubes, spheres, lines, circles, etc.) in 3D3 and OpenGL if possible. I want to be able to rapidly design visual debugging tools ...
5
votes
1answer
789 views

Advice for programming a lobby for a network multiplayer game?

I'm working on learning network programming. I'm working on a simple card game. The basic idea is: Players enter the lobby Players see tables Players sit at an empty seat Once they sit, they do not ...
4
votes
6answers
3k views

Any free 2D C\C++ framework that supports iPhone?

I'm looking for a C\C++ game dev framework that supports iPhone. It should have least Objective-C requirement to use it. The closest one I could find is Kanji engine. But that's not free. Other ...
4
votes
3answers
624 views

How do I do a game loop in c99?

I'm having trouble with how to structure a game using c99. I've seen a few tutorials on making a game loop, but they are all done with c++ and classes. My main problem seems to be moving data around ...
4
votes
2answers
263 views

Advice creating build process for medium sized game project

I've been looking through the SCons build script for Doom3 and researching different approaches to build processes used by professional game developers/studios (C/C++) and I've come across a few ...
4
votes
3answers
879 views

scanline filling a trapezoid

I have computed the four corners of the viewable bit of 2d map in my 3d view. So I know the trapezoid that is visible, and I want to 'visit' these tiles in my map. So my algorithm is basically a ...
4
votes
1answer
96 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 ...
4
votes
4answers
439 views

Video game entity storage and structures

I finally have all the working input/output of a game engine. However, I'd like to be able to put an amount of about 2000 shots being simulated in a region, total. I have done other games where all ...
3
votes
2answers
3k views

How do games make fire and smoke effects?

I was wondering around, searching internet about particle system and fire effects but I haven't found any good answers. On some games I have realized that some sort of movie is being shown as the ...
3
votes
3answers
567 views

How to find the bottleneck of the graphical pipeline

I've been wondering about this issue for a while. How to find the bottleneck of the graphical pipeline. Recently I've been using a program to draw massive amount of polygons in a simple scene with ...
3
votes
3answers
4k views

Simple 2D Collision Detection Algorithm Library

I'm building a simple OpenGL game and I was looking for some simple collision detection library for objects like squares, triangles and circles. Any suggestions? PS: Preferably a library that is very ...
3
votes
2answers
341 views

How does this background scrolling code work?

I'm glad that this code does exactly what I wanted it to do...But I can't make sense of it although I wrote it from scratch myself. What I wanted to do was create an infinitely scrolling background. ...
3
votes
3answers
584 views

Semi Fixed-timestep ported to javascript

In Gaffer's "Fix Your Timestep!" article, the author explains how to free your physics' loop from the paint one. Here is the final code, written in C: double t = 0.0; const double dt = 0.01; double ...
3
votes
2answers
5k views

Creating an OpenGL FPS camera: I have the position and orientation vectors, now what?

I have been struggling to create a first person camera in OpenGL ES 2.0 without using gluLookAt(). I grab the camera's orientation vectors (the way it's looking) from the current modelview matrix, and ...
3
votes
3answers
659 views

What algorithm can I use to detect simple shapes in a 4x4 matrix?

I'm working on a simple multiplayer game that receives a random 4x4 matrix from a server and extracts a shape from it. For example: XXOO OXOO XXOX XXOO XOOX and XOOO XXXX OXXX ...
3
votes
2answers
2k views

What shall I choose between CoronaSDK or AirPlay?

1st Question is I want to write a board game for iOS and Android so I'm coming up with CoronaSDK and AirPlay. Since I have a mac, development platform is not an issue but the problem is which one ...
3
votes
1answer
198 views

Techniques for benchmarking code running on the Sega Genesis' 68000 CPU?

I'm playing around with writing code for the Sega Genesis, which uses a Motorola 68000. I'm not an assembly code guru by any means so I'm writing in C and using SGDK. As it's slower than assembly, I'd ...
3
votes
1answer
444 views

Fog with Blend in OpenGL

I want to add fog in my scene which contain transparent textures made by Blend , when i enable the fog the transparent textures appear white From a distance but when i disable it the textures ...
3
votes
1answer
124 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 ...
3
votes
2answers
378 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 ...
3
votes
3answers
143 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 ...
3
votes
1answer
756 views

Procedurally generated 2d terrain for side scroller on Sega Genesis hardware?

I'm working on the Sega Genesis that has a 8mhz Motorola 68000 CPU. Any ideas on how to generate fast and decent 2d tile terrain for a side scroller in real time? The game would generate new columns ...
3
votes
1answer
357 views

Is there are a good double-precision small matrix SIMD library for x86?

I'm looking for a SIMD library focused small (4x4) matrix operations for graphics. There's lots of single precision ones out there, but I need to support both single and double precision. I've looked ...