Overclock.net banner

1 - 3 of 3 Posts

·
Registered
Joined
·
2,902 Posts
Discussion Starter #1
I just started a fundamentals of game design class at my school. For the homework we have to create a "game" that has 4 xbox controllers on a slope. They use the vibrators to go down the slope, they have to "race" to the end and controller 2 HAS to win every time without it looking obvious.

This is really less of a game and more of a event I think.

But I am not quite sure how to go about it, is there like a randomization method that I can call that will randomly have the controllers vibrate on and off and then like add a +1 on to controller 2 as to have it vibrate a few more times??

I know how to get the controllers to vibrate, I'm just not quite sure as how to get #2 to win as stated.
 

·
Banned
Joined
·
12,758 Posts
Seems like more vibration would equal more movement, although there might be a specific frequency that allows for the most movement. I would start by just trying it with one controller, timing it at different frequency vibrations until you find the one that allows for the fastest movement.

I'd put money on it that the fastest vibration speed allows for the fastest movement on a downward smooth slope though. While vibrating parts of the controller leave the surface of the slope, which removes any surface friction occurring between the controller and the slope at certain points on the controller.

To make it less obvious you can have the random number generator that each controller is using, have slightly higher numbers for controller 2.

Alright, here's a stab at it, I haven't programmed in C# in about 6 months though. I doubt this would properly compile.

Code:
Code:
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;

static class Program
{
List<int> minValues = new List<int>();
List<int> maxValues = new List<int>();
Random myRandom = new Random();

static void Main(string[] args)
{
    // This could be improved by choosing random numbers between 1 and 1.2 for each
    // of the controllers, and then adding another small random number to controller 2.
    minValues.Add(1);    // Controller 1
    minValues.Add(1.5);  // Controller 2
    minValues.Add(1.2);  // Controller 3
    minValues.Add(1.15); // Controller 4

    // This could also use random numbers
    maxValues.Add(2);    // Controller 1
    maxValues.Add(2.4);  // Controller 2
    maxValues.Add(1.9);  // Controller 3
    maxValues.Add(1.8);  // Controller 4

    // Simply call this every 1-2 seconds or so to pick a new speed.
    for ( PlayerIndex index = PlayerIndex.One; index <= PlayerIndex.Four; ++index )
    {
         int newSpeed = PickRandomSpeed( index );
         // Call some function here to apply 'newSpeed' to your controller # (specified by 'index in this case)
    }
}

public int PickRandomSpeed( PlayerIndex controller )
{
    return myRandom.Next( minValues[(int)controller], maxValues[(int)controller] );
}
}
 
1 - 3 of 3 Posts
Top