Sunday, 21 February 2016

Skyship Aurora Make it huge




One of the special thing about Skyship Aurora - huge size. I mean ship really big and terrain is huge, you fly at 7km altitude . Of course Unity is mostly madden for middle size games like FPS, racer games, 2d platformers. We don't want to scale down whole game like most people do when they making space games with actual not realistic size, multiplied by 0.01. In such scaled world people feel difference specially if game use real physics like Aurora do. Also camera perspective correction make toy effect. So just do it as is.

First big problem was terrain. Huge large scale terrain was a big performance problem of the game. We tried to use repeated built-in terrain to cover the ground, because at 7 km you see really a lot of the things. Anyway it adds about 400 draw calls that was not awesome, also it looks blurry and repeatedly. Solution was to use mesh terrains with a high detailed texture and global normal map. At least it was much more faster and not blurry.

Problem was there is no repeated terrain on the market to use, so combining them together looks with seems and wrong lighting. Also we don't understand how it should looks like ( scale ) at 7km, so result work was also unrealistic. The cool solution is to use real satellite images and heightmap data. We got understand that at 7km altitude visual look of terrain is much more depends on texture, but not the heightmap.

Second problem was a speed. It is about 1200km per/hour ship movement. Also ship was a real rigidbody that moved by adding force to it. Camera moved with the ship. We noticed some glitches and spent some time discovering what was wrong. Some code was not in FixedUpdate and also we used interpolations on some physics objects. So turn off interpolation because we can't synchronize time for different interpolated physics bodies, and move every things into FixedUpdate. At low speed you sometimes will never notice it.

Third problem that everything looks slowly. Yeahh we are at 1200km/h but looks like we stand at one point. The reason that the human eye have no object to determine actual speed. So if you want to game high speed movement feeling you should add small objects close to the camera. If you travel by the car and look at the highway you will feel the speed, but if you look at the sky you feel nothing, except dramatic universe hugeness :). We  fix it with particles added to the ship that moves to you with high speed.

Fourth problem is the gun positioning. At low distances you can shoot according to camera forward vector and hit the target. But at long distances you should correct your weapon according to distance to the object. So we raycasted to the target and position each gun individually ( we have a lot of them ) to hit the target.

Fifth problem was limit of  Unity world. I mean Unity use float to describe game coordinates, so with huge coordinate value you will get an error during render and at some point you can't move at all. So we make -80 km to 80 km movement about 20 minutes level fly. If we take bigger coordinate we will get warning.