Questions tagged [c]

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

275 questions
55
votes
12 answers

Is it reasonable to write a game engine in C?

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 are, if any, some advantages that C has over C++?…
bruxisma
  • 768
  • 1
  • 6
  • 8
19
votes
10 answers

Game Development In C Only. Is it possible?

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 in C (no C++ or C#) I'd love to use these but for…
Ishan Sharma
  • 309
  • 1
  • 2
  • 5
5
votes
3 answers

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 the data was stored in a linear array and iterated…
roger_rales
3
votes
1 answer

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 robots' source code has this shape : /* Beginning file…
Jim
  • 131
  • 3
3
votes
1 answer

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 like to be able to benchmark so that I can find…
DJCouchyCouch
  • 221
  • 1
  • 3
  • 8
1
vote
0 answers

Understanding Quake I Timer

Here is a snippet of code from Quake I. LARGE_INTEGER PerformanceFreq; unsigned int lowpart, highpart; OSVERSIONINFO vinfo; if (!QueryPerformanceFrequency (&PerformanceFreq)) Sys_Error ("No hardware timer…
kontrarian
  • 283
  • 1
  • 4
1
vote
0 answers

what do you choose to point player in multiplayer game coding?

I'm making C or C++ texture multiplayer game (monopoly) and to code multiplayer, defined type user when you change player or point player in main() or other() you choose Number or pointer? for example, when one turn finish how do you change player…
user125387
  • 11
  • 1
1
vote
0 answers

C99: Dynamic dispatch in math library depending on SIMD

Say I am developing a Math library and I want it to be such that it will detect whether or not user's machine support SSE (and which version) and based on that, different functions will be called. I can think of three ways to implement that: Have…
user90189
  • 11
  • 1
0
votes
1 answer

How can I capture key events on the Mac when using OpenGL?

I have code that renders a triangle using OpenGL. I would like to control it using the arrow keys on the keyboard. Anyone know how I would do this on OS X? I think I can create an Objective-C file and import NSEvent, however, I was looking to try…
Jackie
  • 455
  • 1
  • 7
  • 16
0
votes
1 answer

Need help with optimizing loops scanning for enemies in tile based horizontal scroller

I'm looking for an optimization for my loops searching for enemies in a tile based horizonal scroller. My enemy array is in a struct and I am looping through the array with 3 loops. First loop finds the enemy on the left side of the screen within…
-2
votes
1 answer

What are the ascii numbers for shift and control?

I is trying to makey makey a program that will detect when certain keys are pushed. My only problem is that I dont know the nombers that corrospond to the shift key and control keys. I am writing this code for a game. Here are teh…
user124120
-4
votes
2 answers

Confused about arrays in C

Hey guys I am learning the basics of C language and I am a little bit confused about how to use arrays. I mean what are they used for?
Jithesh
  • 1
  • 3
-5
votes
2 answers

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

void Function( int, char ) versus: void Function (int,char) My friend keeps saying otherwise. What is objectively the best way to write brackets?
Ben
  • 2,141
  • 2
  • 22
  • 30