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
0
votes
1answer
26 views
-4
votes
0answers
79 views

Is it safe to access array past bounds? [on hold]

In a game engine, there are numerous structs like typedef struct { uint32_t w; uint32_t h; uint32_t pixels[1]; } bitmap_t; which are allocated like ...
0
votes
0answers
25 views

For storing enchantments, which is more efficient? [on hold]

I am making a game, and I decided to totally copy Minecraft's enchantment system. Other enchantments you might see are ones I am adding to my game. I have a few candidates for storing enchantments. ...
1
vote
2answers
129 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 ...
1
vote
2answers
150 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
1answer
220 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 ...
-2
votes
1answer
59 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 ...
0
votes
1answer
198 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 ...
1
vote
2answers
80 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 Somethign like this.. ...
0
votes
1answer
114 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
1answer
47 views

OpenGL Tiled map texturing problem

Some Tiles in my map are drawn wrong, I think it might be a indexing problem. Here's the output : some tiles just look wrong!! I'm not sure where i'm going wrong with my code, so please take a look. ...
0
votes
2answers
229 views
0
votes
0answers
20 views

How to handle mouse to look around (Win API)?

I've made a command prompt game engine. It handles input using Windows Messages, but now I came up with idea of adding mouse input. Currently I wrote a 3D maze game and I'd like to make mouse look ...
0
votes
2answers
358 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
501 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
51 views

Is there a way to numerically determine the ranking of poker hands? [duplicate]

I'm having to create a poker game called "Jacks or Better" as part of an assignment. As with all poker games, there are various combinations of 5 cards that have different ranking. So my question is: ...
1
vote
1answer
59 views
3
votes
1answer
3k 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
30 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
615 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
13k 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
27 views

how to register update function in Lua from C game engine?

This is my first attempt to make a SDL2 based 2d game engine in C, i am planning using Lua as scripting language for gameplay purposes. First i learned how to call a C function from Lua: ...
0
votes
0answers
56 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
79 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
34 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
292 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. ...
0
votes
3answers
8k 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
576 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
91 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 ...
3
votes
0answers
54 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
808 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
425 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
174 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 ...
0
votes
1answer
2k 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
430 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
52 views

Segmentation Fault using Allegro_Tiled, function al_open_map();

I have consistently segfaulted trying to load a TMX file into a *map. ...
1
vote
1answer
2k views

Are there any game engines for developing in C? [closed]

I cant find any game engines which use C, mostly just Java, Anyone know any good engines that support 2d Development in C? ALso I have an additional question how hard is it to write your own game ...
1
vote
1answer
141 views

Change the image of sdl window with a new one

I will make a game and it has 3 buttons on its menu. Those buttons supposed to change the picture the background of the menu When i click on play, another picture should appear like so I found a ...
-1
votes
2answers
356 views

My 2D collision code does not work as expected. How do I fix it?

I have a simple 2D game with a tile-based map. I am new to game development, I followed the LazyFoo tutorials on SDL. The tiles are in a bmp file, but each tile inside it corresponds to an internal ...
2
votes
1answer
256 views

How to handle Japanese on Windows and Linux using SDL_ttf and C++?

In SDL_ttf, there are a few functions provided that handles non-ASCII string literals, such as: TTF_RenderUNICODE_Solid ...
0
votes
1answer
398 views

Programming Action RPG Battle system

My best goal atm is just make one 1vs1 battle with no animations more than something which makes me realize the attack is done. I'm learning C and Xlib, and now I know how to put an image in a window ...
-2
votes
1answer
327 views

Find a vector 90 degrees to the right of a given angle

Can you help transform this function to move the point not only by Forward distance but also by a distance to the right or left? ...
2
votes
1answer
2k views

Handling variable frame rate in SDL2

i am creating a game with C++ and SDL2 game engine but i noticed this. I used the Vsync option for rendering, so it'll render at 60fps. If i use this game with another monitor, fps are different (for ...
2
votes
2answers
177 views

Mixing DirectX headers with C mod project not working

I'm trying to add a DirectX 11 renderer (not sure if that is even doable in a "simple" manner) to the Return To Castle Wolfenstein source code and I'm having some problems. I have a rendering class in ...
1
vote
1answer
401 views

SDL 2.0 OpenGL not drawing anything except background

My 'hello triangle' compiles well, no errors, but doesn't drawing anything. Here's my code: main.cpp ...
1
vote
0answers
153 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 ...
1
vote
0answers
69 views

2D Collisions engine

I am working on a fabric simulator at low level, I have done some work and at this point there are some points where I would appreciate help. The input of the program is a DRF file. This is a format ...
1
vote
1answer
645 views

SDL_RenderPresent is writing over the previous frame

Whenever I call SDL_RenderPresent, the previous frame is replaced with black before the new frame is displayed. It's almost like when I call ...
3
votes
0answers
479 views

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

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 ...
2
votes
2answers
518 views

Setting a uniform float in a fragment shader results in strange values, is this a type conversion? How can it be fixed?

First, some details: I'm learning OpenGL from the tutorials on https://open.gl My computer is running Linux Mint 18.1 Xfce 64-bit My graphics card is a GeForce GTX 960M OpenGL Version: 4.5.0 NVIDIA ...