The Making of Truck Trials–Multiplayer Racing

Truck Trials - Multiplayer Race skjermbilde 0

Project Truck Trials started back in June 2014, after Starcomet 2 was released. And as usual, with every game release I do comes a making of guide, just to share the process and what I did to end up with the result I have.

Read my other guides

1. WHAT IS TRUCK TRIALS?

The game takes you to a trial track where you have to maneuver a heavy truck through harsh environment, hills and jumps as fast as you can – or at least faster than your competitor! You are free to design and change the look of your truck, change your name and play both in Time Trial and online 1 vs. 1 race.

Try it out:

image image[8]

Logo
The game logo is inspired from the American interstate road signs, with a truck grill and mirrors to make it look a bit like a truck, but at the same time have similarities to the NBA, NASCAR, NHL, MLB, NFL++ logos.

left-43868_640 image

THE GAME
It’s a connected game, so you need to be connected to the internet to be able to play. An account will be created for you when you first start the game – using the GUID of your Microsoft Account.

image

Description
30 tonnes, 200 km/h, 20 meters up in the air, welcome to Truck Trials, a high pace, side scrolling physics based racing game!

GET READY FOR INTENSE TRUCK TRIAL RACING!
Create, design, and race a heavy truck against random players in the biggest truck trial racing tournament ever!
 Truck Trials - Multiplayer Race skjermbilde 3

CUSTOMIZE YOUR TRUCK
Unlock truck parts, put them together and give them a color to create a truck that fits your style! The top three players will see their design nicely lined up on the throne in the ranking screen!
image

PLAY ONLINE
Play against random players, win and earn credits, and become the ultimate truck racing champion!Truck Trials - Multiplayer Race skjermbilde 2

TIME TRIAL
Race against time! Can you beat your personal record?Truck Trials - Multiplayer Race skjermbilde 6

BECOME THE BEST TRUCKER, TOP THE LISTS!
image

 

2. PROTOTYPING

Truck Trials - Multiplayer Race skjermbilde 1
Back in December 2013, my brother and I attended some Hackathons, where we were put up to a challenge to create and implement a game idea over a weekend.

We took this concept to a cottage up on the Norwegian mountains for a weekend where our goal was: “Let’s create 10 games, where we use max 3 hours on each – then all of these prototypes must be good enough for publishing. If we exceed 3 hours, we scrap it.”
 altAl6grRz_Rd7-PGMdwPyQaLqcCCUpyTC7aG_Q8FJ4DC9U

7 or our ideas was successfully published on a public Game Jam account, where we could follow the prototype when it comes to stats and downloads.

Two of them stood out with over 100.000 downloads in a short amount of time (and much more later). One of them would take too much time to implement, and the other was a truck game that looked like this:
image

So basically, we skipped paper prototyping – and instead created a digital game with proper stats, and feedback.

 

3. TECHNOLOGY

The game is made with Unity3d, a great game engine for creating all kinds of games and interactive experiences. We used this because of the good engine, and the great possibilities it has when it comes to exporting.

image

Truck Trials is a Universal App. It’s an app that runs on both Windows 8 and Windows Phone, and is connected on the store (basically, is shares everything, including IAP ++).

imageFor the multiplayer part, Photon by Exit Games is used for real-time communication, and Microsoft Azure for all of the services and database. Photon is used because it’s a mature and modern platform, that’s 100% integrated with Unity3d.

When it comes to Microsoft Azure, all of the logic is created trough a custom Visual Studio DLL project that’s used as a plugin with Unity. I had to write one plugin for Windows 8.1 and one for Windows Phone. Most code could be reused, but I needed some custom stuff that’s platform dependent. Prime31 also got some plugins for Azure, so be sure to check them out!

image

I’m very satisfied with how fast and easy it was to create the services I needed, and how much flexibility I had when setting them up (scale, performance).

What I have online is a couple of services, a web site, a mobile service and a database that connects all the logic together.

There are a lot of different ways to implement all of this, but this was my choice based on earlier experiences. Most of the communication is through REST/Web Services, while the real-time positioning is peer to peer using photon.

The awesome thing about making stuff with Microsoft Azure is the nice user interface to the platform. I can track everything that happens on the server, and see exactly how my queries are performing, how much data is being used and so on.

image

image

image

4. DEVELOPMENT PROCESS

