v 0.4.12 (LOD system and suspending advancement)


Because I run into some game design issues, I decided to focus now on some technical stuff to get my head clear. I was away for a week and the last week was also full of non-project related events, so I had plenty of time to think about the game.  I decided to implement LOD system.

As the problem is the performance on Quest, I focused on that and all images are of meshes used in Quest version.


LOD stands for Level Of Detail. Each visible mesh may have a number of such levels. The further it is from the camera/player, the less detailed mesh is rendered. Instead of creating one mesh per object/type of object, you just have to create three or more. Of course, there are tools that make it easier for you, some do it automatically with a little touch of a human hand.

That's how it works if you don't generate everything procedurally.

If you do, and that's a case with Tea For God, it's a bit different. Because you already generate stuff on the fly, by using different subdivision params and not generating bits that are too small, you get various LODs for free.

Well, almost.


Such an initial pass was easy to do and I had a LOD system working in a few hours. And then it turned out that some objects get simplified too soon, too much, for others such naive simplification doesn't work etc.

I countered that with hand-picked parameters per object type + adding separate sub generators for particular objects.

The elevators were the worst. Each cart could have 5k triangles (I am talking about Quest version, PC has 9k). I modified the basic generator and it went down to 2k. Added different sub generators for each LOD and in the end, the number of triangles for each consecutive LOD gets halved.


That was more of a proof of concept. When I will become happy with the gameplay (more on that in a separate post), I want to start working on actual content. Corridors, buildings, elevators, towers will change a lot.

Back to the LOD system. It started to work, right? But the generation time became longer as there were more meshes to be generated. And with as many characters as there were already in the game, CPU was full even without the generation. The game used to lag a lot just after a level had started. With open-world feature coming, this is unacceptable as the game will keep generating (and destroying) world around you. Having it lag every few seconds, dozen of seconds won't do.

My actual solution for that is a dynamic spawning system that creates enemies only in close vicinity. But what about items? They should remain where they are, right? And elevators, carts, turrets? Another system was required, to suspend objects that are far away from the player. I already implemented suspending of advancement. I just didn't use it. Adding a code to do so was much much easier than I thought it will be.


There was just one problem with that. There were almost no enemies around. Of course, I thought that the reason is that they get suspended and their advancement is not resumed when you get closer. It turned out I was wrong. The system was working very well. So well that it was suspending spawn managers. Spawn managers in Tea For God are sort of physical objects. They don't have a physical body but they are placed somewhere in the world. As they are really light, for time being I decided to make them not suspendable.

With a few other minor modifications, I managed to get CPU usage on Quest to level 2 (it was at level 4, meaning full power). GPU is mostly at level 4 still, sometimes drops to 3. There are still places the game lags. With procedural generation, it might be trickier to avoid those, as lag may happen only under particular conditions. The "turret bridge", the place with elevators and turrets, was such case (sometimes still is). I fought that my making the place a bit smaller.

There's still plenty of things that lag and that can be done but it already got better.

One more thing, there was a problem with fault handler for Quest, fixed that and I expect more bug reports start coming with this build.

Next is dynamic spawning system and then open world.

Files

v 0.4.12 (#216) 38 MB
Jul 07, 2020
v 0.4.12 (#216) - Oculus Quest APK 36 MB
Jul 07, 2020

Get Tea For God

Comments

Log in with itch.io to leave a comment.

Awesome, so cool to read about the way you are working around this problem. Tbh, as a quest player I've never fully realised any lag in tea for gods. With the only exceptions being the summary menu after completing a level and the hand tracking, but I'd just assume that just to be a problem with Oculus' integration.

(+1)

The framerate used to drop a lot. Now it's better but the game still runs at 90% of rendering size, I'd like to improve that too.

Menus will be changed in a few updates when I start changing the gameplay.