I built a fairly complex skill game for Trials Fusion on the Xbox One. Jet Hoverbike Challenge was created by me, rectorsquid, as a sort of Lunar Lander style game.

Jet Hoverbike Challenge Gameplay

Trials Fusion, and earlier versions of the game like Trials Evolution, have a track editor that lets normal users create custom content that is almost as complex as the developers create. And they apparently use the exact same tools in the game to create their own content.

imageI created this skill game using some interesting game programming. The first thing I did was add the thrusters to the bike. In the track editor, there is not some object called a thruster that can just be attached to the bike. Instead, there are multiple useful objects that can be combined to get the desired effect. The first thing to add was the Area Effector. This is an invisible object that applies a force to any object within a given area. I added an Area Effector at the location of the front and rear wheels of the motorcycle. Then I enabled physics and watched the motorcycle get thrown into the air. I had a long ways to go before this would work.

I added a few Dummy Objects to the game and then connected them together in a Glue Group. A Glue Group is a group of objects that all act as a single object. Then I made sure that the pivot of the group and the location of the dummy objects lined up with the center of the bike and the wheels respectively.

Now for some actual programming.

Programming in Trials Fusion works like this; add little squares to the 3D world that represent programming objects of various sorts. Examine their properties and then connect them together to build chains of events.

image

Some Programming Objects

So I added a variable that returns an objects position and set it to return the bike position. I added a separate variable to return the angle of the bike in one axis. Then with the addition of a Set Position event and an Interval Trigger to make it set the position every tick (the game runs on a 60 tick per second clock), I just connected these things together and made the dummy objects always be at the center of the front and rear wheels. There were a few other bits of programming needed, like subtracting 180 from the bike angle because it was 180 when the bike was level, not zero like the group of dummy objects needed. This sort of thing is done by adding in a Two-Input Operator and then setting it to subtract 180 from the bike angle data object.

After a bit more work using these same types of variable, events, and operators, I was able to make the Area Effector objects stay at the center of each wheel for the entire game. If the bike moves, so do the Area Effectors.

image

Some Programming Objects

I’ve been just a little bit specific so far. From this point on, I’ll make the descriptions less specific and shorter. Anyone who is familiar with how Trails games let you program the game, will get what I’m saying. For anyone else, this will all be gibberish. Sorry.

At this point in the programming, I now have Area Effectors that keep themselves centered at the bike wheels. More programming is needed…

Before adding more decorative stuff, I need to handle the controls. Trials Fusion is fairly crappy at giving access to the controller. The trigger input data is only available after it has been scaled or adjusted for how the regular Trials game works; there are 8 steps to the right trigger and 4 steps to the left trigger, which is not what the operating system is seeing when you press those triggers. So I opted to use the triggers as on/off buttons. I made it so that pressing a trigger causes a momentary large increase in thrust followed by the trust continuing to go up at a steady rate. Letting go of the trigger causes a momentary slight decrease in thrust followed by a continual larger decrease. In the final version of the game, I also take the bike angle and use it to increase thrust in the back if the back is lower than the front, and increase it in the front if the front is lower. The amount of increase is relative to the angle of the bike, making for a slight self-leveling feature.

I also had to disable the normal controlling of the bike. the left-stick would no longer let the player lean the bike and the triggers would not act as throttle and brake. I also add a bit of lean when the game starts to position the ride so that he less often hits his face on things in front of him. Because of this and other factors, I had to scale the thrust in the rear differently than in the front; the bike just seemed heavier in the back.

Now I could fly the bike. If you have not watched the video up above, watch it and you will see how the trigger control the thrust. I also display the thrust level in the bars on the left and right of the screen.

I also added various flames and smoke to the bike and stuck in some jet sounds to all help make the game feel more “real.” Plus, the flames and smoke look pretty near even if they do come out of the wheels without there being any actual rocket or jet looking device on the bike.

For the landing pads, I just added a hit trigger for the front wheel and one for the back. Some more programming with numbers and some comparison operators, and I could detect when the bike is touching the pad with both wheels. I use a hit area on the pad as a way to keep from detecting a wheel touching the edge of the pad. The hit area doesn’t trigger anything but does let me specify a very specific part of the pad for the hit triggers to detect.

In all of the programming, there are lots of places where some programming action must only happen once. This is easy to accomplish because the “enabled” setting of any event or data, can be connected to a variable. Just setting the variable to 1.00 to start with and then using a Set Value event at the right time to set it to zero, then disables whatever is using that variable as its “enabled” setting.

I also added a lot of programming to add different scores for different landing pads, as well as to make sounds to play when the different medals are achieved. I’ve never actually gotten the Platinum medal myself, but the Gold is fairly easy. The game just takes a steady amount of concentration the entire time the bike is in the air, and I don’t play this skill game that much, It’s fun, but I always find some programming tweak to make before I get much of a high score.

image

More Programming

It’s hard to see in the image above, but all of the bike control programming is there. You can also see some of the scoring programming near the top of the picture and some of the landing pad programming above each pad. The video below shows the editor and some of the programming and then me testing the tract up to that point in development.

Programming Objects and Some Testing

Where I Went Wrong

I’m pretty sure that I didn’t update the target count in the upper-right corner to reflect the final number of landing pads.

I didn’t realize that my instructions, which ironically don’t show up in a replay, are not clear. I said “LT and RT control rear and front thrust. Land on pads for points.” but no one reads those and then they just press RT expecting the bike to start moving normally.

And finally, the game should not end when the player crashes. But I’m not at all sure how to end a skill game in the middle when the user crashes and is done playing. The way I did it, the game ends and no one presses the replay button. But if the rider just laid their on the ground after a crash, they might hit the B button and try again.

What MS Did Wrong

A few days before I published the track/game, my Xbox One started asking me for my password every time I signed in. I left it like that until I published the track in case I ended up losing some data. Well, that was a good idea because after I deleted my profile form the Xbox and then added it again, the password problem went away but Trials Fusion reports a sync error every time is starts up. The track and all of my other tracks and objects are lost. Shit.