How to publish a VR game to Oculus without a nervous breakdown

We continue to share our first experience of developing a VR game Astro Collapse. In the previous articles, we talked about the main idea of ​​the game and game design .



This time we will tell you how to avoid our mistakes and publish the game faster. We only got it on the third try, because we got stuck on a technical check. We were unable to improve the performance of the game using only advice from the Oculus website. Therefore, we were looking for solutions ourselves. Read the article to the end so you don't mess with publishing your game to Oculus. Perhaps you can do it the first time.



VR gaming technical guidelines and key performance metrics



When you have completed the build, sign up for Oculus and upload the game to your account. In a few days you will receive a notification by email. This will be either a congratulation on the successful passing of the test, or a request to correct mistakes.



The first time we did not take into account all the recommendations from the Oculus website, so we got the following result:

image

Detailed report after the first Oculus check



We failed the performance test, we had a problem with the required return to the Oculus Home menu and the game did not install on older versions of Android.



To pass the performance test, you need to follow these guidelines:



  • FPS in the game must be at least 60;
  • from 50 to 100 calls to draw per frame (Call Draw);
  • 1-3 milliseconds to execute scripts;
  • from 50,000 to 100,000 polygons per frame.


Let's figure out the concepts first, and then I'll show you how we solved our performance issues.



FPS or frames per second



The key indicator of high performance is high FPS. It shows the frame rate per second: the game has a loop that draws the game world and performs mathematical operations in scripts. The higher the delay between these frames, the lower the metric and the performance.

With the help of FPS, you can understand if everything is in order with the game.




Draw Call indicator



Draw Call - The number of texture calls the game engine sends to the GPU to draw the world. To reduce the number of calls, the engine needs to combine textures into one material. This technique is called batching.

The higher the Draw Call indicator, the longer it takes to draw the game world.


Scripts and their execution speed



Scripts are responsible for any actions and operations in the game. You need handlers to execute them. For example, Update. It has to process every frame. If the game has a lot of objects and complex actions on them, then this handler does not have time to complete the frame. Therefore, performance is low and the game freezes.

Many time-consuming operations in Update make it difficult to perform actions on objects.


Polygons per frame



Polygons are triangles that make up 3D game models. They are made up of vertices and planes. Polygons per frame is the product of the number of all objects in the game world and these triangles.

The higher this number, the longer the game engine will process one frame.


How we solved performance issues



We had 4 main issues that were causing the game's performance to fall short of the recommended values. We made too detailed 3D objects, encountered a high Draw Call rate, scripts were slow, and the device memory was overloaded. We spent the most time looking for solutions to these shortcomings. And now about everything in order.



Simplifying 3D objects and lowering polygons per frame



There are many asteroids and ships in our game that are constantly moving and overload the game. During the battle, the player does not have time to consider them and pay attention to the details, because he is keen on the process. If you reduce the number of asteroids, then the game will become boring and uninteresting. Therefore, we decided to simplify the three-dimensional models of asteroids and shuttles: we reduced the total number of polygons in the game scene.



image

Space shuttle polygons from Astro Collapse game



Determine what is important in your game: detailing small objects or a large game world. You will understand which object models do not need to be detailed, which will help improve performance.


We combine textures into atlases and achieve the recommended Draw Call indicator



In Astro Collapse, the game world is created from asteroids, shuttles, warships, the Earth and the Sun. There are a lot of objects in the game - the Draw Call indicator was high, so the engine slowed down the rendering of graphics. To reduce it, you need to combine different textures of objects into one atlas.

image

Atlas of asteroids in the Astro Collapse game



We have made 4 large atlases of textures: for the asteroid, cockpit and cannons, the sight interface, and the game menu. These are objects that consisted of many similar materials. Atlases simplified the engine's work, because it no longer needed to collect different textures into one object - we did it for it.

Collect the materials of the objects into an atlas - one large texture.


Reducing script execution time



Any action in the game takes place using scripts. Astro Collapse has a lot of game objects and complex operations on them, so some of the scripts were executed for a long time - the Update handler delayed the completion of the frame. This slowed down game processes.



Therefore, we had to take out complex operations from the frame-by-frame update. We used a co-routine that can perform such operations on objects outside the frame.



