Mobile Tank Game (W.I.P) Screenshot 4: Tank tracks system

Triangular shaped tank tracks created with the tank tracks system

To good to use

When I began working on Tankmanious I wanted the tanks in the game to have realistically moving tank tracks with individual track pieces, so I thought it would be interesting to create a tank track system. After doing some research on different kinds of approaches to realistic tank tracks I decided to go for a spline based system. For those of you who aren’t familiar with splines, think of the pen tool from Photoshop and Illustrator that you use to draw Bézier curves with. Curves can also be used in 3D space to create paths in 3D.

Curves are very useful in game-design for a lot of things. You can use them to create race tracks, enemy patrolling paths or train tracks for instance. You can also have objects follow those paths like a train follows it’s rails, which is also useful if you want a camera to follow a path trough space.

For the base of the system I used code to generate splines and to have an object move along that spline. Then I built the system on top of that.

The way that it works in Unity is that I generate a spline object and give it the shape that I want. After that I can simply add a prefab of a single track piece to the script in Unity and specify how many pieces the track should have and how much space there is between them. To have the tracks rotate forward I just set the speed to a positive value or negative to rotate backwards.

The system works great and I’m sure I can use it for a different game in the future but it was a little bit too good to use for a mobile game because, obviously, it’s a lot more expensive to have a lot of single track pieces moving around in game than having a texture offset based system or no moving tracks at all. I decided that having a lot of enemies on screen is more important for my game than a couple of detailed ones, so I went for a lot less complex models that use fantasy to float around.

It does make me a little bit sad to have to make that compromise but I also realised how much more often developers had to make those compromises one or two decades ago!

More Soon!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s