Questions tagged [c]

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

Filter by
Sorted by
Tagged with
2
votes
1answer
30 views

Polling events with SDL results in stuttering response when dealing with multiple objects

I'm new to SDL programming and I'm not quite sure I got how it handles events. Given an instance like this defined in "game.c": ...
2
votes
1answer
66 views

Rotate Object in world space - Raytracing

I’m programming a C raytracing project. I’ve been wanting to implement object rotations (square, cylinder) for several days but I can’t do it. For each object I have its position (x, y, z) in the ...
6
votes
3answers
2k views

Convert integer to float while also dividing down the scale, without data loss

I'm working on a game, and my intent is to avoid use of floating point for unit positions. To that end, I'm using 32-bit integers for all positions, with a millimeter scale. However, for rendering, I ...
2
votes
1answer
56 views

Reducing adjacency bookkeeping work in constrained Delaunay triangulation

I'm using the Sloan algorithm for constraining a generated Delaunay triangulation. This primarily consists of edge flipping for the edges that overlap the constrained edges. In order to flip an edge, ...
1
vote
1answer
65 views

Throttling or adding delays between OnTriggerEnter2D calls

I have 2 game objects: Explosion and Enemy. At any given point, an enemy can collide with multiple ...
1
vote
0answers
37 views

Understanding Quake I Timer

Here is a snippet of code from Quake I. ...
1
vote
2answers
116 views

Getting Model View Matrix by hand

Right now I'm trying to calculate the model view matrix by hand... The App is 2D. I have something like this: ...
1
vote
1answer
221 views

How do I detect collision between an ellipse and a rhombus?

I'm building a game in C/C++ (been alternating between the two), but one of the biggest problems I've run into is collision detection. The game is isometric and exists on a 2x1 grid (e.g. the base ...
0
votes
1answer
78 views

SDL2. Why I'm getting a Segmentation Fault in the free() function? Also, am I doing the rendering stuff right?

So, I'm new at C programming and SDL2 and I'm trying to get something working here to write some games. First, I would like to know if I'm doing the rendering stuff the right way. I'm kind of ...
0
votes
0answers
41 views

I need help with my pathfinding algorithm

I am a student that is learning how to program and I started to develop my first platform game using C. However, I’m struggling with the pathfinding algorithm for the enemies. My levels are basically ...
0
votes
0answers
56 views

How does Quake II 'sleep'?

I'm looking through the Quake II source code and I cannot understand how the game implements sleeping. Here's how I understand the Windows main loop: Inside the loop it sleeps if the game is ...
1
vote
2answers
260 views

How to save game state in C in Allegro?

I'm developing my 1st board-game (go-game) in C with Allegro 5, for a course project. Part of my goal is to make a gamesave of the current gamestate. Let's say for 2 players if we exit the game, and ...
0
votes
2answers
311 views
5
votes
2answers
2k views

Drawing at floating point position

The library I am using (SDL2) only supports drawing to int positions. I am currently storing my objects positions as double, and ...
0
votes
0answers
84 views

Creating a game on Linux with SDL and distributing it

TL, DR: Will I be able to get a single .exe file which will work smooth in a PC which does not have SDL or so installed ever. If not, how close will be the closest ...
0
votes
1answer
120 views

Proper 2D isometric tile depth sorting?

I'm using Raylib, and I'm attempting to place tiles on a level, and the algorithm for placing the tiles is working. The problem is that the player will display over the walls on the bottom right hand ...
0
votes
0answers
60 views

How to make VR games-experiences without Unity or Unreal-Engine?

I have some experience with making videogames in c using libraries like OpenGL, FreeGlut, etc. I developed a game engine in c, specific for my game, so developing it with Unreal Engine or Unity is not ...
0
votes
0answers
109 views

Cyclone LED gaming code HOW TO HELP?

I am very new to programming. For a project I decided to make a game of cyclone using some LEDs,a push button, and a raspberry pi. I researched how to at least start on the game, but the problem that ...
10
votes
2answers
270 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 ...
0
votes
1answer
102 views

ANSI C Video Game Item System

I am looking to program my own little Role Playing Game using... ANSI C or "standard C", (NOT C++) as my programming language The SDL2 development library I have got a very basic and simple type of ...
2
votes
2answers
70 views

Need to programatically muffle game sounds

So I work on a multiplayer game that is set in space. There are essentially two environments for players to be in: inside a sealed space station (where there is air and thus sounds) and outside the ...
0
votes
0answers
108 views

Implementation of continous, grid aligned, smooth movement (C / C++)

I've been trying to make my own implementation of Snake clone using Allegro 5 / C. Unfortunetaly I can't find a good method to align x & y position of snake to grid. I'm looking for some good ...
2
votes
1answer
335 views

What do I provide to SDL_LockTexture **pixels?

All I'm trying to do is write random data to an array, then display that array to a window. But I can't get SDL_LockTexture to cooperate, it keeps complaining that I'm using the wrong argument. I've ...
1
vote
1answer
443 views

How should I store loaded world chunks in RAM (For my game similar to Minecraft)?

I am trying to replicate a chunk loading system, in C, for my own minecraft like game, though I don't know how. Once chunks are loaded, are they placed in an array, or are there a bunch of variables ...
1
vote
2answers
179 views

Is it possible to make desktop visible behind drawn object using SDL2?

I would like to draw an avatar over the desktop, something similar to those word 97 assistants, my idea so far is to make only the background transparent but I haven't had any luck, any suggestion? is ...
-2
votes
1answer
76 views

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 ...
3
votes
1answer
3k views

How could I implement an ECS in C? [closed]

I'm looking into how to do a game engine using only C and wanted to know how to implement ECS in C. I didn't find any ECS implementation for C, it only seems to exist for C++. So I'm wondering... Is ...
0
votes
1answer
137 views

Wrong angles given by atan2

I have a method to calculate angle between two vectors, but it is giving wrong values. here is the code : ...
0
votes
2answers
418 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
551 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 ...
1
vote
1answer
71 views
5
votes
1answer
5k views

Key released, multiple Keys, how to go around ncurses limitations?

I have been trying to make a small game in the terminal in C++ using ncurses. After searching around for some time, I came to realize that ncurses is pretty limiting as far as keyboard inputs are ...
1
vote
0answers
34 views

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 ...
-4
votes
1answer
679 views

Game programming in C, where do I get started? [closed]

I started programming about 6 months back and have a decent knowledge in how to code in C. I have mainly used it to implement elementary algorithms or solve Project Euler questions (reached 50 now :) )...
10
votes
4answers
15k 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 ...
0
votes
0answers
60 views

