Progress on our game Wild’s Pyre is going well so far. After reading and design week the team is still pushing on and are closer than ever to seeing the completion of our project.
The team is now mostly focusing on polishing the game, including integrating new decorational assets into the game along with fixing any bugs, errors, and improving the performance of the game. For the last week, I was specifically in charge of finding ways to improve the game’s performance, and one of the interesting ways I did so was with the cubes that make up the grass, as most of the faces were not visible to the player.
the cube prefab is created using 8 vertices and 6 faces (or 12 tris) to create a cube. While not a lot, the player will only ever be able to see 3 of these faces, as the camera is locked to a specific angle. Next is what we have been calling a tile. A tile for us is 9 cubes arranged in a 3x3 square, and when combined these cubes are made 108 vertices and 54 faces (or 108 tris), of which only 15 faces will ever be seen in normal gameplay.
This is brought to a boiling point when using these in our game world, as we have created a 30x30 play area of cubes for one of our levels, which results in nearly 7 200 vertices and 5 400 faces (10 800 tris), and only 960 of the 5 400 faces will be visible to the player, which is a lot of resources to spend. Due to how the project depends on the individual objects and our own project’s time constraints, it would be extremely difficult to use a connected mesh like a terrain mesh or culling the unseen faces from rendering, so we had to think of a way to reduce the amount for faces shown.
My solution was to remake a cube using separate objects that acted as faces and to delete those objects when a certain condition is reached. For the new cube, I chose to build the faces out of quads and placed them on all sides of the cube except for the bottom, as there is no way the player can look up and would never see the missing face. Using a script that would run once when the scene starts up, I made each cube check its neighbor to see if there was another cube there, and if true then it will delete the face on the side the neighbor was on. This does cause a small bit of initial lag when the scene loads, but otherwise is successful in improving the game’s performance, as it now only computes 1 029 faces, of which 969 will be seen by the player, about an 80% reduction in the number of faces that are calculated. Due to this, I had also asked our artist to optimize our tree model that we use, as we could squeeze more performance by trimming the amount of faces we used.
As for what is next, I will be focusing on squashing as many known bugs within our game, along with helping the team with any last-minute features or recommendations they need.
Did you like this post? Tell us
Leave a comment
Log in with your itch.io account to leave a comment.