News

Dev Blog | Dealing with Draw Distance

Dev Blog | Dealing with Draw Distance

This is the first in a series of Dev Blogs coming your way in the run-up to the launch of NXT - our all-new RuneScape client.

Look out for more dev blogs like these in the coming weeks, and for news of the upcoming NXT Beta Weekends.

Read on as Mod Philip tells us more about the challenges the team faced in bringing you NXT's spectacular vistas.


In the new client for RuneScape, you can see a lot further than in the existing Java client. This means that we can make Gielinor look better than it ever has before, but it brings with it some problems for us to solve. When the game was first designed, it was never intended that players would be able to see so far. This has led to some 'interesting' decisions as to where things have been put in the game world.

The first issue is that certain places in the game world look closer than they should, thematically speaking. This is mostly the case with islands such as Karamja, which now look as if you could get to them with a quick swim, rather than a lengthy voyage.

Karamja from a not-so-distant shore

I'm sure I could swim that...

It is very difficult for us to actually move an island like Karamja. There are a lot of places in the game that reference the exact co-ordinates of places on the island, and do so in ways that are not easily detected and automatically updated. It would take a lot of effort to actually move places like that on the surface world, so we've come up with another solution.

First, we've hidden the island from view when you are not on the island (and hidden the rest of the world when you are on the island), and then replaced it with something else.

To achieve this, we've added a feature to tag the world as different areas. This allows us to make those areas visible or invisible in relation to each other – and to attribute them with other properties in the future.

Each colour below represents an area – there may be more than you'd expect!

Area Colour Map
1. Beneath the Surface World 4. RuneScape Surface World
2. Dungeons 5. Clan Citadels
3. Dungeoneering

The second part uses the area tags to add 'impostor' bits of map into the world in place of the bits we have removed. We can build a bit of map that has some sea on it (for example), and replace the now-invisible island with it. This means that wherever you are, you will only see the parts of the world that you should.

Using this to hide islands (and to hide the mainland from them), is something we have not actually done much of yet, but we have used the area tagging system to deal with another case where the increased draw distance has meant you can see things you shouldn't.

Non-instanced dungeons are mapped out into the same co-ordinate space as the over-world in RuneScape, along with the templates that we've used to create bits of instanced content (that is, copied so that different people or groups of people can play in the same area without seeing or interfering with each other). Since we never thought we'd be able to see far enough for it to be a problem, a lot of these dungeons/templates are quite close to each other, and look a bit jarring when you visit those areas!

Tuska visits Death's house

Well, Tuska is dead...

We had done some work previously to label all of these areas (or at least a lot of them), so that they can be shown on different map images on the world map. We couldn't just take that data and use it to hide the different areas from each other automatically though, since there are several places where you can walk from one place to another quite legitimately, even though they're in different areas. This would be a problem if you couldn't see where you were walking to!

Example of a split area transition

Mind the gap!

The safest thing for us to do was to programmatically prevent areas from being defined if they could be walked between by players or NPCs in the game. We then wrote a tool that took the information about world maps (as seen in the map in-game) and automatically generated the image of which areas should be seen from which, placing down invisible walls to prevent anything from walking between them.

This might sound a bit dangerous… and it was! We already knew that there were some places where this would cause previously traversable routes to be cut in half, but we found a lot more when we actually tried it.

After quite a bit of back and forth with Mod Helen (who was doing most of the hard work tweaking the maps), I added an output to the tool that gave a map of everything with the new walls highlighted in magenta, so it would be easier to see where this approach had failed.

So many walls...

So...many..walls...

Days of adjustments later, and the dungeons and instance templates were separated from each other (well, mostly). There were a couple of bugs when we launched the changes where bits of the world were still separated that shouldn't have been, but they were all sorted out pretty easily.

Another case where the increased draw distance has caused problems is in instances themselves. When instances resemble something in the open world, they are usually set up so you can't get close enough the edge to see the nothingness that lies beyond. In the new client this is not really the case any more.

However, we can put something around the edge to mask this. In instanced content, the world is built up out of whatever the server tells it to be, so this is technically quite simple to do. There are a lot of instanced bits of content in the world, though, so there are not many places where this feature has yet been used.

There are also places where different parts of the same instance should not be visible from each other: for example, the aquarium in a player-owned house. We haven't yet put anything in place to deal with this, but using the techniques already described, it should be quite simple to resolve.

All of these solutions require manual effort: going through the game, finding the places that need this sort of intervention and fixing them. We'll prioritise the biggest, most obvious places, but it's a massive task. We'll need your help once NXT hits beta to mop up everything that's left!

When we increased the draw distance, we also increased the distance to which we transmit other players to game clients, as it was a bit odd to have other players and NPCs popping in and out of view when they are actually quite close to your player. This was great, except that in some PvP situations we felt it might cause some game balance issues. To combat that (pun intended), we added to the existing code that turns off cosmetic overrides in some PvP situations where that might cause a problem, returning the distance at which players appear to the same as the Java client.

Draw distance in the Grand Exchange

They're everywhere!

All of this work has certainly been worth it. Being able to see further across Gielinor has been pretty awesome. No more fog right next to the camera for me!

Mod Philip
Technical Director