Super Important for Skill Games!!1!11!!!
Before we get into operations and filters we really need to discuss datasources so for this lesson we will skip down the line a few subheadings.Data sources are tools that can be used to store or create numbers for others tools and objects to use.
Some of these tools use mathematics, but don’t worry you don’t need to be a math genius to use them, however if you are these should be pretty easy for you to grasp. We will get into some uses for these in later tutorials as we cover operations, filters and creating skill games but I will include a basic example here as well, first though I’d like to discuss the different types of data sources.
-Our first data source is the “Curve data source.” This tool can change from one value to another over a set amount of time. Let’s peep those properties to see what I’m talking about.
-To begin let’s skip down a couple options to “start” & “end.” These are where you set the two values the data source will switch between.
-Below them is duration, this is how long the change will take. So for example if your start value is zero, your end value is 60 and your duration is 1 minute each second the value will increase by one. Keep in mind though that the value is still changing every tick.
-The change however doesn’t have to be a linear one. If we jump back up we have the “curve” setting. This affects the speed of the change. There are too many options here to discuss them all but there are some great resources online that have visual examples of each type of curve, we will share a link to one in the YouTube video description.
Just for a quick example let’s say we set it to “quadratic ease in out” now instead of going from 1 to 60 at an even pace, the change will begin slowly then speed up in the middle then slow down again as it reaches the end.
-“Offset ticks” is an option we’ve seen before in the trigger tutorials, this is based on the game clock and determines when the change starts.
-The “looping” checkbox will loop the data source so that in runs continuously. So now when we reach one minute the value will become zero again and start all over.
-The “invert second half” checkbox will make your change take half the time and then during the second half it will reverse back to the start. So now using our same example it will only take 30 seconds to go from 0 to 60 than the second 30 seconds it will go from 60 back to 0.
-“Reset when disabled” will reset the data source if you use a state event to disable it. Enabling and disabling this tool with a state event comes in handy if you want to trigger the change instead of having it based on the game clock.
-And finally “reset in checkpoint restart” of course resets the data source when the rider resets to a checkpoint.
-Next we have the “game variable data source.” This one uses various in game sources to get its value. In the properties we have one main option, “type.” This is where you choose what the data source uses to get its value. You’ll notice with type highlighted you get some text on the right hand side of the screen, this gives you some important info as to what the numerical values associated with each setting are.
When the type is set to any of the options that use the controller you also get a slider to choose which controller it gets the value from. For trials tracks you will always be using main but it is possible to create local multiplayer skill games for which this will be an invaluable tool.
-The “object info data source” uses info like, position, rotation or direction of an object to get its value. We only have two options in this properties menu. “Select object” is of course how you choose the object you want to use and“type” determines what aspect of that object you want to use as your value.As you can see there are quite a few options so we don’t have time to explain them all, but I’ll try to quickly run through.
-Position, Angle, Direction, Side &Up X, Y and Z values all use the position and orientation of the object in the game world to get the value.
-Applied force calculates the amount of force being applied to the object.
-Hitpoints is of course the number of hitpoints the object has.
-Velocity and angular velocity x, y and z use the speed of the object or the speed of its rotation on a single axis while “speed” simply calculates the objects overall speed.
-Driving line position of course uses the object’s position on the driving line.
Next we’ll look at the “random data source.” This one will generate random numbers between two set values at set interval of the users’ choice. Where do we go from here? To the properties of course.
-“Min” and “max” are of course the two values between which all of your random values will be.
-And “duration” will set how often the data source produces a new value.
-“Re-seed” and “seed” both have to do with how the data source generates the random values. Technically you could say that the numbers are not truly random as the data source uses a mathematical algorithms to produce the values.
In this case it looks at the minimum and maximum values as well as the seed value, as a result two random data sources with the same minimum, maximum and seed values will always produce the same values.If you want to get truly random values you can change the seed value while the game is running. We will discuss how to do this in just a moment.
-Finally we have the variable “data source.” Basically this one simply holds one number, not much math involved. Of course as we touched upon in the events tutorial you can change the value using a set value event and that will come into play as we check out the properties.
-Our first option is value, this is where you set the value that the data source will have at the start of the map.
-If you adjust the value using the set value event, “reset in checkpoint restart” will reset it back to the initial number you have the value set as.
-The “interpolate” checkbox will open up some new options and also has to do with how the data source reacts when the value is changed. On a basic level this function is similar to those of the curved data source. With interpolation checked the number will not abruptly change to the new value but instead will gradually change over time depending on the following settings.
-Interpolation type is similar to the curve but here you only get two options, exponential is similar to the curve example I used earlier, a little smoother than linear which is a straight change at even speed.
-Interpolation speed of course sets how quickly the number will change.
-And finally “max step” sets the maximum value the number can change each tick, so for example if max value is set to 1 than each tick the value will only go up by one, increasing or decreasing the value by 60 each second.
Now that’s all the data sources but perhaps you are thinking to yourself, “What the heck am I supposed to do with them?” As I mentioned earlier we will discuss some uses in coming lessons but for now the main thing you need to know is that just about any option in any properties menu that uses a value, checkbox or notched slider can be tied to a data source allowing you to change it during gameplay.
If it is value of course the value in the properties will simply match the value in the data source. If it is checkbox a value of zero in the data source equals unchecked while a value of one or higher equals checked. If it is a notched slider than the first notch will be zero and each notch after will be one higher, so for example if your slider has four notches they will be valued 0 through 3.
I will quickly show one example that I’ve used quite a few times, creating a zoom effect on a camera by tying the field of view to a curved data source. I’ve set up my example by placing a camera at the start of my level , targeted to the rider and set as the game camera. I’ve also already placed my curved data source and set its values.
Just to quickly show you my start value is 57, the default field of view setting on the camera. My end value is 10 and my duration is set to 3 seconds. Now I will open my camera properties and scroll down to FOV, a press of the Y button brings up my cursor so I can select my value target, for now we’ve only discussed data sources but operations can also be used as value targets. Now when I test the track we should see a wide camera view that zooms in for a closer look at my rider.
Hopefully this gives you an idea of what can be done with data sources and just how powerful this tool can be. Now fire up those editors and show me what kind of awesome new stuff you can come up with.