How the Cash Stack Max 2.147 bn is Implemented in RuneScape

How the Cash Stack Max 2.147 bn is Implemented in RuneScape

5 years ago
Anonymous $TjsaxHwAP-

https://medium.com/@garyduong/how-the-cash-stack-max-2-147-bn-is-implemented-in-runescape-124deffadd09

I’d played RuneScape back in secondary school from 2005–2009, left for a while, and returned at the beginning of this year. Playing the game brings with it nostalgia, and it was in fact RuneScape that had introduced me to the field of computer science. Back in the day, RuneScape was run as a Java applet that required a Java Virtual Machine (JVM) to run. (Java is compiled bytecode, so it needs a JVM to translate to machine code to be run on the machine.)

RuneScape was built when 256 kbps modems were common, and computers were about as powerful as your mobile today. Hence, size limits on data-types were enforced for optimal efficiency in storage and in-game computations. In particular, 32-bit machines had gained widespread consumer market share; hence most machines supported the 32-bit Java applet. This meant that a hard limit was imposed on the maximum number of coins in a player’s inventory or bank: 2³¹-1, or 2,147,483,647 (2.14 bn) coins.