I started working on the game in June and the core of the game was developed before going on summer vacation. After that there has mostly been content creation, level design and polish – and with very little time on my hands to actually work on this game, it took a while to get it “done”.

I made sure to have a a beta version available from the start so people could try the game, give me some feedback, and post updates to a dedicated beta testing group on Facebook.clip_image002

The first iteration of the game was a simple straight line where one could drive a box with wheels. The box was the truck, and the wheels was the physics system – this was to create the balance, get the correct forces and the feeling I wanted to have. I spent a lot of time playing with different gravity values, to get the “Heavy Truck” feeling. Then I changed the box to a proper model and worked on the scale.

Next was to get the multiplayer part working, so one could see the other player on the same track, set up the correct cameras and make it playable with two players (and get the winner).

clip_image002[5]Once the mechanics was in order, I started to create the first iteration of the menu systems and the truck customization to be able to create the internal logic that renders the customization, stores it to the server, sets the correct colors and basically defining the rules I needed to follow.

Then I started the modeling process on some real trucks and truck parts, and do the level designs on a few levels just to get it started, and see how the mechanics work in a “real” scenario.

clip_image002[7]

I also created the online services that connects everything to a user account, and the plugins that connects the client to the server, and the IAP system.

Most of the game is straight forward and pretty easy to implement, but there are a couple of features I want to highlight.

Here you can see the iterations of the user interface from start to finish:

clip_image002[9]clip_image002[11]
clip_image002[13]
image

I recommend you to create and test a protoype of your interface, and work with it. It takes a lot of time to totally re-implement the UI like I did in this game, but don’t be afraid to re-implement it – it will be worth it!

4.1 – FEATURES

4.1.1 – CHALLENGES


The challenges system was fun to create. After the initial launch of the game I needed to increase the retention rate of my players. So I decided to add a couple of things to do this, and one of them was to add a system that tracks what you do, and give you a reward if you do enough of it.

What’s behind it?
– two database tables that store the data online
– a couple of web services that handles incoming and outgoing data
– a client function that makes progress of a challenge, and one that gets the status of all active challenges.

The challenges system consists of a few tables that is hosted on Microsoft Azure. One is the challenge description itself, and another one is the tracking of a challenge pr. player.

image

When the player is checking the Challenges status, the client requests the current active challenges from the cloud, gets a reply and renders them.

When the player is completing an interesting activity in the game, like winning a race, loosing a race, buying anything, or simply just completing a race, a function will notify what the player just did, and then the server will do the rest – like checking if it’s true, then handling the updates for all the challenges that are affected by that activity.

The Progress function will also reply to the client if this new progress has made a challenge complete. If so, the reward is added to the account.

Christmas Special Challenge
In addition, I created a special challenge that’s only available during Christmas (but the function can be reused whenever, like Easter, Halloween, summer and so on). This challenge counts the number of challenges the player has completed, and if it meets a certain goal, an item is unlocked for the player.

image

For this challenge, I unlock a Christmas-special badge and emblem, and enough truck credits to buy a Christmas hat – just to set the mood. Smile
image

The main menu has also been changed to have a darker blue background, with snow and the northern light – it’s Christmas. Open-mouthed smile

 

4.1.2 – IN-APP ADVERTISEMENT

I wanted to test out ads in a game, so I simply used the Prime31 plugins for Microsoft Advertisements (AdMob is also available for Windows Phone).

Before you can start using ads, you will need to register an account at all of the different Ad providers you want to use.

1. Register at Microsoft Advertisement: http://pubcenter.microsoft.com/
2. Register at Google AdMob: https://apps.admob.com/admob/
3. …..

Once you have registered here, you are able to create an ad, get the ad ID and then simply using those keys in the Prime31 plugin. The rest is automatic! Smile

 

4.1.3 – WEEKEND CHAMPION CUP

The weekend champion cup is a cup that starts every Friday at 18:00 and ends Sunday at 18:00 (GMT). It’s the same type of racing as before, but in addition to getting the normal stats, you also get championship points – and every weekend, I reset the existing championship points to 0, so everybody starts at the same page for every weekend.

These points are used in a dedicated ranking podium that the players can see in the ranking screen. Again, everyone starts from scratch, and the winner gets 2000 Truck Credits to spend on any truck parts they wish, and a unique Champions Cup badge and emblem that they can use to show off to their competitors that they won.

