Skip to main content

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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
123 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 ...
Sad Robot's user avatar
0 votes
0 answers
100 views

How to make calculating the inverse matrix more robust?

When I calculated the inverse matrix, I found that the error in using the float data type would cause the inverse matrix calculation error. Is there any good solution? ...
noodle_run's user avatar
0 votes
2 answers
216 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 ...
JensB's user avatar
  • 157
1 vote
1 answer
453 views

Godot Velocity: Invalid type in utility function "lerp", cannot convert arg 2 from Vector2 to float on line 40

I'm trying to solve a lerp problem on my velocity, searched some stuff here and there, but found nothing that solved it. Can you help me? ...
Murilo Melo's user avatar
0 votes
2 answers
188 views

How can I make a reliable time-based object updating system?

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

What dynamic range of numbers do games typically use?

Most of the numeric quantities used in games (aside from integers for counting or indexing objects) are single-precision floating point. This is IEEE format, which allows for numbers as big as 1e38 ...
rwallace's user avatar
  • 125
0 votes
1 answer
879 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....
philB's user avatar
  • 231
0 votes
1 answer
2k views

Dealing with Floating Point precision in a Minecraft-like game

As far as I know, you can walk for 30 million meters in either direction in Minecraft to reach the end of the world. My question is, how does Minecraft handle loss of precision when dealing with ...
Moons's user avatar
  • 103
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 ...
Nairou's user avatar
  • 634
3 votes
2 answers
4k views

Mathf.Approximately: should I use it & for what cases?

For comparing floats they recommend using Mathf.Approximately At the same time, they don't use it, for example, for comparing types such as vectors. From Vector3....
Serg's user avatar
  • 393
1 vote
6 answers
751 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 ...
matronator's user avatar
3 votes
0 answers
185 views

Quake 1: frame timer

If you check Quake 1 source code (sys_linux.c), you can see something like this: ...
user1095108's user avatar
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 ...
jvn91173's user avatar
  • 624
0 votes
1 answer
239 views

How can I avoid the precision loss when recentering objects on open terrain?

For a better context this question is related to this one: What's the largest "relative" level I can make using float? When the player is moving too far away from the center, all the ...
jokoon's user avatar
  • 5,253
2 votes
1 answer
223 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 ...
Jacob Gunther's user avatar

15 30 50 per page
1
2 3 4 5