Much-hated ‘4096 bug’ fixed

It’s been more than four years since the hypergrid was invented, and the “4096 bug” has plagued hypergrid travelers for all that time, preventing users from jumping more than 4,096 regions in any direction.

The problem involves both viewer and server code, and is a legacy of the Second Life environment, where the grid map is much more compact. OpenSim grids, however, are significantly more spread out. Many of the largest and oldest grids are centered at coordinates 10,000, 10,000, including OSgrid. Other grids are located around 1,000, 1,000. To travel from the lower to the upper grids, users would have to find intermediary way-points to jump to first.

The Hyperica hyperport used linked gates on multiple regions to deal with the 4096 bug problem.
The Hyperica hyperport used linked gates on multiple regions to deal with the 4096 bug problem.

Viewer developers and server developers typically didn’t talk to one another for most of OpenSim’s history. Partly this was because the viewer developers were primarily focused on serving Second Life users, since they were the far larger group. But another issue was that the licenses for the two sets of code are not compatible, and developers were paranoid about accidental intermingling.

Both of these issues have recently been addressed. As a result of Linden Lab policies, some viewer developers, including the Firestorm team, spun off OpenSim-only versions of their viewers. And a new foundation was set up for OpenSim to address the licensing issues, and allow the two sets of developers to work more closely together.

This closeness was most recently felt at the first annual OpenSimulator Community Conference, where viewer developers not only attended the event and made presentations, but also created a custom viewer specifically for the conference.

“I was pleased to represent Kokua at the Open Simulator Community Conference’s panel discussion on viewers, also on the panel were representatives from Singularity and Firestorm,” said Kokua developer Nicky Perian in an announcement last week. “We were questioned about what was known as the 4096 jump bug.”

Grid owner and hypergrid traveler Shaun Emerald got the ball rolling with Firestorm jira FIRE-11593, Tonya Souther submitted the first attempt at a fix, which generated discussion and testing activity both from other viewer developers and OpenSim server developers as well.

Nicky Dasmijn, a Firestorm viewer developer, spent a lot of time trying different fixes before zeroing in on the problem area, Souther told Hypergrid Business. “I also spent a fair amount of time on finding just where things were going wrong to begin with,” she added.

Then, last week, Singularity developer Latif Khalifa fixed the problem, shared his patch, and announced a new version of the Singularity viewer that included the simple statement: “Fixed a problem with long teleports in OpenSim.”

The code has also been donated to the Firestorm viewer and is expected to be included in the next release, due out in a couple of months. It is already part of the Kokua Viewer.

“OpenSim developers provided invaluable testing using Singularity and Kokua that provided the symptom verification, proposed fix, and a verified solution to this bug,” said Perian.

The Eld region on Sanctuary is a popular spot for hypergrid explorers.
The Eld region on Sanctuary is a popular spot for hypergrid explorers.

In the past, developers considered the 4,096 bug to be very difficult to fix, but while it may have been tricky to find, fixing it was much easier, and does not require any major rewriting of viewer code.

“The fix is a one-line change that any viewer team could easily implement,” said Emerald in a Google Plus discussion about the topic. Emerald runs the Sanctuary grid, which has a popular hyperport on the Eld region, located at sanctuary.homelinux.org:8012:Eld.

To test out the new long-distance teleports, you can log into OSgrid’s LBSA Plaza and jump to, say, Hyperica Lower, at hg.hyperica.com:8022:hyperica lower.

But it’s not enough to have an updated version of the Singularity viewer. The grids and regions themselves must also be running updated OpenSim code.

A hosting provider will do this on request. If you are running your own region, you will need to find the EntityTransfer section of the configuration file and set max_distance to 65535. Grid operators using Robust central grid servers should also set Check4096 to False in their configuration file.

The fix has also been added to the latest bleeding-edge release of the OpenSimulator server software, and is expected to be included in the next official, stable release.

Justin Clark-Casey
Justin Clark-Casey

“The default maximum allowed distance for avatar teleports was increased to 16383 map tiles in development code,” said OpenSim core developer Justin Clark-Casey in an announcement last week. ” This is in response to fixes in third party viewers to allow teleports further than 4096 tiles.”

Eventually, all grids will upgrade, but there will be a transition period at first where some grids have upgraded and are no longer affected by the “4096 bug” and others haven’t.

“It’ll take a while before the 4096 bug totally fades away, but it will – it’s dead and just doesn’t know it yet,” said Shaun Emerald.

According to Emerald, when jumping between two regions more than 4,096 regions apart, only the first region has to be running the updated code for the jump to work. However, making the return teleport back again requires the second region to be updated, as well.

As a result, the Hyperica Lower, Hyperica Central and Hyperica Upper regions will continue to stay up, to serve as intermediary jumping points for long-distance travelers from regions that are still running the old code. The addresses for the Central and Upper waypoints are hg.hyperica.com:8022:hyperica central and hg.hyperica.com:8022:hyperica upper.

The Hyperica grid itself is fully upgraded, and all the Hyperica gates will be revamped to take advantage of the new travel possibilities.

The reaction of the hypergrid community has been overwhelmingly positive.

John Lester
John Lester

“I encourage all explorers of the hypergrid to please take a moment and thank Latif on Twitter,” said John Lester, chief learning officer at ReactionGrid, in a recent post. He is also known as Pathfinder in-world.

“His hard work has resulted in a major improvement to the use of the hypergrid and the evolution of OpenSim as a constellation of easily accessible interconnected grids,” he added.

“This is really great news and nice work from Singularity people,” said Per Eriksson, founder of Australian virtual design firm Troppo Design. The company runs the Troppo Club OpenSim grid. Its latest project is The Lost Castle, a 29-region recreation of the historic 1613 Mori Tadamasa’s Castle from Tsuyama, Japan, which is a setting for machinima-style animated film production.

Maria Korolov