Hacker News new | ask | show | jobs
by iman 5891 days ago
This question has been bugging me in my mind ever since I first saw this presentation back in 2005:

What integer value in a game gets so big that it can potentially overflow a 64 bit integer?

I've literally been thinking about this question for years and I can't think of a single case. Bignums are pretty much only used in scientific computations and the only thing in a game that would come close to this would be encryption, in which case the programmers would know what they are doing and wouldn't mistakenly used fixed size integers.

(Of course back in the day integer overflow bugs in games were everywhere, one awesome example being level number 256 in pacman)

3 comments

64 bit integers should be enough for anybody :)

I don't know, why people keep asking for more resources? Maybe he wants to store every pixel, its lightning and physics from a 32 multiplayer game to offer time-machine features (like the TimeShift game). Maybe he wanted to make a scientific game, something like EVE online, but analysing Hubble data. Maybe he just thinks it would be nice to be the first to break the current limits to sell future-proof game engines.

I don't know. But asking why would people ever want more in their computing power than what's been offered has always came back to bite the questioner :)

What integer value in a game gets so big that it can potentially overflow a 64 bit integer?

2^64 meters is only around 1900 lightyears, which is woefully insufficient for a galaxy-scale RTS.

But a game that uses integer meters for coordinates has galaxy-scale problems of another kind.
I've tried to write a space game, and let me tell you, 32 bit floating point is woefully inadequate. Unfortunately, most 3D hardware at the time was built around 32 bit floats. Those only give you about 1 in 100,000 resolution. I had to create scaled-down "billboards" for nearby celestial objects and park them 1000's of kilometers away. (When they were actually 10's or 100's of kilometers away.)

Even 64 bits wouldn't allow for a naive implementation of a realistically scaled space game. There would still have to be a lot of optimization tricks played.

EDIT: I realize that the parents posts are talking about Integers, but you can't send those directly to the GPU!

Perhaps he foresees a high score inflation.

My favorite integer overflow bug was the max score in original tetris -- 32767. Although seeing IKEA chair* tester's counter overflow and bring the system down is a close second.

[* chair tester just like one shown here: http://www.youtube.com/watch?v=uaZ3ikJ-M4o&NR=1]