In addition, all the winners are posted on the games Facebook and Twitter page:

This implementation is very simple. It just checks if the server says that the compo is active, and if it is – it changes the normal Race Online button to another button that takes you to the Weekend Champion Cup. The rest of the race is identical to the others.

4.1.4 – BADGES & EMBLEMS

image

The badge system is a way for players to show other players what they have achieved. The Badges can only be unlocked by meeting certain criteria like being a game tester, the developer, completing the Christmas challenge, buying a Premium Account, spending real money on the game, winning the Weekend Champion Cup and so on.

A badge is using the same system as the other parts of the truck, but in addition, the lookup id of a badge item (read more on the below) is used to also change the emblem that will appear below your nick when starting a race.

4.1.5 – PREMIUM ACCOUNT  & 1st PERSON VIEW

image

The game features a Premium Account that can be bought as an IAP. If you got a Premium Account, you will get 100% extra in-game truck credits earnings for every match you play, free color painting, access to the Rim Editor, as well as unlocking the Premium Account badge and emblem, 1st person view and a donator badge/emblem (this is unlock to everyone who spends money on the game).

This is a simple implementation. If you buy the Premium Account IAP (durable), the features will be enabled. It’s simply a function that checks the IAP, and then your account – and if everything is OK, it will unlock the items in the database.

The 1st person view is implemented by having two cameras on the trucks, and then using unity logic to enable/disable the correct cameras based on a setting from the Settings menu. Each camera has a rendering layer, so I can specify what the 1st person camera can see, and what it can’t – to hide items like the Christmas hat.

In addition, when playing 1st person, the normal view is displayed in the corner in-case you need to get out of the truck and get a proper reference – just as an aid.

 

4.1.6 – CUSTOMIZATION

image

image

The game uses ID’s to select what items it should render where. One truck is put together by 5 factors:
– Chassis
– Exhaust
– Roof
– Rear
– Badge/Emblem
-Rims

These items are just an integer that is stored on the player profile, and used as a lookup in the items folder. The system then assembles the car by using the lookup IDs to find the correct prefab, and then Instansiating them in the right place on the truck.

Each chassis contains points of interest, like an empty game object where the roof should be, another where the rear should be and so on – this is spesific pr. car, since the positioning is quite different on each of them.

This chain of ID’s is then communicated between the players you race against, and then built up locally the same way.

5. LEARNINGS

NEW+RISING: When publishing the game, it will stay on the “NEW+RISING” list for some weeks. Make sure your game is as finished as possible before it reaches this list. In my experience it usually takes about a week to get there, so you got a few days to test and make sure the published version is working as it should. These first weeks will be very important going forward.

KEYWORDS: When publishing, you can type in some search keywords. Change and test these frequently if you don’t get any downloads. Changing this can multiply your download rates.

ADS: Make sure you have a good fill rate, and a good eCPM. Test your ads at different places, and make sure it wont overlap anything of importance on the screen. Test with different screen resolutions, and orientations.

6. DOWNLOAD

It’s free to download, so if you appreciate this guide, please help me by testing the game and by giving me a rating – and/or an e-mail to petriw@outlook.com with feedback. Smile

image image[8]

 

7. THANKS

A special thanks to Thomas for helping me when needed, to Tuuli for support and my brothers Olav and Paul for testing.

Also, thanks to all the testers in the Beta Program – more versions are on the way, so be ready! Smile

This entry was posted in Uncategorized. Bookmark the permalink.

4 Responses to The Making of Truck Trials–Multiplayer Racing

  1. dan says:

    Very cool! So happy to learn about Prime31. My last game I just did all the azure backend stuff in the platform project which was probably a lot harder than it needed to be. Were you able to do everything in Unity or was there still some back and forth needed? Did it all work well with a universal project?

    • digitalerr0r says:

      Thanks, and yeah – Prime31 is awesome! I did a lot of back and forth as I created the Azure plugin myself. It was quite easy, but also a bit of a hassle – I wan’t to do it another way in the future, trying to set most of it inside Unity.

      The Universal thing was straight forward🙂

  2. Pingback: Video Tutorial: Creating a Flappy Bird type game using Unity 4.6 | digitalerr0r

  3. Pingback: Microsoft Azure WebJobs in Truck Trials | digitalerr0r

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