Roblox Launches Dynamic Lighting On iOS
Calling mobile technology 'disruptive' would be the understatement of the century. Smartphones and tablets have effectively revolutionized the way we communicate; the technology behind them has caused an integral shift for both business and consumer. This is due in no small part to their popularity: almost everyone these days has a smartphone, and most people either own a tablet or desire one.
The proliferation of this technology has come hand in hand with another runaway trend: mobile gaming. See, there are many points during the day where people tend to be fairly idle. Further, much of that time is spent away from the computer. As a result, many look for some simple, fun, and easy means of passing the time.
Mobile games fit the bill.
The folks behind ROBLOX - the Internet's largest user-generated gaming site and open-source development platform - are acutely aware of that trend. They've started looking to expand beyond the confines of the PC. One of the ways they're doing this is by developing technology capable of bridging the performance gap.
To that end, the organization recently launched its lighting and shadow engine, Dynamic Lighting, on iOS. I had the opportunity to sit down with ROBLOX's Arseny Kapoulkine and Simon Kozlov to discuss the details.
"On tablets, graphics cards are usually very constrained regarding what we can do," explained Kapoulkine. "Mobile hardware compared to current PC hardware is significantly less powerful. Given the mobile constraints, you need to make significant concessions in how you design your product. You can either have something that looks good but is mostly aesthetic, or having something that looks extremely simple yet dynamic. If you want to make beautiful graphics dynamic, it's quite difficult."
Given that ROBLOX exists in both a mobile and PC ecosystem, this is a problem. Thankfully, it's not one the developers are unfamiliar with.
"ROBLOX doesn't really have a specific hardware requirement," continued Kozlov. "Our user-base is quite diverse in the speed of hardware they have. Even on a PC, the platform needs to be scalable. We should be able to deal with hardware that's really fast and give you something that looks great, or deal with hardware that's really slow and still give you an enjoyable experience, with as many features of the original as possible."
It was this design principle that informed the development of ROBLOX's Dynamic Lighting tool for iOS.
"We had to make something that works on iPad - providing some different quality - but also works on PC," Kapoulkine explained. "Traditionally, PC games use graphics hardware to do lighting. They use it to deploy it, and the CPU hardly does any computation at all. You change the light, and it's there. Unfortunately, it doesn't scale to mobile, where we don't have the hardware performance. In terms of speed, our user's CPUs are relatively the same, but there are huge gaps in graphics cards. As a result, graphics on iOS are usually very constrained with what we can do."
The solution, continued Kapoulkine and Kozlov, lay in putting the CPU to work doing the computation, rather than the GPU. This technique - the same technique they used with Dynamic Lighting on PC - makes the tool extremely scalable and flexible. Even so, they weren't quite certain it would be workable.
"We thought maybe we wouldn't be able to pull this off because of hardware differences and limitations," Kapoulkine mused. "We knew mobile hardware was much weaker than PC hardware. We were hoping the technique was scalable enough to work on mobile, but until you try, you simply can't know. We ended up using special CPU instructions to compute lighting more efficiently."
"Even though it was a lot of work to implement, it definitely paid off," he added.
The basic framework of Dynamic Lighting is the voxel - or volumetric pixel. Essentially, the tool creates a giant grid of three-dimensional cubes. Within each cube, there is a lighting value, which details how much light that cube receives. The graphics card determines this value, while the CPU actually implements it.
"The first part has a lot of really involved code," said Kapoulkine. "It dynamically computes shadows and lighting information, including the effect of lighting on nearby objects. If you move the light, a few voxels change, but not the whole grid. Populating this grid is the complicated part. "
"The second part," Kozlov interjected," is where it gets beautiful. We can actually allow ourselves the luxury of being late with lighting updates. If you move a light and you're using a new iPad, we just update as fast as possible. If everything is really slow, such as on a previous generation iPad, we allow ourselves to lag behind on updates. This allows us to keep a relatively stable framerate, and still use lighting."
Of course, the question on everyone's mind - the question everyone wants to hear answered - is what all this means for the user.
"It adds consistency between platforms" Kapoulkine replied. "things users create on the PC become available on mobile, even if they don't have an iPad. ROBLOX becomes an interconnected, open platform; no matter where you made your content, it's available on the other side. This raises the bar for the content players can create and makes the value of a user-generated community greater and greater."
The main innovation, though, is that Dynamic Lighting removes the constraint of dynamic versus aesthetic. It allows users greater freedom in what they develop, and how. According to Kapoulkine and Kozlov, they've already seen some phenomenal games made with the tool on PC, including several survival horror titles which use light and shadow as a primary mechanic. They're hoping to see such titles come to iOS in short order.
The mobile iteration of Dynamic Lighting isn't perfect, however. Currently, it only allows for shadows from the sun and sky, and it's fairly limited in what it allows the user to do. Understandably, graphical quality is also slightly lower than you'd see on a desktop.
"Quality-wise, it's not exactly at PC level," admitted Kozlov. "We're constrained by memory. It's still the same application between them - not some seperate mobile app that doesn't work with the PC, we won't compromise on features - but it doesn't quite look as good as most AAA PC titles."
That's a bridge they hope to cross in the future.
"Right now, we're thinking about adding shadows from point lights," said Kapoulkine. "We've also received a lot of requests from the users for lights of different shapes, spotlights, rotating lights, et-cetera. There's always the performance work, as well: people will always trust our system to deliver scalability, and we'll continue working to make it perform better on PC and iPad. Ultimately, from here on out, our promise is this:
Any new feature added on the PC will have iPad support."
A tall order, indeed - but if anyone can do it, it's ROBLOX. They aren't number one for nothing, after all.