Honing Performance
Honing Performance
[youtube]I860nYbCVyk[/youtube]
https://youtu.be/I860nYbCVyk
It’s one thing to make a big, complicated eco-simulation game like WolfQuest 3. It’s another thing to make it run fast enough to play smoothly on a wide range of computers. So lately, we’ve been spending time on optimization: analyzing the performance (speed) of each element of code and graphics and figuring out ways to make it perform better. This week we’ll look at three things we’ve been optimizing.
Games use both the CPU (Central Processing Unit) and GPU (Graphics Processing Unit), and using Unity’s built-in Profiler, we can analyze the load on both CPU and GPU in great detail. Here are a few things our team has been doing, as explained by two of our amazing developers, Tommi and Nick, and then myself, Dave/loboLoco.
Tommi on Animals
For the last couple of weeks I've been neck deep in Unity's Profiler feature, which breaks down what's happening in the game frame-by-frame, operation-by-operation (broadly speaking). The main issue has been the spikes caused by spawning animals as you get close to the flocks. So far, I've been prioritizing the ease of editing the animals over the speed of spawning, so there was a lot of expensive calls that add new scripts onto them every time they spawn etc. (so I don't have to manually edit every type of animal every time I add or remove scripts). But now I employed the following strategies to reduce the time (without making editing too much harder):
1) Pooling: This means that whenever an animal is despawned, we don't destroy it but instead hide it and put it in a "pool" from where it can be reactivated later. This is much quicker than creating a whole new animal. We can also create a few animals into the pool during the initial load so even the first spawns will be quicker.
2) Baking: I created a system that automatically adds all those different scripts on the animal in the editor so they don't have to be added during the game. This is a bit risky since if the system has a bug the animal setup may get out of alignment when I later make changes, but I'm reasonably confident it's all solid.
3) Plain old optimizing: There were a few places where I was doing unnecessary calculations, or where shortcuts could be created.
In addition to these spikes, I've also been trimming the CPU consumption that happens every frame. The main suspects here have been floating scents and animal AI / physics. This mainly involves:
1) Considering if we really need to do a thing.
2) Considering if we really need to do a thing every frame.
3) If we need to do something frequently, try to at least spread that burden even over different frames to avoid spikes.
It's been a challenge trimming the CPU cycles, while keeping all the cool things we want to do and also not making the codebase full of shortcuts and hacks, as that can create new bugs. But it's coming along, step by step…
Nick on Pathfinding
With Wolfquest 3.0's greatly increased map size comes new technical challenges, one of which was Pathfinding (wayfinding): the system that allows our animals to move through the landscape in a believable manner. More obstacles to avoid means more computation, which means we had to develop whole new techniques to speed up the process and keep the frame rate high.
To this effect, we developed a new system of pathfinding. It is similar, in theory, to the 'Level of Detail' Systems used by our rendering pipeline to allow the highly granular (and computationally intensive) obstacle avoidance near the animal, and high level "Fuzzy" Path Generation that is done much more cheaply.
To give an example, let's say the highest detail map in this system has 30,000 Nodes. That means the computer has to search across all of those nodes multiple times to discover the most correct path from point A to point B. 30,000 isn't that much to a computer but if it has to do this maybe 100 times, suddenly that 30,000 Nodes becomes 3,000,000 Nodes…quite a bit larger! So, instead of searching those 30,000 Nodes, we can instead use a lower level of detail. Let's say the next map down only has 5,000 Nodes. Then, if we have to do that 100 times, we're only looking at 50,000 nodes.
For long distance pathfinding, we use a lower level of detail, and only use the highest level when we need to pathfind a very short distance, perhaps as short as 100 meters or so. This means more computational power can be devoted to rendering gorgeous landscapes, and less to more invisible gameplay functions.
Dave on Graphics
With the original version of WolfQuest, and again for WQ 2.7, we developed the graphics to run decently (30 fps) on a mid-range computer. That made optimization relatively easy, but it also limited how good the graphics could be on more powerful gaming computers. For WQ3, we’ve been focused on creating the most realistic and immersive 3D environment that we can, using a Windows gaming computer with Nvidia 1060 GPU as our development rigs. So now we have to find ways to optimize the graphics to run on weaker computers, and as necessary, reduce the fidelity of the graphics for lower quality levels. We’re using some state-of-the-art tools for terrain and vegetation rendering, but even so, the dense forests of Yellowstone pose major challenges for optimization. Unlike most games, we can’t design our forests with performance in mind. Further complicating the challenge is the fact that we’ve got a dynamic day/night cycle, which means we can’t “bake” the lighting and shadows into textures, which gives a huge performance boost. Instead, the game has to render shadows on every frame, since the sun moves slightly from one frame to the next. So we have our work cut out for us. We’ve been making progress, but it’s too soon to say what the final system requirements will be for computers and mobile devices.
_________
WolfQuest is available for Mac, Windows, iPhone, iPad, Android & Kindle. So yes, WolfQuest 3 will be available for mobile phones and tablets...at least some of them, and/or in some form. Bigger maps and more animals may be too much for mobile devices with limited RAM memory. We'll do our best, but there's a good chance that some mobile devices won't be able to get it, and/or we will have a simpler version of it for some mobile devices.
For the PC/Mac version, our goal is any computer that can run the current game can run WolfQuest: Anniversary Edition. We are adding more quality levels so we can boost the visual quality much further than it is now, but we will do our very best to make the game run decently on older computers. However, since we are adding so much to the game (bigger maps, better graphics, more animals), we can’t yet say how well we can attain this goal. We don’t know exactly how much storage WolfQuest: Anniversary Edition will require, but probably about 5 GB.
https://youtu.be/I860nYbCVyk
It’s one thing to make a big, complicated eco-simulation game like WolfQuest 3. It’s another thing to make it run fast enough to play smoothly on a wide range of computers. So lately, we’ve been spending time on optimization: analyzing the performance (speed) of each element of code and graphics and figuring out ways to make it perform better. This week we’ll look at three things we’ve been optimizing.
Games use both the CPU (Central Processing Unit) and GPU (Graphics Processing Unit), and using Unity’s built-in Profiler, we can analyze the load on both CPU and GPU in great detail. Here are a few things our team has been doing, as explained by two of our amazing developers, Tommi and Nick, and then myself, Dave/loboLoco.
Tommi on Animals
For the last couple of weeks I've been neck deep in Unity's Profiler feature, which breaks down what's happening in the game frame-by-frame, operation-by-operation (broadly speaking). The main issue has been the spikes caused by spawning animals as you get close to the flocks. So far, I've been prioritizing the ease of editing the animals over the speed of spawning, so there was a lot of expensive calls that add new scripts onto them every time they spawn etc. (so I don't have to manually edit every type of animal every time I add or remove scripts). But now I employed the following strategies to reduce the time (without making editing too much harder):
1) Pooling: This means that whenever an animal is despawned, we don't destroy it but instead hide it and put it in a "pool" from where it can be reactivated later. This is much quicker than creating a whole new animal. We can also create a few animals into the pool during the initial load so even the first spawns will be quicker.
2) Baking: I created a system that automatically adds all those different scripts on the animal in the editor so they don't have to be added during the game. This is a bit risky since if the system has a bug the animal setup may get out of alignment when I later make changes, but I'm reasonably confident it's all solid.
3) Plain old optimizing: There were a few places where I was doing unnecessary calculations, or where shortcuts could be created.
In addition to these spikes, I've also been trimming the CPU consumption that happens every frame. The main suspects here have been floating scents and animal AI / physics. This mainly involves:
1) Considering if we really need to do a thing.
2) Considering if we really need to do a thing every frame.
3) If we need to do something frequently, try to at least spread that burden even over different frames to avoid spikes.
It's been a challenge trimming the CPU cycles, while keeping all the cool things we want to do and also not making the codebase full of shortcuts and hacks, as that can create new bugs. But it's coming along, step by step…
Nick on Pathfinding
With Wolfquest 3.0's greatly increased map size comes new technical challenges, one of which was Pathfinding (wayfinding): the system that allows our animals to move through the landscape in a believable manner. More obstacles to avoid means more computation, which means we had to develop whole new techniques to speed up the process and keep the frame rate high.
To this effect, we developed a new system of pathfinding. It is similar, in theory, to the 'Level of Detail' Systems used by our rendering pipeline to allow the highly granular (and computationally intensive) obstacle avoidance near the animal, and high level "Fuzzy" Path Generation that is done much more cheaply.
To give an example, let's say the highest detail map in this system has 30,000 Nodes. That means the computer has to search across all of those nodes multiple times to discover the most correct path from point A to point B. 30,000 isn't that much to a computer but if it has to do this maybe 100 times, suddenly that 30,000 Nodes becomes 3,000,000 Nodes…quite a bit larger! So, instead of searching those 30,000 Nodes, we can instead use a lower level of detail. Let's say the next map down only has 5,000 Nodes. Then, if we have to do that 100 times, we're only looking at 50,000 nodes.
For long distance pathfinding, we use a lower level of detail, and only use the highest level when we need to pathfind a very short distance, perhaps as short as 100 meters or so. This means more computational power can be devoted to rendering gorgeous landscapes, and less to more invisible gameplay functions.
Dave on Graphics
With the original version of WolfQuest, and again for WQ 2.7, we developed the graphics to run decently (30 fps) on a mid-range computer. That made optimization relatively easy, but it also limited how good the graphics could be on more powerful gaming computers. For WQ3, we’ve been focused on creating the most realistic and immersive 3D environment that we can, using a Windows gaming computer with Nvidia 1060 GPU as our development rigs. So now we have to find ways to optimize the graphics to run on weaker computers, and as necessary, reduce the fidelity of the graphics for lower quality levels. We’re using some state-of-the-art tools for terrain and vegetation rendering, but even so, the dense forests of Yellowstone pose major challenges for optimization. Unlike most games, we can’t design our forests with performance in mind. Further complicating the challenge is the fact that we’ve got a dynamic day/night cycle, which means we can’t “bake” the lighting and shadows into textures, which gives a huge performance boost. Instead, the game has to render shadows on every frame, since the sun moves slightly from one frame to the next. So we have our work cut out for us. We’ve been making progress, but it’s too soon to say what the final system requirements will be for computers and mobile devices.
_________
WolfQuest is available for Mac, Windows, iPhone, iPad, Android & Kindle. So yes, WolfQuest 3 will be available for mobile phones and tablets...at least some of them, and/or in some form. Bigger maps and more animals may be too much for mobile devices with limited RAM memory. We'll do our best, but there's a good chance that some mobile devices won't be able to get it, and/or we will have a simpler version of it for some mobile devices.
For the PC/Mac version, our goal is any computer that can run the current game can run WolfQuest: Anniversary Edition. We are adding more quality levels so we can boost the visual quality much further than it is now, but we will do our very best to make the game run decently on older computers. However, since we are adding so much to the game (bigger maps, better graphics, more animals), we can’t yet say how well we can attain this goal. We don’t know exactly how much storage WolfQuest: Anniversary Edition will require, but probably about 5 GB.
Dave/loboLoco
WolfQuest Game Producer
WolfQuest Game Producer
- poncho0287
- Pup
- Posts: 49
- Joined: Wed Jan 24, 2018 9:13 pm
- Gender: Female
- Location: Arizona
Re: Honing Performance
Question will WolfQuest 3 work on my IPad? It's the new one and I've just updated it so it's now version 12.1.4. When you said WolfQuest 3 will work on some mobile devices I was like oh crud does my dad have to get me a new device?
Re: Honing Performance
I think this was a very interesting blog post. By what I see wolfquest3 is getting close to being ready to be release all you need to do is refine it and add little things here and there. Keep up the good work.
- Rhaena
- Newborn Wolf
- Posts: 7
- Joined: Mon Oct 09, 2017 11:29 am
- Name: Quinn
- Gender: Female
- Location: The subconcious
Re: Honing Performance
Will WQ3 still be playable on computers and laptops with a lower GB/RAM? I just want to clarify. For example and unfortunately, my laptop only holds up to 4GB, rather than the 5GB speculated.
Unfortunately, I won’t be able to get a new device any time soon. Regardless I’m super excited to see WQ3 become playable when possible, and if anybody has any tips on upping the GB/RAM of a HP laptop I’d be more than happy to hear them.
((Apologies if the video specifies this more than the blog post itself, haven’t had the chance to watch and likely won’t for a while))
Unfortunately, I won’t be able to get a new device any time soon. Regardless I’m super excited to see WQ3 become playable when possible, and if anybody has any tips on upping the GB/RAM of a HP laptop I’d be more than happy to hear them.
((Apologies if the video specifies this more than the blog post itself, haven’t had the chance to watch and likely won’t for a while))
- Loach
- Former User of the Month
- Posts: 112
- Joined: Sat Jan 14, 2017 6:47 am
- Name: Jess
- Gender: Nonbinary
- Location: Michigan
- Contact:
Re: Honing Performance
I was waiting for this kind of blog post but I didn't think it'd be this soon. It's really interesting just how much goes into optimizing things. I hear about it a lot but it's never really gone into detail
My laptop runs 2.7 best on 'Good' so I'm definitely expecting to have to upgrade depending on how the requirements go. Even if a lower setting can run fine I really wanna experience wq3 at it's most pretty.
Thats a really cool trick for the wayfinding! I really like that system, it's cool that there's so much that can be done with it.
My laptop runs 2.7 best on 'Good' so I'm definitely expecting to have to upgrade depending on how the requirements go. Even if a lower setting can run fine I really wanna experience wq3 at it's most pretty.
Thats a really cool trick for the wayfinding! I really like that system, it's cool that there's so much that can be done with it.
- Phasoli
- Sub-adult Wolf
- Posts: 664
- Joined: Sat Jun 20, 2015 5:23 pm
- Name: EMK
- Gender: Gender neutral
- Location: Photosynthesizing with the beans in the backyard
- Contact:
Re: Honing Performance
This game has come such a long way in terms of it's graphical quality. I really do hope that I'll be able to run it on my iMac. I suppose that I'll just have to test the current game and judge based on how well it performs. I'm loving the huge attention to detail that was put into this game.
Re: Honing Performance
It looks like it is finished soon, but fixing and optimizing can take a lot of time.
Hopefully it will be ready soon
Hopefully it will be ready soon
- alebrije
- Yearling
- Posts: 476
- Joined: Sat Jan 09, 2010 12:17 pm
- Gender: Female
- Location: Missouri
- Contact:
Re: Honing Performance
I always run the game on the “Good” setting as to not create lag on my older generation laptop, but with the update, I am eager to test the update on my next day off. I’m quite happy to see that the improvements are happening so quick, good work Dave!
Re: Honing Performance
I play with all the best settings possible, 60 frames per second, graphics on Fantastic, shadows, (no alternate water reflection, though, because I can't gauge how deep it is) and the computer's fine.
And,
I loved watching the shadows move over the bushes and over the wolf and back and over and back again. It was so smooth, and it moved like an actual tree ;-; so prettyyyyyy
I also liked seeing all the different versions of WQ, how it's grown, and what it's going to turn into. Now the elk herds are huge! (At least to WQers haha, before, they were pretty chibi ;3) I can't wait to be a crazy WQer again and hunt down the entire elk herd while the game plays 50-60 frames per second as I do it XD
Thank you, Dave!!!
And,
I loved watching the shadows move over the bushes and over the wolf and back and over and back again. It was so smooth, and it moved like an actual tree ;-; so prettyyyyyy
I also liked seeing all the different versions of WQ, how it's grown, and what it's going to turn into. Now the elk herds are huge! (At least to WQers haha, before, they were pretty chibi ;3) I can't wait to be a crazy WQer again and hunt down the entire elk herd while the game plays 50-60 frames per second as I do it XD
Thank you, Dave!!!
Re: Honing Performance
Wow you guys are getting so close! I like how you keep every possible playable version, such as pc, mobile, ect. and how fast the game might run! It looks awesome!
-StarBender2000
-StarBender2000
- WolfDragonPlasma
- Pup
- Posts: 37
- Joined: Sat Sep 05, 2015 8:42 pm
Re: Honing Performance
Ah, looks like we're reaching the final stages of development for Episode 1 of WQ3! So excited to be able to run around the new map and see all there is to see!
It's definitely reassuring to hear that you're doing your best to make sure the game runs as smoothly as possible on weaker computers because, as beautiful and realistic as the graphics are, such beauty and realism can make for a really impossible-to-play game; I can already tell you that my old laptop (who couldn't run Amethyst Mountain above Fast nor Slough Creek even on Fast) would take one look at this game, and then would promptly keel over and die simply because of how detailed it is.
And even with my current laptop (an Asus with an i7 6700HQ CPU and a Nvidia GTX 960 graphics card), I'm always worrying if it'll be strong enough for a game as beautiful as WQ3 has become XD
It's definitely reassuring to hear that you're doing your best to make sure the game runs as smoothly as possible on weaker computers because, as beautiful and realistic as the graphics are, such beauty and realism can make for a really impossible-to-play game; I can already tell you that my old laptop (who couldn't run Amethyst Mountain above Fast nor Slough Creek even on Fast) would take one look at this game, and then would promptly keel over and die simply because of how detailed it is.
And even with my current laptop (an Asus with an i7 6700HQ CPU and a Nvidia GTX 960 graphics card), I'm always worrying if it'll be strong enough for a game as beautiful as WQ3 has become XD
Re: Honing Performance
I am so glad you're working on the performance too. I don't know much about this stuff, but I have always thought that it is weird my old faithful laptop runs other "detailed" games smoothly but not WolfQuest. So yeah while amazed of how beautiful the game looks in the videos, it makes me worried that it will require a new computer - but maybe it is about time I got a new one anyway hahaha...
Re: Honing Performance
It looks great! I'm glad the lag is going to be fixed and that you're putting so much time into its being accessible. It looks like you're almost done with it, if you're working on performance now and details like that. Thank you!