Skip to main content

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
1 answer
115 views

I want to know some methods of storing the voxel data in a game like Infiniminer or Minecraft in a C++ program. What file types can do this easily? The voxel values will be big possibly a trillion by ...
Opengraphicspros12's user avatar
0 votes
1 answer
133 views

In the context of game dev, what is the preferred memory to use to store structs like Entities or MapData which are large in size and have lifetimes lasting the entire game run-time. For example here ...
Syntax Error12's user avatar
0 votes
2 answers
160 views

I only know C, no other language. How do I use a linked list to store projectiles in sdl2? My bullet currently has an sdl_image, has been queried and has the following properties: ...
L1ghtkage CaptainL1ghtning's user avatar
0 votes
0 answers
45 views

I am a freshman cs major with an interest in game dev. I know next to nothing and am very new to this so please bare with me. TLDR; Should I use BSP for detection between moving and static objects as ...
L1ghtkage CaptainL1ghtning's user avatar
0 votes
0 answers
70 views

I'm writing a Software 3D Renderer in C many months after I first originally wrote it in Python. It is made using SDL2. My engine currently has depth shading, perspective correct texturing and some ...
DehGoose's user avatar
0 votes
1 answer
132 views

No shape seems to show up on screen even though I have meticulously verified everything. The data set I use which is parsed by my code CORRECTLY(I checked that) to be loaded into a generic array ...
Syntax Error12's user avatar
0 votes
0 answers
70 views

I am currently using a SDL_Texture *texture as a chunk in my world that is being Perlin noised onto to make terrain. Using a 2d array of these I tile the plane. But ...
Syntax Error12's user avatar
0 votes
0 answers
80 views

I want to render terrain efficently using perlin nosie and a lots of rects. Should I use rects or is there another way. Following is my implementation. I use rect size = 1 which is not really ...
Syntax Error12's user avatar
0 votes
1 answer
149 views

I'm trying to make a simple raytracer following the raytracing in one weekend book, but I couldn't understand why is he using what is called a viewport, he define it as a virtual rectangle, why don't ...
Anas Jawad's user avatar
0 votes
1 answer
113 views

I'm currently implementing a method for subdividing an icosahedron found here that isn't quite working as expected due to the artifacts created (and the way the triangles are oriented) The problem ...
Chillzy's user avatar
  • 47
0 votes
0 answers
92 views