How can I make this tile map correctly?

I'm having the following problem creating this hexa tiled map. this is what I wanted : [EDIT] Ok I've Managed to do this: ...
1
vote
0answers
138 views

Doom-style 8 directions sprite math HELP C++ [duplicate]

I'm trying to get Doom-style 8 direction sprite rotation that changes its sprite depending on the camera and the forward vector of the entity just like this video here: https://www.youtube.com/watch?v=...
1
vote
1answer
39 views

Trying to translate object

I'm trying to tranlate a matrix by xy but the result is strange. can someone help me translate and rotate the matrix properly? ...
8
votes
3answers
316 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. ...
2
votes
3answers
9k views

What compilers are used in game development? [closed]

I was kinda wondering what compilers are used in game development, since the game development industry always tries to squeeze every inch of performance out their software, using, among other, (...
2
votes
1answer
1k views

How do I check if a window has focus in SDL2?

Is there a replacement for SDL_GetAppState function in SDL2 from older SDL versions? Why was it removed? I want to use it so I can check if the user has focused the ...
0
votes
2answers
161 views

SDL2 only renders a single image

As an attempt to learn SDL on C, I decided to try and create a simple Pong program using it. My problem now is that of the textures I've given it, two paddles and a ball, only the ball is rendered. It ...
4
votes
0answers
76 views

Is the C or the Android code a problem?

Starting to write a game, it'll have a C server, and at the very least an Android client. However I have run into an issue where I can't seem to get them to connect. I have thrown debug logging into ...
1
vote
2answers
994 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: ...
0
votes
3answers
467 views

Would it be inefficient to call LWJGL from C++?

I like LWJGL, but Java? Not so much. I recently found out a way to call Java methods from C++. But would this be inefficient? I mean, calling a C/C++ DLL from Java, just to be called back again into C+...
1
vote
0answers
185 views

ANSI C (C11) math libraries? [closed]

I know there are a multitude of C++ math libraries out there, but my current project is C-only (C11). So far I've made due with writing my own matrix/vector functions, but now I need to do the more ...
1
vote
1answer
6k views

Why am I getting these errors when including stb_image.h?

I'm trying to put an include guard around including stb_image.h (from the well-known public domain image library). I have noticed that, unusually, the include ...
0
votes
1answer
545 views

Simulate Keyboard Button Press [SDL Library]

I am trying to simulate an SDL keyboard button press (using C). I have looked up the SDL info pages online but I still don't have anything that consistently works. I have the following (removed the ...
1
vote
1answer
62 views

Segmentation Fault using Allegro_Tiled, function al_open_map();

I have consistently segfaulted trying to load a TMX file into a *map. ...

1
2 3 4 5