So the other day I asked the great community of Reddit for help and advice on where I should go next in terms of optimisation for my current project; Project Dandelion.
If you want to try the current build, click the link below and install the Unity web player:
https://dl.dropboxusercontent.com/u/55177814/project%20dandelion.html
I do apologise on the quality of the current build. There are 2 different types of level to be generated, one with trees and one a open field, but due to the frequency of the instantiating, it may take you a while to see both levels. Everything also needs to be tweaked, so try not to hit the booster too many times. The one great thing about this build though is that most of the core mechanics are there and working, they just need to be tweaked and expanded upon, so bare with me as I continue to progress in the making of this game.
So just to explain whats currently going on in the scene:
- I have a player (the cylinder) that constantly moves forward in the world and consistently moves down using gravity. The players model rotates left and right when the player moves left or right. I at first was only going to play an animation making the player rotate, but this wouldn’t rotate the model, and would screw up any collision detection made by the player.
- When a player collides with the white boxes, the gravity variable is increased to 20, meaning the player moves up 20 metres. This very quickly runs back down to -0.5 as the update function is called every frame, and every frame the gravity is made sure to be pushed back down to -0.5. These are all variables that can be adjusted in the future to make sure the feel of my game is spot on. (The white blocks are randomly generated across the scene, and are generated 3 metres below the player so that in the 3 seconds it takes to reach one, the player has descended that amount to hit them.)
- In order for the world to generate, I have a separate gameObject that rushes off ahead of the player and generates the level piece by piece. This was fine in testing, but as I incorporate better 3d models in the future, I worry the performance of the game will be affected due to too much being rendered at once.
It was the last point I was worried about and decided to ask the question to fellow redactors about whether I was heading in the right direction or not.
The overwhelming feedback was that I should keep the player stationary, and instead get the level itself to move backwards to give the illusion of moving forwards. Now I had this idea a while back, but decided it was silly and would be too taxing on the system, but something clicked in my mind when most people agreed this is what I should be doing: By having my objects forever instantiate at a certain distance away from the player, I would only ever have to worry about 4-5 objects max, meaning no need to worry about performance!
I’m currently in the process of making this work, but I’m certainly glad I reached out to the community for this feedback, it’s fantastic and hopefully is a step in the right direction for my game.