Hello everyone. We are starting our development blog and we will talk about how we developed a few of the things, how we solved a few problems and created some features. Feel free to leave comments below with questions, suggestions of topics, how we can improve our games or the blog.
All our games are being developed in Unity. The below video is the first one on Marble Racer.
For the Marble Racer, we wanted to create a starry night for the background. I will summarise it here. We chose a starry night sky image from www.freeimages.com, we then went to Blender, placed the image on a very large sphere, inverted the normals so they would be facing inwards, placed a cube inside the sphere (the same cube as the initial Blender file) and then rendered the Environment Map of the cube. This will render what the cube is “seeing” from its viewpoint on the 6 faces. After saving the map, we had an image with 6 faces (from each side of the cube) that we just need to split in 6 separate images to be used as the skybox inside Unity. From top-left to bottom right, the sides are:
With this maps, we had to make a small change as the bottom and top images needed to be rotated 180 degrees.
Please note that, event though we used a starry background, you can use any image or scene in Blender you want to be your Skybox scene. Your imagination is the limit.
We used this tutorial for the skybox from Blender. (http://www.katsbits.com/tutorials/blender/render-skybox.php).
Since our camera inside the game does not change angles, only follow the ball in the same delta, the Skybox was not moving, it was fixed in the same position, so we just rotated the Skybox material about 5 degree per second just to give a sense of movement.
We wanted to produce a random marble track, giving a higher variation of results.
The first thing we did was to manually produce a simple track to define the descending angle. We found that 20 degrees worked perfectly but with normal gravity the balls were to slow. Then we change the gravity on the physics manager from 9.8 to 25. That made the marbles run faster and funnier.
After that we chose a way to create track pieces that can be connected with each other perfectly.
We decide to create track segments with 90 degrees entry and 90 degrees exit with a descending angle of 20 degrees and the same diameter. On the middle of the circles of the start and end of each segment we placed a cube to serve as a reference point. Something like this:
Every track piece has theses components represented by bold lines. The dash lines can be any kind of length and track shapes that don’t block or stop the marbles.
Connecting the track pieces
To create a track, just randomly choose a track piece and connect the previous track exit box position with the next entry box position like this:
Voila. We had a procedural marble track.
Just one note, since we created the segments in Blender, we had to make a small change to the rotation of the object inside Blender so that the objects would be imported to Unity without any rotation. This happens because of the way both software deal with the X and Z axis.