This is how we were able to optimize complex asteroid operations. There are many such objects in Astro Collapse: each asteroid needs to be checked for activity, track its location in space and add it to the list. The list itself needs to be updated in order to bring new asteroids into the game, calculate their distance to the player, shuttles, and neighboring warships. The result is a long-running loop for a frame that the Update handler couldn't handle. And with the help of coroutine, the engine took this complex operation out of the frame-by-frame update and increased performance.

The co-routine handler performs complex operations outside of frame-by-frame updates, which simplifies the work of the game engine.


Protecting the device memory from garbage and making an asteroid pool



Astro Collapse has a lot of asteroids. They constantly appear, they need to be destroyed. The standard constructors in the script Instantiate and Destroy fail by performing these operations. They create garbage in the device's memory, causing the game to freeze. So we did it differently.



Downed asteroids are not destroyed, but hide in the game space. When a new object is required, the script calls it from the hidden ones. This method is called pooling.



Before loading the game world, the script creates several dozen asteroids. If they all fly in space at the same time and they are not in memory, then he produces a new asteroid and adds it to the list. This gave us a flexible asteroid control model and improved game performance.

Use the pooling method for objects of the same type, which are often created and destroyed, but in the game itself there are not many of them at the same time.


Minor bugs after technical check



Post-processing of models in the game: disable anti-aliasing



Antialiasing - post-processing of an image by smoothing jagged edges. Antialiasing was set by default in Astro Collapse. It overloaded the game, and there was still no noticeable anti-aliasing in the game - the resolution in the Gear VR helmet is low. Therefore, we turned it off. During testing, the players did not notice any changes, but the performance became higher.

Anti-aliasing does not produce anti-aliased images at low resolutions on the Gear VR.


Spectacular explosions from sprites



To make bright explosions, we used sprites. This is an explosion picture that changes its size, transparency and color from red-orange to black. In this way, we managed to keep the explosion dynamic and improve the game performance without using complex systems of many individual particles and animation.



Destroyed asteroid in Astro Collapse



Spectacular explosions can be done with sprites.


No shadows needed



We turned off shadows because the game is always in motion - you can't see them. In addition, we did not have large objects on which to cast a shadow.

Disable shadows for secondary game objects that are insignificant for the players.


Problem with required return to Oculus Home menu



The back button on the helmet should return the player to Oculus Home, not to the game menu, as was the case in Astro Collapse. To fix this problem, I took a ready -made Oculus plugin script and applied it in the game.

Use the OVRPlatformMenu.cs script for the menu back button to work properly.


Eliminating a bug with installing the game on older versions of Android





A flaw in the installation is easy to solve. You need to specify the older supported Android version in the project setup.

Do not forget to specify the minimum required Android 4.1 API level in the game settings.


Results after the game was published



We fixed our shortcomings and sent the game for review for the third time. The answer was positive - the game was published a week later:

image

Congratulations from Maria from Oculus technical support with a message about the date of publication of the game



2 weeks after the publication, Astro Collapse was downloaded more than 7000 times. For VR games on the Gear VR platform, this is an excellent result: it entered the top 50 free games and ranked 24th on the list.



Tips for publishing a game to Oculus



There are a few rules to follow to avoid our issues when publishing your game to the Oculus Store:

  • Check out the recommendations and the most common issues on the official Oculus website before uploading a game.
  • Think about improving performance from the very beginning of development, so as not to redo the entire game in the final stage.
  • Don't complicate the graphics in the game by detailing all objects, lots of textures or shadows. It will run on mobile phones and have limited specifications. Think about what can be removed without losing the quality of the game.
  • Contact Oculus technical support. They will quickly answer and help.
  • Remember that improving the performance of each game requires an individual developer approach. You will not find a universal solution to the problem.




Check out our tips to help you get verified on Oculus faster.



Play Astro Collapse game and appreciate the graphics. To do this, you will need Samsung Gear VR glasses. They work with smartphones: Samsung Galaxy Note 4, 5, 7, S6 / S6 Edge / S6 Edge +, S7 / S7 Edge, S8 / S8 +.



Successful developments!



All Articles