In short: I'm writing my custom 2d collision engine in C and I've chosen to use quad nodes to optimize collision detection. My implementation defines 2 things: the quad node (Quad_s) and the elements (...
magg's user avatar
  • 11
0 votes
1 answer
213 views

For any that want to plumb Vulkan's complication I wish you well. It's a badly documented software SDK and here's a perfect example of why it's never clear through context: I want to run an all-C ...
daemondave's user avatar
0 votes
0 answers
161 views

I am trying to write a 3d Renderer in C using SDL and cgml but my shading seems to be not working correctly. When rendering the teapot I get seams and when I want to render a cube I get a bright white ...
Finn's user avatar
  • 1
0 votes
1 answer
120 views

I've followed this source from learnopengl.com for text rendering. It seems fairly simple, and only required this much code: ...
Scollier's user avatar
  • 124
0 votes
0 answers
69 views

Recently, I have been working on a small "pet-project" of mine in C using the SDL library. I have noticed that without my render-calls, my project takes up 2% of the CPU and with the render-...
Renadil's user avatar
0 votes
0 answers
2k views

When drawing a very simple RenderTexture using Raylib, with the following POC code, the texture actually drawn is vertically inverted. Is that normal? If not, what ...
SteeveDroz's user avatar
0 votes
1 answer
281 views

I am using octrees as an efficient way to store voxel data in a voxel game. The details of my octree implementation can be found here, but in a nutshell, each node is 16 bits, and the most significant ...
CPlus's user avatar
  • 153
1 vote
2 answers
243 views

I'm attempting to create an entity-component system in C++. However, I've run into an annoying issue where a component system function inherently involves a lot of ceremony and boilerplate. This is ...
Red Needle's user avatar
1 vote
0 answers
77 views

I am experimenting with opengl using c99 on windows and vs 2022 i tried to create an window using glfw in one project and put a function that supposed to generate a texture in another project that is ...
Abn Alsrag's user avatar
1 vote
0 answers
489 views

I want to handle different resolutions without altering any game objects. I tried using SDL_RenderSetLogicalSize() but I don't know how to implement it properly. ...
RGthehuman's user avatar
0 votes
1 answer
481 views

I've heard alot that I need to use fixed-point math, top-left rule, etc. to eliminate gaps between triangles but the thing is how did Quake not have any gaps, did it? I've seen Quake's math file and ...
MaximMogulev's user avatar
6 votes
3 answers
2k views

I am creating a game using C and some libraries. I wish to not require my users to download anything but the game as most games are self contained. What is the usual process for compiling and ...
Lead Vaxeral's user avatar
0 votes
1 answer
137 views

I am working on a farm game made in C. I am currently working on adding item processing, such as milling wheat into flour. Under the hood, I am using a ring buffer to handle the queues for processing. ...
Dotz0cat's user avatar
0 votes
0 answers
146 views

I recently took an interest in sphere topologies to find which one is the best. The most popular one seems to be the fibonacci sphere. So I went and did some research and found some C code online that ...
Chillzy's user avatar
  • 47
0 votes
1 answer
1k views

For various reasons I am building a very simple graphics engine. I have a pretty good 2D thing using plain SDL2 and C that essentially boils down to a single "putpixel" function. I can ...
MalphasWats's user avatar
1 vote
1 answer
126 views

I tried sampling equirectangular texture as a reflection. It simply does not work as intended. The texture is moving with my camera in a weird manner. Here is what I tried to do. Fragment shader: <...
Eskimo Joe's user avatar
0 votes
1 answer
142 views

I'm trying to make a simple snake game in C and OpenGL, and I have this at the moment, which runs almost perfectly: ...
Scollier's user avatar
  • 124
0 votes
2 answers
212 views

So an object has a position, velocity, and is affected by gravity. ...
CPlus's user avatar
  • 153
1 vote
0 answers
103 views

I want to load the OpenGL functions for my project myself. Are there any specific functions besides wglGetSwapIntervalEXT that require me to query the spec for its availability? And if there are, ...
Cherestes Radu's user avatar
0 votes
0 answers
109 views

Im implementing a series of textboxes in sdl2 ,however my program is not working correctly -sdl is not destroying textures when the destroytexture function is callled resulting in a weird overlap of ...
Exiatron00's user avatar
1 vote
1 answer
1k views

I tried asking this on reddit but I didn't get any answers so I might as well try here So I'm making a program to generate some terrain and it's not giving me the results I expected. It's drawing ...
Chillzy's user avatar
  • 47
25 votes
7 answers
4k views

What techniques have people successfully used or can suggest to deal with a consistent cross platform math for procedural world generation? Also, if you have done this, what were the pros and cons of ...
Roy Ward's user avatar
  • 783
1 vote
1 answer
518 views

I am trying to create a raycasting engine using C and CSFML, I already have the walls and textures rendering done and right now I would like to be able to render sprites into the scene. The difficulty ...
Xscreade's user avatar
2 votes
1 answer
2k views

I've been creating a 2D game in sdl2 in C and within my main game loop, I have found a section of code that causes a massive memory leak in my program, roughly leaking 100MB of memory per second. The ...
Bilal Ahmed's user avatar
2 votes
1 answer
6k views

Hi all, I'm working on an SDL2 project and I require multiple editable square textboxes as shown in the image above. Is there any way I can do this?
Bilal Ahmed's user avatar
0 votes
1 answer
493 views

I'm trying to convert a normalized unit vector, representing an entity heading, into a rotation matrix for rendering. The problem is that I'm using an (apparently) unusual forward vector for my ...
Nairou's user avatar
  • 634
1 vote
1 answer
558 views

I'm trying to create ID2D1RenderTarget to be used for writing text with DirectWrite. I tried two methods but can't get it working, both yield "The parameter is incorrect" error code. In the ...
Just Adude's user avatar
2 votes
1 answer
213 views

What are the advantages of using multiple game loops instead of one? Assume Level1, Level2, Level3. These levels may bring totally different problems and needs and they may also be completely separate,...
user avatar
0 votes
1 answer
378 views

In my TCP multithreaded server written in C, I have multiple threads with infinite loops checking for new inputs from thread safe queue and then doing their jobs. pseudocode: ...
user154155's user avatar
0 votes
0 answers
437 views

I want to create a state machine for menu in my SDL game. So this is my code without the SDL I just want to ask if this is a good way to create it. here is a code: ...
matthews's user avatar
0 votes
1 answer
129 views

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 ...
Andy Dansby's user avatar
1 vote
2 answers
630 views

Typical GLFW applications have these lines after glfwInit(): ...
user avatar
0 votes
0 answers
95 views

I'm making a game, and I'm adding a screenshots feature. Currently I save screenshot files to <Home Directory>/Pictures/MyGame/. However, I'm not sure if ...
user avatar
0 votes
1 answer
144 views

so I know a little bit about C (read like a few university level textbooks on it, I am not an experienced programmer or anything) and now I would like to learn the ropes of the Unreal engine to fidle ...
papajo's user avatar
  • 101
0 votes
2 answers
913 views

I want my C program to update the console every second, and it was working fine until I tried to handle input. Now the program halts since it waits an input from the user. How can I do this? ...
AliTeo's user avatar
  • 35
0 votes
0 answers
85 views

I'm trying to draw "bullets" in my game, but I think something is wrong with velocity computation. Sometimes the "bullets" are going in the right way, but sometimes they won't. The ...
ExTrayEx's user avatar
1 vote
0 answers
758 views

I'm currently using glReadPixels to read from the depth buffer to calculate where on the map the player is pointing, for the purpose of placing objects on the ground. I do this after rendering the ...
Nairou's user avatar
  • 634
0 votes
2 answers
1k views

I'm programming a C raytracer. I'm having trouble getting the camera to rotate the way I intend. I would like the camera to rotate by pressing keys: F & H rotate left & right around the world'...
zoom's user avatar
  • 31
1 vote
1 answer
995 views

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": ...
Gian's user avatar
  • 113

1
2 3 4 5 6