abstract
| - Way back in 2008, we launched one of the big milestones in RuneScape's history: RuneScape HD. The two big things this brought were hardware acceleration in OpenGL and a resizable game window, so you could harness the power of your graphics card and play RuneScape as big as your monitor could cope with. At the same time, though, we also launched the ability to view the world map within the game client, which meant you could now see maps of dungeons, and we could add useful things like a big 'You Are Here' arrow and icon highlighting. Getting the world map into the game was a huge technical challenge - back in those ancient days, everything had to fit into 64MB of memory, because that's the maximum we could use as a Java applet. So the world map had to do a lot to get itself onto the screen. We had to throw away the 3D world that we'd built, and all the models (players, NPCs, trees, buildings - the lot), just to make some space. And once we'd worked out what the bit of the map you were looking at should look like, and drawn it to the screen, there was no space to keep that image around in memory, so the map had to be drawn from scratch every frame - hardware acceleration was new and not available to everybody. As such, the world map ran entirely in software mode, and we didn't rely on being able to upload images to the graphics card. Getting the world map into the game client at all was a major technical achievement. Unfortunately, because of the trade-offs that had to be made, it still wasn't a great experience. Loading the map was infamously slow (not helped by the fact that people playing in hardware mode had to be switched to software mode, and back again later), and because everything was redrawn every frame, performance went down as monitor resolutions increased. Even on my powerful development machine, at a resolution of 1920x1080 the map used to render at a decidedly choppy 13 frames per second. But in the intervening few years, a lot has improved with Java: we can now ask for more memory, and graphics hardware support is very good. So, we decided that it was time to show a little love to the world map and get it running as fast as possible, on two fronts: the loading time, and the framerate. With the loading time, we've been sneaky. The actual loading takes almost as long as it did before, but because we can use more memory now, we do it in the background while you're still running around the world. When you actually click the world map icon, the map should be ready to go, and we can show it instantaneously. If you're super-quick on the button after moving to a new map area - coming out of a dungeon back to the surface, say - then you may still get the loading bar, but in normal usage, it shouldn't appear at all. Also, we no longer take you out of hardware mode to show the map, so you no longer have to stare at a black screen while we swap you over. The extra memory means we don't have to throw away the game world when you open the map either, so when you're finished with it, we can show you the 3D world again straight away. The map still has a drop-down menu that lets you look at bits of the world other than where you are right now. If you use that, you'll see a loading bar while you wait for the new area to load, as before, but other than that, the new world map should be a wait-free experience! For the framerate, the obvious solution is to draw what you can see just once and remember it, rather than doing it every frame, and the old barriers to doing this have gone. When you open the map, we draw every map square you can see, and cache the textures created. As you move around the map, we draw extra squares as necessary to fill in the edges, and squares you haven't looked at for a while are marked as candidates to be thrown away - if necessary - to save space. When you change zoom level, we render any missing squares that have come into view, and we gradually re-render the existing squares at the new target size. If we re-rendered all the squares at once, there would be a noticeable stutter every time you zoomed in or out, so we do it bit by bit, and just scale the existing ones up or down to fit. Everything will - hopefully - be re-rendered by the time the zoom has finished. For most of you, the map square textures are uploaded to the graphics card, so drawing the world map itself (not counting all the icons and the text) is a case of a few cheap calls to the graphics card per frame. If you're still in software mode, we cache the textures in your system memory - something we could never have managed in the old 64MB days. The end result is that you should see a vast improvement in framerate. You might see a little bit of a drop as you scroll around and extra map squares have to be drawn, but once you've got most of the map cached, things should pick up to a silky-smooth, maxed-out 50FPS. We hope that all this will make the world map a truly useful tool day-to-day in RuneScape. Let us know how you get on!
|