{"id":915,"date":"2009-10-17T12:07:11","date_gmt":"2009-10-17T01:07:11","guid":{"rendered":"http:\/\/www.vectorstorm.org\/?p=915"},"modified":"2009-10-17T20:33:13","modified_gmt":"2009-10-17T09:33:13","slug":"levels-andstreaming","status":"publish","type":"post","link":"https:\/\/www.vectorstorm.com.au\/2009\/10\/17\/levels-andstreaming\/","title":{"rendered":"Levels and Streaming: a Retrospective"},"content":{"rendered":"

In my days as an amateur magician, I noticed that as a magic-practitioner myself, I watched other magicians’ performances with a different eye than I had, when I was merely a normal spectator. \u00a0I stopped being surprised or amazed when cards were discovered in unlikely places or when the shapely lady who, just moments ago, had been handcuffed, bagged, and locked inside a trunk turned up somewhere entirely different. \u00a0This wasn’t particularly surprising — after all, I knew how these tricks and illusions worked. \u00a0What was<\/em> surprising was that now that I knew all the secrets, watching these performances became even more interesting — watching how the magician managed to get his hand into his pocket without the audience noticing, how misdirection to something noisy or shiny allowed him to set up for the next illusion in plain sight, if only anyone had been looking at him during that critical moment, etc.<\/p>\n

Now as a game programmer, I’m noticing much the same thing. \u00a0Today, I’d like to talk about levels and streaming, and the changing relationship between the two. \u00a0I’m going to be focusing on console games here, but the history of PC games has been very similar. \u00a0More beneath the fold.<\/em><\/p>\n

<\/p>\n

In the beginning, there were levels. \u00a0Of course, they weren’t called levels at the time; \u00a0they were generally referred to as “stages”. \u00a0Probably the first video game to be released with multiple stages was the original Donkey Kong<\/a>, which cycled between four different level layouts. \u00a0Of course, it wasn’t long before having multiple stages was a standard, expected video game feature, and every game had a “fire level” and an “ice level” and a “desert level”, to the point where it was a cliche. \u00a0(Oddly enough, the currently ubiquitous sewer levels didn’t appear until much later)<\/p>\n

The main distinguishing characteristic of a “level” is that it’s a playable space which is not contiguous with any other playable space. \u00a0So for example, there is no way to travel back and forth between the “fire level” and the “ice level”, apart from having the game teleport you from one to the other. \u00a0This teleport was most often part of progression within the game — you’d be teleported into the next level only when you successfully completed the previous level.<\/p>\n

However, some games had and have much smaller “levels” than that. \u00a0For example, the early Resident Evil games had each room of their mansions existing as separate levels; \u00a0walk up to a door, push a button, and the game would teleport you into the next room’s “level”. \u00a0Most graphic adventure games have “levels” which consist of a single screen; \u00a0you’re teleported to the next room the moment you walk out of the screen.<\/p>\n

In the early days, this was fine — data was being loaded off of a cartridge, which meant blazingly fast load times, so you could transition into the new level rather quickly. \u00a0However, it began to become a problem when games started to be shipped on CD-based media, which while it can store far more data for far less money, provides much slower access to the data. \u00a0As graphics improved and level data needed to become bigger, the time it took to load levels became longer and longer. \u00a0Simultaneously, game designs were calling for larger and larger playable areas, which would only exacerbate the problem.<\/p>\n

“Streaming” is based on the idea that for many types of task, you don’t need all of the data in order to start performing an operation. \u00a0A classic example is playing a video file; \u00a0provided that you set up the video file format properly, you can make it so that you don’t need all of the video file; \u00a0you just need the part of it which is near the part that you want to play. \u00a0The rest of it can still be loading from disc or over the network. \u00a0As long as you’re receiving the video data at least as fast as you’re consuming it, you can start playback immediately, instead of waiting for the whole download to complete.<\/p>\n

Inside video games, the earliest example of streaming was probably Killing Time<\/a>, which could have a single “level” in memory, but also had space set aside for a “loading corridor” to be used while a level load was in progress. \u00a0Loading corridors were \u00a0empty corridors, usually U-shaped or S-shaped, which the player had to run through in order to travel between levels. \u00a0The time it took to run through the corridor covered the time which it took for the game to load the next level. \u00a0Later, this same technique was used in games such as StarFox Adventures<\/a> and Metroid Prime<\/a> (the latter of which also placed doors at the end of these corridors, for when the corridors were not long enough to cover the load times).<\/p>\n

“Loading corridor” approaches were a bit fragile and not a lot of fun to program, so they weren’t used very often. \u00a0Most games still used separate, disconnected levels, which required a level load when travelling between them. \u00a0Some, such as\u00a0Ratchet & Clank<\/a> or Resident Evil 2<\/a> attempted to hide this level load by playing a cutscene over it. \u00a0Sometimes this misdirection worked, sometimes it didn’t.<\/p>\n

Now, some tech. \u00a0As game graphics continued to become more intensive, and game levels continued to become larger, it was becoming impossible to contain all of a single level in memory at once; \u00a0this reached crisis proportions by around 2005, and led to most commercial games moving to a “streaming” approach for their levels. \u00a0However, this streaming wasn’t like the old loading corridors; \u00a0this new approach allowed far more flexibility, and even allowed for modern-style “open world” games where the player has huge freedom to travel anywhere within a single giant “world” level. \u00a0Here’s how it works:<\/p>\n

Your game allocates a certain number of “level slots”. \u00a0Depending on your type of game, you’ll choose a different number of slots. \u00a0The fewer slots, the more data you can fit into each. \u00a0The more slots, the more flexibility the system has for allowing the player to move in any direction without seeing into areas which haven’t yet loaded. \u00a0An extremely linear action game might have only three or four slots. \u00a0A wide-open urban game like GTA 2 might have about seven. \u00a0A massive high-altitude game with huge vistas like MMORPG Tycoon might have 50 or more. \u00a0Regardless of how many slots you choose to have, you divide up your levels into distinct areas, and then as the player plays the game, you load these areas into the different “level slots” as they’re required by the game. \u00a0So in a linear game, if you have three slots and five areas, and the player begins in area B, you start by loading areas A, B, and C into the slots. \u00a0When the player moves from area B into area C, you throw away area A, and load area D into that now-empty slot. \u00a0Once the player moves into area D, you throw away area B and load area E. \u00a0The same concept works for wide open games; \u00a0you have a certain number of slots, and you load the nearest data into each slot, and empty the slots which contain data that the player has moved far away from, to make space for nearer data.<\/p>\n

This system works great; \u00a0it’s very simple, and provided that you can load level data faster than the player can traverse through the level, you never need to have a load screen within a level, no matter how big that level becomes. \u00a0Of course, you still require a load when you travel to a new level, in order to fill up the new level’s slots for the start of the level.<\/p>\n

As before, some games try to disguise that between-level load with cutscenes or other mechanisms to take attention away from the load which is occurring. \u00a0This is how things have been for the last few years; \u00a0it’s been kind of a steady state. \u00a0But it’s now beginning to change again. \u00a0One can look at the recently released Uncharted 2<\/a> to see what’s happening.<\/p>\n

From this point of view, the big clever improvement that Uncharted 2 has brought to the table is that it’s not just performing its “put the nearest data in our level slots” streaming according to geographical proximity — it’s doing it according to temporal proximity. \u00a0When the player nears the end of a level, it starts throwing away data from the current level and loading data for the next level, all while you’re still playing in the current level. \u00a0This means that it’s able to immediately cut straight into the new level location without a load. \u00a0 To my knowledge, it’s the first level-based game which has managed to tie progression between levels into the traditional within-level streaming system.<\/p>\n

You’re going to start seeing a lot more of this in coming years; \u00a0in the same way that “load corridors” would make us roll our eyes today, loading sequences between levels are going to become far less accepted within the next few years. \u00a0I’ll have to keep that in mind, once I start thinking about letting players look inside their dungeons, in MMORPG Tycoon. \u00a0;)<\/p>\n","protected":false},"excerpt":{"rendered":"

In my days as an amateur magician, I noticed that as a magic-practitioner myself, I watched other magicians’ performances with a different eye than I had, when I was merely a normal spectator. \u00a0I stopped being surprised or amazed when cards were discovered in unlikely places or when the shapely lady who, just moments ago,…<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":""},"categories":[20],"tags":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/po9WK-eL","_links":{"self":[{"href":"https:\/\/www.vectorstorm.com.au\/wp-json\/wp\/v2\/posts\/915"}],"collection":[{"href":"https:\/\/www.vectorstorm.com.au\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.vectorstorm.com.au\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.vectorstorm.com.au\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.vectorstorm.com.au\/wp-json\/wp\/v2\/comments?post=915"}],"version-history":[{"count":0,"href":"https:\/\/www.vectorstorm.com.au\/wp-json\/wp\/v2\/posts\/915\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.vectorstorm.com.au\/wp-json\/wp\/v2\/media?parent=915"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.vectorstorm.com.au\/wp-json\/wp\/v2\/categories?post=915"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.vectorstorm.com.au\/wp-json\/wp\/v2\/tags?post=915"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}