You see, each day I had a budget of a few hours for too many tasks… So I prioritized them accordingly. I didn’t know yet, but this kiddo had intuitively developed and applied the concept of time slicing. On Wednesdays, I did the ironing and played videogames. On Tuesdays, I mopped the floor and played videogames. On Mondays I’d sweep the floor and play videogames. So I prioritized my tasks and split the work across several days. I knew I couldn’t get it all done every day. I was supposed to clean the dishes, throw the garbage, take care of the dishwasher and laundry, to mop and sweep the floor… Everything had to be done daily, of course.Īnd as I kid I was, I naturally had a tendency to rebel against this unjust oppression against my freedom. But just in case, I’ll share an analogy that I like with you.Īs a kid, I was always told to keep the house clean. If you read my story, you might have a vague idea about the meaning of Unity CPU Time Slicing. Unity CPU Slicing: Setup Unity Performance: What’s CPU Time Slicing? Even Unity crashed (but that was nothing new). As soon as I went into gameplay I saw the game breaking into pieces from 8 different angles. Within an hour I implemented a prototype to split the execution of my logic into these two groups. And then I just had to repeat the cycle to literally halve the per-frame CPU cost of my scripts. The idea was simple: to execute the logic of Group Alpha in frame 1 and the logic of Group Beta in frame 2. I moved them around with one goal in mind: to make each group take about the same time to execute, i.e. Script groups in sight, I then re-arranged the scripts into two new separate groups that I called Group Alpha and Group Beta. Probably not, but I had fun doing it… and it helped me with the next step. Final bosses: massive monster scripts you wouldn’t want to mess with.Serious troublemakers: about ten scripts, each taking an average of 0.1 millisecond per frame. ![]() The name comes from the deadly 1000 Needles attack from Cactuar in Final Fantasy, each needle making just 1 point of damage. Cactuar group: thousands of inexpensive scripts that, when combined, created a terrifying panorama.Then I divided the gameplay functions into three groups: I quickly stood up from my seat, grabbed a sugarless double espresso and went straight to the drawing board.Īt the drawing board, I started by making an inventory of all the expensive gameplay functions (funny how code that stole milliseconds from a CPU would steal hours from my sleep in the previous months). So I asked myself: what if I run the logic at lower framerate? In fact, physics already execute at a different pace. I opened my notebook and started an unusual brainstorming session that would end up with a crazy idea.Īs I re-read the Oculus Quest guidelines, I saw that indeed I had to render the game at 72 FPS.īut this is the key I realized back at that point: rendering at 72 FPS doesn’t mean you must execute everything at 72 FPS. If you know me, you can probably guess what I would do in these type of situations… I had just a few weeks left and I didn’t have any idea on how to approach the situation… and I knew the traditional wisdom of “ profile game, optimize script, repeat” wouldn’t get me there in time. And the whole game logic was already pretty well optimized and partly multithreaded. Physics were also very optimized for this type of game. That was really a big problem considering the optimization speed I dropped to.ĭraw calls were fine. … And I still had 3 milliseconds to go with little time left. But after careful examination, that optimization only got me 0.3 ms ahead but stole about 3 days of my budget. I remember how excited I got when I jobified the audio system we used to update 200+ audio sources. ![]() I was used to gaining whole milliseconds within single days, but my speed dropped to the painful figures of 0.1-millisecond gains per day - if lucky. However, by the middle of the project… I wasn’t that confident anymore.Īfter optimizing all the low-hanging fruits, the CPU performance gains were becoming much rarer. ![]() And those days brought me closer to my objective relatively fast. Days where I saved a whole millisecond were kind of common. Weeks passed by optimizing every single aspect of the game I could think of. After all, I had done huge mobile optimizations in the past. If you’re a veteran, you know that doesn’t really give you much room for fancy 3d graphics and complex gameplay.Īnd 13 milliseconds was a very distant goal from the 40+ milliseconds I started with.Īt the beginning of the project, I was confident I’d pull it off. So I had a few months to make the rendering of each frame take less than 13 milliseconds. It was a daunting task for many reasons… and performance was surely the toughest objective to accomplish. I was in charge of porting a high-demanding PC/PS4 VR title to Oculus Quest, a mobile VR platform.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |