In Talking Tom Splash Force, the player controls Tom. On his island, he bombards the naughty raccoons in front of him with water balloons.
In order to have an infinite replay value, we needed to generate a limitless number of terrains. But it was mandatory to create them by hand if necessary, especially for the first 20 battles of the player.
It’s in that context that I conceived the terrain system. After having shaped a terrain and placed elements on it (player, enemies), all is generated automatically!
- Composition of a terrain
- Terrain setup
- Placement of elements on the terrain
- Terrain generation
- Objects stacks
Composition of a terrain
A terrain contains different sub elements. Firstly, two archipelagoes: on the left, the player’s archipelago, and on the right, the enemies’ archipelago. They can contain islands and flying platforms.
Islands are made with 3 simple elements: a slope up, a slope down and a flat surface. We can modify the length of the flat surfaces, and also the angle and the length of the slopes. By placing them side by side, we get an island!
Then we can form an archipelago with one or multiple islands. On that one, we can put some flying platforms, with different width and height.
Finally, join 2 archipelagoes constitute a terrain!
There are two types of terrains: predefined terrains and procedural terrains.
The predefined terrains are handmade by a level designer. As explained previously, we need to create islands, then put them together in an archipelago on which we will be able to add flying platforms. Islands can be reused in many archipelagoes, and the archipelagoes can be themselves reused in several terrain.
For their part, procedural terrains are generated with some rules defined beforehand, like:
- The number of islands, their width, their height, the distance between each island.
- The number of flying platforms, their width, their height, their distribution on the archipelago.
Placement of elements on the terrain
Having a terrain is great, but having a terrain with a player and enemies it’s better! As we have seen above, each island is made up of slopes up, down, and especially of flat surfaces. The flying platforms themselves are formed with flat surfaces. The same elements which come one after another (like 3 slopes up in succession) are gathered to form each edge of the terrain. Flat edges are called spots: it’s here that we will be able to place elements.
Let’s suppose that the terrain below are created by hand. To put element on it, for example an enemy, we just need to specify ‘I want to place an enemy on the spot with the index 2’.
To place elements on a procedural terrain, it’s different. From predefined rules, it’s the system which will place itself elements on the terrain. If we decide ‘I want 1 player and 3 enemies’, the system will place the player on his archipelago, and the 3 enemies on a random spot of their archipelago. If an enemy is a sniper, the system will place it on the further spot. All rules are possible!
One of the strong points is that the spots can extend themselves if they are not big enough to contain the elements that we want, like shown below.
Now that we created a terrain and put elements on it, it’s time to make it playable! All the necessary stuff is generated, from the mesh of each island and each flying platform to their collisions, the different areas around the terrain, and the sea.
Many parameters allow to diversify the visual aspect of the terrain. For example, we can change the material of the ground, grass or the sea, to get various atmospheres. We can also add decorative objects, and control their spawn rate. Or also adjust the round corners of the islands and flying platforms.
Among the elements that can be put on the terrain, there are the objects stacks.
To make easier the creation of the objects stacks, I designed a tool shown below.
That type of element has a distinctive characteristic: they can contain spots. So, it’s possible to place on it any other element, for example an enemy at the top of a stack of crates!
To help or encourage the player to aim an exact place, we added lines of coins. Placed on the projectile trajectory, they can be of different shapes: a line, an arrow, a pyramid…
Like the terrain, the coins placement can be predefined or procedural. In both cases, the principle is the same: firstly, choose a target, choose a coins pattern, and then place it on the projectile trajectory, between the player and the target.