Adding details to a game can take it from a boring repetitive place, to a vibrant exciting world to explore. The down side is that adding detail takes a lot of time. Adding individual details can be very time consuming and can add delays. Take for example, the following shot of three red mushrooms.
Since they are all the same, it looks rather boring and out of place. As a designer you could do a few things. One, have a few different mushrooms objects, each with a different size, shape and color. This would increase the number of meshes and textures the game engine has to draw, so not ideal solution. The second solution would be to manually scale and rotate each object. While a better solution this would be very time consuming for the level designer. So I came up with a better solution. Add a small bit of code to a “master” object. This object is then cloned for other mushrooms in the level. When the game is started, the code randomizes the scale, rotation and colors. As you can see, this provides a much more pleasing result with almost no additional effort during level design.
Now that I had my mushrooms looking good, I needed a way to harvest them. One of early problems you run into with isometric views in a 3D world is large objects obscuring the player.
To counter this, I added some code to draw a ray from the camera into the scene. Any objects that it collides with are then asked to be rendered in a transparent shader.
This works for making them transparent, but I had to add some code to make the object try to make itself opaque after the player moved. Otherwise the world would end up being all transparent objects. 🙂
Adding these rather small details might seem trivial. But I think in the larger context of the game, they will provide a much more robust and enjoyable experience for the player.