DD2018: Mikkel Gjol - Inside shipping on iOS — Transcript
Full transcript
- 0:00[Music]
- 0:34thank you very much thank you all for
- 0:37arriving very early for Sebastian's talk
- 0:39about beautiful real-time ray machi
- 0:42after this session until then I'll be
- 0:44talking about our the inside shipping
- 0:47and how we did that on my ways and then
- 0:49now I'll round it off with a little bit
- 0:51of real-time ray tracing just to sort of
- 0:52warm you up for Sebastian story fluids
- 0:55so I'm from ma played it played it did a
- 0:59game called limbo a couple years ago in
- 1:022012 we then are released inside in 2016
- 1:08so I'm not going to talk about how we
- 1:10actually made this game I'm just going
- 1:12to talk about how we ship them which is
- 1:14something we've done quite a lot over
- 1:16the last couple of years so we initially
- 1:18we've shipped on five different
- 1:20platforms or four and switches almost
- 1:22there so we kind of feel by now that
- 1:27we're pretty good at at actually going
- 1:29through that process so that's what I'll
- 1:31talk about so the agenda for today is
- 1:34I'll also go over the rough approach to
- 1:39how we week about that the tools that we
- 1:41use that we've built most of those few I
- 1:45were specifically sales and then a
- 1:46little bit on the the child architecture
- 1:49of the mobile devices so of course I
- 1:52didn't I didn't actually do all the
- 1:54porting and building and stuff myself
- 1:56so inside was obviously made by plated
- 2:00and the iOS port was worked on by by all
- 2:03these beautiful people so for the iOS
- 2:07port our target was to have the exact
- 2:10same game running so we didn't want to
- 2:11do like a mobile conversion of the game
- 2:14the way we achieved that was primarily
- 2:16are to lower the resolution a little bit
- 2:18and run it at 30fps rather than 60 we
- 2:21also did a little bit of optimization
- 2:23but to be honest we were kind of
- 2:25surprised by how fast the devices are so
- 2:30sort of the high-end mobile CPUs and
- 2:32GPUs are roughly on par with laptops
- 2:35which sort of service our back
- 2:38so one of the things that we did have to
- 2:42do was to cut one gigabyte
- 2:45one gig about memory devices so
- 2:48being a console game and not wanting to
- 2:52cut any content we did have to use quite
- 2:56a lot of memory and the devices
- 2:58unfortunately there's no way to actually
- 3:00filter for that in the App Store's of
- 3:02what we ended up doing was making the
- 3:05initial part of the game a trial and
- 3:06then have this upsell point with in-app
- 3:09purchases that way people could they
- 3:13could still download the game and then
- 3:14as they had downloaded the game we could
- 3:15check how much memory was available on
- 3:17the device and then we could either run
- 3:19the full game or we could run this
- 3:21beautiful trial screen oh sorry not
- 3:24trial screen but sort of we're really
- 3:26sorry we we can't run on your device
- 3:28screen and and hopefully people would be
- 3:30less unhappy with that they of course
- 3:34still disappointed but at least they
- 3:35didn't pay for all the disappointment so
- 3:39as we started thinking about the the
- 3:41mobile port we were just finished with
- 3:45our the the the main releases the
- 3:47console releases so those weren't really
- 3:50ports we just sort of had PlayStation
- 3:52and Xbox running alongside PC for at
- 3:54least the last couple years of
- 3:56production to make sure that that the
- 3:59work we were doing actually worked
- 4:00everywhere so after releasing those we
- 4:04did we some patched up those releases
- 4:06and then we started upgrading so we're
- 4:07running unity and we started upgrading
- 4:09unity from the the custom 5.0 that we
- 4:12released consoles on through 5.6 so so
- 4:18that was this was sort of an initial
- 4:20upgrade of unity we we do have source
- 4:23code for unity so we had made some
- 4:24changes of course we had to sort of move
- 4:27those over as well we removed some of
- 4:29the updates like the multi-threaded
- 4:32renderer are seeing as that was actually
- 4:34integrated oh rather unity had done it
- 4:36themselves since then so there was no
- 4:38use for that but there's a bit of work
- 4:40for that as well
- 4:41we then did an initial iOS port just to
- 4:45make sure that it actually ran and to
- 4:48sort of gauge how much work was we
- 4:52needed to how much work we needed to do
- 4:54to actually get that that running so our
- 4:56initial our initial impression
- 5:01no the like as soon as we had actually
- 5:03made that port we see that it was
- 5:04running quite a bit beyond expectation
- 5:06we thought we had to do a lot of work
- 5:09and it was running everything was broken
- 5:11and it didn't look right at all but we
- 5:15could play through the game and it was
- 5:16hitting around 30 FPS so we were pretty
- 5:19confident that we could actually make
- 5:21that work within a reasonable amount of
- 5:23time and that was the better part of a
- 5:26year of bug fixing bugs from the you to
- 5:30upgrade the box from shaders they were
- 5:33being very specific about what they were
- 5:34doing on the platforms that they were on
- 5:38some relating to to unity as well sorry
- 5:42to iOS as well the majority of box we
- 5:46encountered I have to say was from
- 5:48upgrading immunity in part because we
- 5:51were doing things that were way too
- 5:53specific and in part because unity sort
- 5:57of updated some things as they should
- 5:59and optimize things but we were just
- 6:00being very specific on on the the use of
- 6:04of unity at the time of course alongside
- 6:09this we were doing external actual game
- 6:12work integrating with the App Store one
- 6:15came censor for achievements actually
- 6:17doing the touch interface for for the
- 6:20game and and that sort of thing all
- 6:23right some was we told a little bit
- 6:25about profiling because that was a big
- 6:28part of the reporting as well so we
- 6:33actually did a presentation at unite
- 6:35last year and if you're interested in
- 6:36sort of way more detail then I should go
- 6:39watch that one some on YouTube from you
- 6:42know I think I said that all right
- 6:45so initially when we moved to a new
- 6:47platform the first thing we need to know
- 6:49and sort of the easiest things know is
- 6:50what's the actual performance that we
- 6:52have on the device so we can sort of
- 6:54know how much do we need to to optimize
- 7:00to actually get device running second
- 7:02thing then when we know that the
- 7:03performance is bad which is usually the
- 7:05case we then need to know what are the
- 7:07actual bottlenecks and what causes sort
- 7:10of specific issues and then when we
- 7:12optimized this
- 7:15specific area then we need to know if it
- 7:16was actually faster than the ending that
- 7:18we just changed stuff and it didn't
- 7:20change anything so what we do is this on
- 7:24the top we have the full inside game as
- 7:27its laid out and at the bottom you can
- 7:29see the performance at any point in the
- 7:32game our cream is of course fast enough
- 7:34which is usually below 60 milliseconds
- 7:37and orange and red if it's if it's
- 7:39really bad so left to write the full
- 7:42game let's try the for gaming in
- 7:44profiling underneath so the way we
- 7:45generate this is we use qele qele is our
- 7:48QA guy we record every playthrough he
- 7:52does and then we can play that back on
- 7:55automate it on devices so yeah so what
- 8:02does is record everything that he does
- 8:05and then we play that back and then we
- 8:07do profiling on these runs we can do
- 8:10that sort of every night it's it's
- 8:12pretty easy so we can sort of get a
- 8:14history of of performance over time we
- 8:18can also do if we receive a new piece of
- 8:22hardware we can just run this I mean if
- 8:24that completes we're sort of pretty sure
- 8:26that it works
- 8:28of course it catches crashes and that's
- 8:31all thing as well so what we get out of
- 8:33that is as you can see at the top we
- 8:36have this very small history I think
- 8:39that we can click and then click through
- 8:41all the dates that we have captures from
- 8:44and we have all the usual unity
- 8:47profiling stats so CPU time all the
- 8:51renderings tests memory and then for
- 8:54every point in the game we also have
- 8:56full call stack with instrumented
- 8:58profiling of that and then at the bottom
- 9:00of screenshots we actually know which
- 9:02part of the game we are we're currently
- 9:03looking at we also get this present we
- 9:10also do this presentation which again is
- 9:12all the other statistics along with the
- 9:18GPU time what we call class time which
- 9:21is how long did a frame actually reside
- 9:24on the screen so we can see if we missed
- 9:28a frame or not so the the bread spikes
- 9:30in the third row are our mists frames
- 9:35where we actually dropped frames then we
- 9:39have the full memory and the in the
- 9:41middle and then below we can see what
- 9:43content sort of streaming details what
- 9:45contents actually are loaded in at any
- 9:47point um and below are audio events and
- 9:51that's all thing alright so that gives
- 9:55us a pretty good overview of the
- 9:58performance in the game so we can kind
- 10:00of dive into specific areas and figuring
- 10:01out why they're slow so one thing to
- 10:04note is that these are not primarily
- 10:07gaming devices they are made for I
- 10:10suppose primarily for other things
- 10:13including Facebook and cute kittens and
- 10:16that sort of thing so quite often when
- 10:19you're profiling you will get
- 10:20interrupted by our background services
- 10:23that we'll do other things so of course
- 10:27this makes perfect sense for mobile our
- 10:29platform and it's not something we can
- 10:31actually change out in the wild but
- 10:33while profiling it makes sense to sort
- 10:35of clean the device of everything and
- 10:38turn off Wi-Fi and mobile dates and all
- 10:41those things so we actually have sort of
- 10:44less noise while profiling so the the
- 10:48second thing that's interesting is that
- 10:50it's of course if the the device will of
- 10:56course our throttle the the CPU our
- 10:58primary for two reasons one is if it
- 11:01gets too warm it will will reduce the
- 11:03speed to cool down and the second is
- 11:06that it will second thing is that it
- 11:08will do so just to save battery so it's
- 11:11trying to run at the lowest clock
- 11:12frequency that I can so an interesting
- 11:15thing that happened was that our
- 11:17external our QA our company called EMC
- 11:20they came back to playing that the
- 11:22devices were getting uncomfortably hot
- 11:23regions of course what we did as all
- 11:26good engineers is that we went out in
- 11:27port and industrial great thermometer
- 11:29freaked out was uncomfortably hot meant
- 11:31and so that's actually quite cool so
- 11:36it's around four degrees that you start
- 11:38so sort of stop sweating and feeling
- 11:40like okay maybe my
- 11:42phone won't actually survive this and a
- 11:44curious consequence of that is that we
- 11:46actually have to target the game not at
- 11:48device spec but at human spec which is
- 11:51so much lower so as an example the
- 11:54iPhone X we can actually run that at
- 11:57sixth of the entire game at 60fps
- 11:58without any problem but it gets really
- 12:01warm and and yeah we decided to run it
- 12:07at thirty instead and then have a cool
- 12:08device that people were happy with and
- 12:10not feeling like we were breaking their
- 12:12their phone although it's it's quite
- 12:14fine surrounded hada so we get into this
- 12:18scenario where we we sort of want to hit
- 12:22like a middle section when when
- 12:26profiling so we want to not have the
- 12:29device too warm so that it's that's
- 12:32thermal throttling we also don't want to
- 12:34run it at too low a workload so that it
- 12:38starts battery saving sort of different
- 12:42approaches apparently Carmack has a
- 12:45fridge next to his desks that he puts
- 12:48the phones in we had a guy from Apple
- 12:50who just sort of took the phone and put
- 12:52him in a bowl of water because it was
- 12:54certified for that so that should be
- 12:56fine I won't recommend either of those
- 12:58um primarily though because I don't
- 13:00actually think that that area is really
- 13:04there I suppose like the device will
- 13:07always try to battery safe it will
- 13:09always try to run it the lowest possible
- 13:10frequency so the the CPU frequency will
- 13:14will always vary and implication of this
- 13:17of course is that sorry so an
- 13:25implication of this of course is that if
- 13:27you optimize something to make it twice
- 13:30as fast then you may not actually see
- 13:32that on the that the profile times maybe
- 13:37it just reduces the CPU speed so we kind
- 13:41of need to know what the CPU speed is is
- 13:43so we did this or in-game overlay where
- 13:48we can see the CPU speed along with all
- 13:51the other metrics that we had before as
- 13:53well and the way we do that
- 13:55is that we at startup we try to reserve
- 14:01assuming that device is not overheating
- 14:03then we run the some workload we run
- 14:07that a lot of times so that we are
- 14:10pretty sure that the frequency is as at
- 14:13its maximum and then we time that a
- 14:16couple of times and then we figure out
- 14:17what the eff absolute fastest execution
- 14:22execution speed was for that void load
- 14:24that way we think that we have the the
- 14:27fastest that this device can possibly
- 14:29run and then at one time while we're
- 14:31profiling we then run the same workload
- 14:33though a lot fewer times and then again
- 14:36pick the best of those and then we think
- 14:39that we have a an estimate for the
- 14:42current speed and then by comparing to
- 14:44the fastest speed we can then figure out
- 14:46what the CPU current CPU speed is
- 14:49roughly and that seems to work pretty
- 14:51well so we all did that for this for the
- 14:55CPU it count looks like the GPU is doing
- 14:57something similar this is running at
- 14:5930fps I think and now we can kind of see
- 15:01these sort of waves on the GPU that kind
- 15:04of indicate that it may be over quite a
- 15:09long time actually turning this U or GPU
- 15:12speed up and down as well um this is
- 15:14something that's also affecting us when
- 15:16we're doing profiling even in in Xcode
- 15:20but just apples are tool to to do
- 15:25profiling so on the left and on the
- 15:28right are you have ten different samples
- 15:32in Xcode where we have a full frame of
- 15:35insight and we are trying to profile our
- 15:38the how fast a single drawn call this
- 15:42and it's around 1 and 1/2 milliseconds
- 15:43on the left and but the variance of that
- 15:46is around half a millisecond so that's
- 15:48that's quite a long time so in on the
- 15:51right we then try to optimize that by
- 15:53removing half the math that's in the
- 15:55shader and we didn't see statistically
- 15:57that it's faster but unfortunately sort
- 16:01of a single sample is not enough so the
- 16:04you know like the fast iteration of
- 16:05changing source code within Xcode
- 16:08and then recompiling is a bit hard to to
- 16:13get functional so for bigger things what
- 16:16we did was that we actually looked at
- 16:18the full
- 16:19GPU capture of the entire game so we we
- 16:23captured the whole thing and then we
- 16:24kind of visually inspects it one versus
- 16:26the other and I'll get back to this a
- 16:28little bit so I suppose the takeaway
- 16:33from this is that it was actually pretty
- 16:35hard to get sort of concrete performance
- 16:37metrics if you're wise and CPU wise as
- 16:41well the device that we found that was
- 16:43the most stable was the new Apple TV has
- 16:46an active crew on it so at least dozen
- 16:49thermal throttles recently was very
- 16:52handy for us to know the CPU scaling was
- 16:54a lot of things that we we sort of
- 16:55fiddled were unable to find otherwise
- 17:00and of course these tools that would get
- 17:04us the performance and the entire game
- 17:06was were very helpful all right so one
- 17:10thing that we did actually found that we
- 17:12could see you next coat is that every
- 17:15time you load a shader on the the shader
- 17:21will get recompile through what's called
- 17:22or actually that that is that's not true
- 17:26so the first time you load a shader it
- 17:28will get recompile to what's called
- 17:30metal on its rigid representation and
- 17:32then all subsequent are notes of the
- 17:35game will just use all the cash from the
- 17:37first load but then as you draw
- 17:40something with that shader the first
- 17:42time it will then patch up and recompile
- 17:45the shader and Swedish representation to
- 17:48match the blend state and render target
- 17:51States and verse six formats for that so
- 17:56that would generate a stall sort of
- 17:59throughout the game the first time we
- 18:00were using every shader so of course we
- 18:02did as has been done for a number of
- 18:05years we warmed up all the shaders for
- 18:08that
- 18:08so we first needed to gather all the
- 18:12different variants of every shader that
- 18:13was used throughout the entire game so
- 18:15we did that in in playthroughs before
- 18:18actually doing the build and then
- 18:21collecting those for the warm up and
- 18:24then rendering triangles and with no an
- 18:29off-screen render target and rendering
- 18:31triangles with all the variants of
- 18:32shaders to sort of show the the driver
- 18:35and all the variants of all the shaders
- 18:37that we we would come about um of course
- 18:40meant that we added some time to the the
- 18:42initial load time which was quite long
- 18:45on the first load one of the reasons was
- 18:47that the driver was converting from the
- 18:50mesosphere language into this
- 18:51intermediate representation fortunately
- 18:53you can generate that yourself so we
- 18:57ended up storing that on disk instead
- 18:59then loading that doing the warm-up and
- 19:02then we we didn't get any any sort of
- 19:05stalls during the game at least we only
- 19:08had this this overhead of initial or
- 19:11warm-up right so also a little bit of
- 19:15our about finding our visual errors are
- 19:18quite often that this is where porting
- 19:23work starts so idea box will represent
- 19:26themselves as performance issues or as
- 19:29visual books or both so what we do for
- 19:33that is that we have a an ulcerated
- 19:35screegit tool as well it takes a callus
- 19:38our proof Kelly's playthrough and then
- 19:41every couple meters it will note that
- 19:43and then do a screenshot dumb that's
- 19:45disk and then load a new place so that
- 19:47gives us the option of comparing between
- 19:53any you know any platform we can compare
- 19:56that to a platform that we think is
- 20:01correct so that's not actually that that
- 20:07easier thing to do so we have these two
- 20:09images we want to know what what the
- 20:10difference between them is so what we
- 20:12ended up doing on console was we kind of
- 20:14sort of loaded one and then flipped to
- 20:16the other one sort of went back and
- 20:18forth a couple times and we sort of see
- 20:20that this student the right that's
- 20:22disappearing of course with a full
- 20:25playthrough then ends up with a lot of
- 20:28time spent just comparing these things
- 20:31we kind of wanted to automate that as
- 20:32well
- 20:33the problem is that the game is only
- 20:35almost deterministic so we have some
- 20:38animation and Pascal's and even some
- 20:41characters in the game that are
- 20:43generated depending on the time that the
- 20:46game started so it's not it's not sort
- 20:51of fully deterministic so we kind of
- 20:52have to to handle that so what we do is
- 20:58that we have a set of reference images
- 21:00so for every pixel we have all the
- 21:02values that pixel can can be in in our
- 21:06reference images we then generate a
- 21:08bounding box around those and then that
- 21:11sort of gives us this was most inverse
- 21:15confidence map that will tell us which
- 21:17areas of the image will of this location
- 21:21will typically change the most when we
- 21:25then want to test our new platform we
- 21:27can then compare that to to these
- 21:29reference images we can do that by just
- 21:31calculating this through the bounding
- 21:33box of all these reference images that
- 21:37gives us a an error that looks like this
- 21:39where we can see the dude on the right
- 21:41is what's missing or there was those
- 21:43arrows there that's also quite a bit of
- 21:46noise in that image which we've spent a
- 21:49lot of time introducing inside they're
- 21:52not really conductive to actually
- 21:54finding the error so what we do is we
- 21:56medium Phillip and then we sort of sum
- 21:58the top ten errors in pixels and then
- 22:03then you set as the error of the image
- 22:06from the image it's one thing that the
- 22:09confidence map doesn't handle is sort of
- 22:13very large scale changes so as you can
- 22:16see here the the leaves are moving and
- 22:20that's kind of fine but we have all
- 22:21these dots which are particles are sort
- 22:24of moving around the image um so rather
- 22:26than have an infinite number of
- 22:29reference reference images and then
- 22:31ending up with dots everywhere and just
- 22:33all white which would mean that we
- 22:35couldn't actually check anything what we
- 22:36do is that we have an additional
- 22:39reference image we then compare that to
- 22:41the other reference images to sort of
- 22:43get a usual error in a specific spot so
- 22:46these particles will all have like a
- 22:50base error and we need to know that to
- 22:52compare a different platform to those
- 22:55alright so what we get from that then is
- 22:58it's it spits out a HTML page are sorted
- 23:03by error where we can see the error
- 23:06image and a reference image and the test
- 23:09image and then we can kind of open those
- 23:12in two different tabs and then go back
- 23:13and forth so that doesn't seem like much
- 23:15progress but at least now the salsa let
- 23:17me know which images to look at and it's
- 23:20it's far less than the 1,300 errors that
- 23:24that we had initially all right so of
- 23:27course there's some things it doesn't
- 23:29handle unfortunately there's some things
- 23:30it doesn't handle so for example if we
- 23:32have our figuring like light like this
- 23:35then the all the pixels within that
- 23:38light can essentially assume any R or
- 23:41any color or any intensity at least so
- 23:44it becomes pretty hard to actually go
- 23:46and find our errors within that region
- 23:48because any pixel value is valid all
- 23:55right so I'll talk a little bit about
- 23:56rendering because I can and you all
- 23:58y'all here so most of the optimization
- 24:02we did on the GPU side are not overly
- 24:06interesting sort of grunt grunt work
- 24:09optimization the one thing that that
- 24:12might be a bit interesting is that the
- 24:15mobile platforms it's health
- 24:17architecture I'm not going to go too
- 24:20much into that and what that means I'll
- 24:22just talk about what that meant for
- 24:24force with inside so primarily it meant
- 24:26that we had to switch render pass render
- 24:29targets less weight needed fewer render
- 24:32passes so switching render targets less
- 24:34often and then it's also required that
- 24:37for the tile you actually manage which
- 24:41basically and out of that tile issues
- 24:45which render targets so this is what our
- 24:48console pipeline look like the graphics
- 24:51pipeline so the first thing that we
- 24:53notice is that our the shadow maps and
- 24:56the lights are interleaved
- 24:58we did that so we only needed a single
- 25:00shadow map and with that then rendered
- 25:02slit render the light with that shadow
- 25:04map and and so on so forth so of course
- 25:07that then flushes the full light buffer
- 25:10in and out of tiles
- 25:13so instead pre-rendering the shadow maps
- 25:17that means that we yeah that we don't
- 25:21need to do that I'll be able to see that
- 25:22and the light buffers face our resident
- 25:26on tile our second thing of course is
- 25:28the cream volumetric pre-rendering
- 25:30that's also sort of wedged in between
- 25:33the final pass and the Seleucids pass
- 25:35both of them accessing the the back
- 25:37buffer so again just moving that before
- 25:39the final pass then means that the back
- 25:42buffer can stay rested them just during
- 25:44the final and translucency passes then
- 25:48of course there's the post effects that
- 25:50then change Brent the target 21 times
- 25:52because we're doing this bloom filter
- 25:54that's generating a mid map pyramid so
- 25:59fortunately those render targets are
- 26:02pretty small so bent with ysus it's not
- 26:04that bad there is an overhead on the
- 26:08driver side of route 2 and 1/2
- 26:10milliseconds on the on the CPU that
- 26:13would go away if we converted all the
- 26:15post effects passes to computer instead
- 26:18which which we probably should but there
- 26:22was nowhere to be overhead that we could
- 26:24see all right so the second thing sorry
- 26:32the second thing we needed to do was to
- 26:34actually set up all the what's called
- 26:36all the the loads and stalls for the the
- 26:42tile for every so we set it up on render
- 26:45parcels and we do that so that you sort
- 26:51of manually can control which what
- 26:54places like whether or not you actually
- 26:55need to load the data from a render
- 26:57target or and if you if you mainly set
- 26:59up whether you are you change it as you
- 27:02write it out to the whether you need to
- 27:04write it out to the render target
- 27:05afterwards as well um so yeah so
- 27:11so I suppose it's pretty obvious in a
- 27:17way so the lights all guess we'll start
- 27:21from start so the base pass generates a
- 27:23depth buffer and then the light pass
- 27:25will then render lights and check
- 27:27against that depth buffer so of course
- 27:29it doesn't actually modify the depth
- 27:31buffer just reads the data and checks
- 27:34like geometry against that and then
- 27:35writes to the Lightning buffer so
- 27:37there's no really no need to to write
- 27:40the depth buffer out again which it sort
- 27:42of would by by default same thing goes
- 27:45for the final pass and the transit pass
- 27:48they all just read from the depth buffer
- 27:50and do depth comparison but there are
- 27:51not actually modifying the depth buffer
- 27:53so again no need to write those out so
- 28:00uh the way actually check all these
- 28:03things is that you look in Xcode it has
- 28:05stats for that where you can see it's
- 28:07good things to sort of go go through all
- 28:09your render passes to see whether
- 28:11they're doing what you expect them to do
- 28:13if it's necessary to do all the loads
- 28:15and stores that are that they do you can
- 28:21also see all the load and stop and with
- 28:23and and look at that so after doing all
- 28:26the reshuffling of the passes and the
- 28:29low slow optimization we sort of have
- 28:31the load bandwidth and not quite half
- 28:35this the store bandwidth so what I say
- 28:38that actually means for the game well
- 28:40that means that we cannot get this this
- 28:43graph from the entire game which is sort
- 28:45of this is how we we sort of inspect the
- 28:48things we looked at in when like well
- 28:50this this parts kind of better on this
- 28:51back part is is worse um so all in all
- 28:55it looked better so fortunately my
- 28:57flight here was delayed so I had time to
- 28:59actually run some stats on it and we see
- 29:03that it did actually are sort of
- 29:06significantly improve or significant a
- 29:08couple of milliseconds
- 29:09around a couple milliseconds improvement
- 29:11and doing this work it's not too much
- 29:13work either so I say that that pays off
- 29:17okay
- 29:18so for one one interesting thing about
- 29:22releasing on mobile
- 29:24releasing a console game on mobile is
- 29:26that now your game is being played
- 29:28everywhere like rather than only on
- 29:31televisions it's actually being played
- 29:32in a bus or outside or elsewhere so one
- 29:37thing that we did was that we chose to
- 29:40brighten the entire game it's quite a
- 29:42dark game to begin with so we chose
- 29:46through to brighten entire thing up and
- 29:48we did that for a couple reasons like
- 29:50one was so the people could actually
- 29:52play it so that they could get the game
- 29:54bright enough to see what was going on
- 29:56then secondarily of course if you if you
- 30:00brighten the game then you don't have to
- 30:01increase the backlight brightness as
- 30:04much so you're also saving battery and
- 30:06finally because you're not increasing
- 30:08the backlight brightness as much then
- 30:11it's not generating as much heat so you
- 30:14then get better performance so it kind
- 30:17of makes sense to look at that in sort
- 30:19of a separate separate way and the way
- 30:21we the sort of the function we use to do
- 30:23that is the same that we used for
- 30:25in-game brightness which is just
- 30:29multiplying up the the color values and
- 30:31then doing this soft minimum with one
- 30:34which which has worked quite well for us
- 30:38then of course in the end we then just
- 30:40fit the final function with a polynomial
- 30:42polynomial so that it's it's as fast as
- 30:45we can sort of get it all right I'll
- 30:48talk a little bit about a an issue we
- 30:50had on the ship game which was this it
- 30:54was one of the few things that we didn't
- 30:57manage to fix for console hmm so yeah so
- 31:04this the struct side is obviously our
- 31:06aliasing horribly you see on the right
- 31:08that the temple and say guessing that we
- 31:10usually didn't fix that at all
- 31:12the reason for the the problem of course
- 31:17is under sampling and we're using
- 31:20uniform samples across we do
- 31:25rasterization so we're getting uniform
- 31:27samples of the truck side as well
- 31:35rasterizing host when we're doing the
- 31:37temporal anti-aliasing
- 31:38still use uniform samples we just get a
- 31:40lot of them which causes the temporal
- 31:45anti-aliasing to then not pick anything
- 31:48from the history buffer the reason why
- 31:51does this is that our temple
- 31:53anti-aliasing solutions solution uses
- 31:56this local neighborhood color clamping
- 31:59so it looks every pixel looks at its
- 32:01neighborhood and all values that are
- 32:03present in the neighborhood accepts it
- 32:08from from the history buffer of course
- 32:11if you look at on the left the pattern
- 32:13that's generally about the seventh
- 32:14assembling is quite wide so the local
- 32:17pixel neighborhood becomes almost
- 32:20uniform in color which means that we are
- 32:23not actually accepting anything from the
- 32:25history profile we just end up with with
- 32:27this under sampling these on the
- 32:30sampling artifacts so if we turn off the
- 32:32neighborhood clamping as in the middle
- 32:35then we can see that right it converges
- 32:37nicely but of course then if we start
- 32:40moving the picture around we get
- 32:42terrible ghosting so our solution to
- 32:45this of course then is to kill the
- 32:47sampling unfortunately that's not
- 32:49something that we can do with with
- 32:53breast isolation and the fixed-function
- 32:55rasterization so what we did then was to
- 33:00choose through rate race the truck side
- 33:03instead and sort of patch that up and
- 33:05render it afterwards that way we can
- 33:08always manually choose the array offset
- 33:12within a pixel and then and that that
- 33:16way did of the the samples that we do so
- 33:21I should mention that that we just like
- 33:24this is not integrated in the pipeline
- 33:26as such we're just regular rendering it
- 33:28afterwards and sort of manually putting
- 33:31all lights and decals and anything else
- 33:33that interacts with the truck side
- 33:35within the shader so it's it's not
- 33:37really a the most prettiest solution so
- 33:42in order to do this we manually modeled
- 33:47are the side of the truck
- 33:52the procedural planes so we first figure
- 33:56out what a groove
- 33:58we're in along the the truck side and
- 34:00then as we know that we the the t0 like
- 34:05the first intersection we can just get
- 34:06from the position on the truck side and
- 34:08then we can calculate the intersection
- 34:11with the bottom plane just by the ankle
- 34:14of the of the Ray that we we send out
- 34:20then we do for intersection with the
- 34:22sides of the grooves of the truck and
- 34:25then we can then figure out where we are
- 34:28hitting it so that results in something
- 34:32like this so in the middle you have the
- 34:34jittered version where we are ray
- 34:36tracing we're using the the procedural
- 34:38geometry for the truck side and then on
- 34:41the right as we're applying a simple
- 34:42anti-aliasing to that every pixel in its
- 34:46pixel neighborhood will see quite a lot
- 34:48of variance and then it will accept
- 34:51values again from the from the history
- 34:54buffer
- 34:55so one thing we noticed was that it
- 34:58wasn't actually aliasing in the
- 35:00y-direction so we could get away with
- 35:02only sort of multi sampling or
- 35:04horizontally so other than chittering
- 35:06we're also doing four samples to a sort
- 35:10of decrease our cost sorry to decrease
- 35:15our idea seing as much as possible but
- 35:19only horizontally then of course we
- 35:22don't need to calculate everything per
- 35:23sample so some of the things we are
- 35:25evaluating are ones like the projected
- 35:28light textures we are only evaluating
- 35:31those at the surface and then we're just
- 35:34reusing those between samples so one
- 35:38thing to note of course is that we
- 35:40didn't actually have to do all this
- 35:43through ray tracing we could have just
- 35:45used some text-based displacement method
- 35:48instead we just do this as we figured it
- 35:53was faster rather than doing sort of
- 35:55cheated samples in the displacement
- 35:58section many samples and it also turned
- 36:01out to be pretty fast we didn't actually
- 36:02implement a text-based version
- 36:05honestly can't say whether it was faster
- 36:07but it was fast enough for our use right
- 36:11so yeah it's only I suppose what are our
- 36:15main takeaways I guess was that this
- 36:20these are actually platforms that can
- 36:21run for quality console games we were
- 36:24kind of surprised by the speed of these
- 36:28these devices the the second thing thing
- 36:33is that it is really hard to actually
- 36:36profile on them and it it takes quite a
- 36:39lot of effort and it's been a great
- 36:41benefit for us to have the tools that
- 36:44were used also for consoles to sort of
- 36:48al-qaida's in the profiling for these
- 36:50platforms as well
- 36:51we found we used the screenshot or
- 36:54comparison tool quite a lot and actually
- 36:56making sure that all devices looked
- 36:58correct we would sort of do playthroughs
- 37:00and look at the game and look compared
- 37:03to console versions and say yeah like it
- 37:06looks looks about right and then we run
- 37:09a screenshot so and we would have like
- 37:1020 bucks that we didn't visually notice
- 37:14and of course the the tiles are
- 37:17rendering optimizations reasonably easy
- 37:21to approach so I think makes sense to
- 37:25spend time doing that I'd like to thank
- 37:29all these people who helped us out with
- 37:31the port and thanks to you guys for
- 37:34listening I hope some of this was a well
- 37:37made sense and maybe even some of it was
- 37:40interesting um if at any point during
- 37:43this presentation you thought I can do
- 37:45that better please do and yeah a lot
- 37:52more for questions if you have it thank
- 37:54you
- 37:55[Applause]
- 37:59so please come enough some questions -
- 38:03Myka McHale hi thank thanks you guys
- 38:16thanks for a great presentation
- 38:18did you actually test the optimizations
- 38:22and modifications you did back on
- 38:24consoles and other platforms so do these
- 38:27optimizations only work for iOS do they
- 38:30hurt the other platforms so we have no
- 38:34we haven't
- 38:34back ported are those so most of the
- 38:40optimizations that we did like all the
- 38:41grunt work that applies to all all the
- 38:44platforms pretty much we didn't test the
- 38:47child optimizations and I like the Xbox
- 38:50has also has like a all the embedded RAM
- 38:55that you're rendering - so there might
- 38:57be advantages and doing similar things
- 39:00there okay thank you
- 39:02suppose the difference there is that you
- 39:04can actually do it asynchronously like
- 39:06flush the yes ran back and forth yeah of
- 39:08course you need a little bit more memory
- 39:10for the shadow Maps and so mother yeah
- 39:12yeah okay thank you goes anything else
- 39:18yeah hi thank you for the talk so I have
- 39:28question about testing by Kyle so you
- 39:31how did you record it and then play it
- 39:34again on different devices and how did
- 39:38you set up all the devices you needed to
- 39:41play through tonight and then get
- 39:43results so yeah so so two things I
- 39:53suppose like the first is we we just
- 39:56record input and we also record position
- 39:59so we we play back the input are that at
- 40:03Kelly makes and then if we if he gets if
- 40:07it gets too far from
- 40:09the location that we recorded which over
- 40:11teleport the main character back to
- 40:12there so we're sure that it doesn't get
- 40:14too far off sync um even so for iOS we
- 40:19didn't actually do the automated
- 40:20playback at night we did that for all
- 40:22four consoles we did that manually we
- 40:25just start that manually on devices for
- 40:31testing or rather we had Kelly do it so
- 40:40when you are profiling on mobile devices
- 40:42have you had any performance drop downs
- 40:45just because you are profiling because
- 40:47you have to run development build some
- 40:49debug information all the statistics and
- 40:52screenshots it sounds like it will take
- 40:55quite a bit of CPU time we we're not
- 41:01seeing so I think we're streaming so
- 41:06it's not that much memory that we're
- 41:09using for just recording our CPU times
- 41:11and that sort of thing so I don't think
- 41:14our system are probably has some
- 41:18overhead but another thing we haven't
- 41:20noticed Innova it's pretty hard to
- 41:21actually notice that as well because we
- 41:23would then have to proof all that I
- 41:25suppose um one thing that we have
- 41:27noticed is that are attaching Xcode so
- 41:31the device makes a big difference so
- 41:33while we're doing these profiling is we
- 41:35[Music]
- 41:37deploy to the device then pH Xcode then
- 41:40run all the profiling that makes it
- 41:42significant difference so you never had
- 41:44situations like it runs just fine in
- 41:47release builds but runs slowly when
- 41:50surely so so we are so that for units it
- 41:55has two modes as the development mode
- 41:56and a master mode and we we kind of try
- 41:59to make the development build as like
- 42:01fast enough then we know that the master
- 42:03build is even faster so yes there's
- 42:06definitely difference between the final
- 42:08release and a development but generally
- 42:11what we see is that it's it's just
- 42:12uniformly faster mainly on the CPU side
- 42:16thanks
- 42:21[Music]
- 42:23hi I was wondering for the screen
- 42:26screenshot comparison things where did
- 42:30you consider or did you even try to like
- 42:34instead of just comparing like endframe
- 42:36screenshots 11-1 the full scene is
- 42:38composite and so on just like trying to
- 42:39compare intermediate render targets like
- 42:42gee buffers for instance they could also
- 42:44like reveal some some of the issues
- 42:46while significantly I guess
- 42:49significantly lowering the noise from
- 42:51introduced by you know further things
- 42:53down the render pipeline yeah would be a
- 42:55really good idea to also get make it
- 42:58easier to immediately figure out what
- 43:00the problem was I suppose so
- 43:03the advantage of this well the the the
- 43:06thing that this does is that it just
- 43:08tells us which parts of the game we
- 43:10should look into and I suppose what
- 43:12you're proposing would also help us in
- 43:14actually finding the error yeah yeah
- 43:17yeah that will be a brilliant extension
- 43:20to this what so what we usually do is we
- 43:23just figure out okay this area is broken
- 43:25and then we load up the game and to a an
- 43:29Xcode capture or something that was
- 43:31something simpler all right now thank
- 43:33you yes thanks cool um how much time do
- 43:44we have left we have three minutes left
- 43:47so yeah so let's thank you mica one more
- 43:51time and thank you very much I love you
- 43:54[Applause]
About this transcript
This page contains the full transcript of DD2018: Mikkel Gjol - Inside shipping on iOS by Digital Dragons, generated from the public captions YouTube serves with the video. The transcript has 6,762 words across 931 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to choose a caption track available on the video.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, caption language selection, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.