Questions tagged [floating-point]
Floating point numbers are approximations of real numbers that use a form of scientific notation to store significant figures and an exponent. Use this tag for questions that pertain to the use of floating point numbers in games.
61 questions
0 votes
1 answer
178 views
How can I improve vector collision algorithm?
I'm making a game (shocker) in pygame and had issues with tile-based collision detection. There are 5 different non-empty tile types (pictured below) which can be rotated in increments of 90 degrees ...
0 votes
2 answers
257 views
Is there a logical reason for SFML's Vector2 being templated?
The game development library SFML has a Vector2 class template (and a Vector3 for that matter), which can use any arithmetic ...
0 votes
2 answers
211 views
How can I make a reliable time-based object updating system?
So an object has a position, velocity, and is affected by gravity. ...
0 votes
1 answer
916 views
24bit float to RGB
There's solutions to convert float to RGBA but I would like to encode a float depth value in RGB format and save the three components in three separated unused alpha channels and recompose when needed....
6 votes
3 answers
4k 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 ...
1 vote
6 answers
816 views
How to deal with players having too much money (or any large numbers)?
I'm working on a browser MMORPG in PHP and MySQL and today got a bug report about int32 overflow, due to the player having too much money. When I was designing the core system, I completely forgot ...
52 votes
6 answers
19k views
How can I perform a deterministic physics simulation?
I'm creating a physics game involving rigid bodies in which players move pieces and parts to solve a puzzle/map. A hugely important aspect of the game is that when players start a simulation, it runs ...
2 votes
1 answer
244 views
How much slower is it to draw on "half pixels"?
I've noticed that games like Diep.io are using floating decimal points for thin stroke lines on the grid. I have even tried this myself, by adding 0.5 to all of the ...