Search titles only
By:
Home
Forums
New posts
Search forums
Articles
New articles
New comments
Search articles
Pinball DB
Pinball Tables
Pinball Games
What's new
New posts
New articles
New profile posts
New article comments
Latest activity
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Welcome Back to Digital Pinball Fans -
please read this first
For latest updates, follow Digital Pinball Fans on
Facebook
and
Twitter
Home
Forums
Farsight Studios
Pinball Arcade Tables
Bally Tables - Retired Tables
Twilight Zone (1993)
My impressions as a TZ machine owner
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Sean DonCarlos" data-source="post: 93715" data-attributes="member: 152"><p>It's not hard at all...just a few lines will do it.</p><p>[CODE]using namespace System;</p><p>double baseSpeed, finalSpeed, baseAngle, finalAngle;</p><p>Random ^ rng = gcnew Random;</p><p></p><p>...</p><p></p><p>finalSpeed = baseSpeed * (0.9 + (rng->NextDouble() * 0.2)); // final speed is random value between 90% and 110% of base speed</p><p>finalAngle = baseAngle - 5 + (rng->NextDouble() * 10); // final angle (in degrees) is random value within 5 degrees of base angle</p><p></p><p>...[/CODE]</p><p></p><p>Or if you wanted to get fancy and plan ahead for a user-adjustable "Kickout Variation" option in the future:</p><p>[CODE]using namespace System;</p><p>double baseSpeed, finalSpeed, baseAngle, finalAngle;</p><p>double kickoutVariation = 0.1; // value from 0.0 to 1.0 from a user-adjustable slider somewhere that controls how "random" kickouts should be, default = 0.1</p><p>Random ^ rng = gcnew Random;</p><p></p><p>...</p><p></p><p>finalSpeed = baseSpeed * (1 - kickoutVariation + (rng->NextDouble() * 2 * kickoutVariation)); // final speed is base speed times a random value between (1 - userVariation) and (1 + userVariation)</p><p>finalAngle = baseAngle - (50 * kickoutVariation) + (rng->NextDouble() * 100 * kickoutVariation); // final angle (in degrees) is random value within (50 * userVariation) degrees of base angle</p><p></p><p>...[/CODE]</p><p></p><p>Or for extra realism, since most physical machines are not completely random but generally have a "typical" kickout that happens most of the time, and only sometimes do they vary and surprise the player:</p><p>[CODE]using namespace System;</p><p>double baseSpeed, finalSpeed, baseAngle, finalAngle;</p><p>double kickoutVariation = 0.1; // value from 0.0 to 1.0 from a user-adjustable slider somewhere that controls both the chance and the magnitude of a "random" kickout, default = 0.1</p><p>Random ^ rng = gcnew Random;</p><p></p><p>...</p><p></p><p>if (rng->NextDouble() < kickoutVariation) // as kickoutVariation increases, random adjustments to the kickout both happen more often and are larger in magnitude</p><p>{</p><p> finalSpeed = baseSpeed * (1 - kickoutVariation + (rng->NextDouble() * 2 * kickoutVariation)); // final speed is base speed times a random value between (1 - userVariation) and (1 + userVariation)</p><p> finalAngle = baseAngle - (50 * kickoutVariation) + (rng->NextDouble() * 100 * kickoutVariation); // final angle (in degrees) is random value within (50 * userVariation) degrees of base angle</p><p>}</p><p>else</p><p>{</p><p> finalSpeed = baseSpeed;</p><p> finalAngle = baseAngle;</p><p>}</p><p></p><p>...[/CODE]</p><p></p><p>And so on and so forth...</p></blockquote><p></p>
[QUOTE="Sean DonCarlos, post: 93715, member: 152"] It's not hard at all...just a few lines will do it. [CODE]using namespace System; double baseSpeed, finalSpeed, baseAngle, finalAngle; Random ^ rng = gcnew Random; ... finalSpeed = baseSpeed * (0.9 + (rng->NextDouble() * 0.2)); // final speed is random value between 90% and 110% of base speed finalAngle = baseAngle - 5 + (rng->NextDouble() * 10); // final angle (in degrees) is random value within 5 degrees of base angle ...[/CODE] Or if you wanted to get fancy and plan ahead for a user-adjustable "Kickout Variation" option in the future: [CODE]using namespace System; double baseSpeed, finalSpeed, baseAngle, finalAngle; double kickoutVariation = 0.1; // value from 0.0 to 1.0 from a user-adjustable slider somewhere that controls how "random" kickouts should be, default = 0.1 Random ^ rng = gcnew Random; ... finalSpeed = baseSpeed * (1 - kickoutVariation + (rng->NextDouble() * 2 * kickoutVariation)); // final speed is base speed times a random value between (1 - userVariation) and (1 + userVariation) finalAngle = baseAngle - (50 * kickoutVariation) + (rng->NextDouble() * 100 * kickoutVariation); // final angle (in degrees) is random value within (50 * userVariation) degrees of base angle ...[/CODE] Or for extra realism, since most physical machines are not completely random but generally have a "typical" kickout that happens most of the time, and only sometimes do they vary and surprise the player: [CODE]using namespace System; double baseSpeed, finalSpeed, baseAngle, finalAngle; double kickoutVariation = 0.1; // value from 0.0 to 1.0 from a user-adjustable slider somewhere that controls both the chance and the magnitude of a "random" kickout, default = 0.1 Random ^ rng = gcnew Random; ... if (rng->NextDouble() < kickoutVariation) // as kickoutVariation increases, random adjustments to the kickout both happen more often and are larger in magnitude { finalSpeed = baseSpeed * (1 - kickoutVariation + (rng->NextDouble() * 2 * kickoutVariation)); // final speed is base speed times a random value between (1 - userVariation) and (1 + userVariation) finalAngle = baseAngle - (50 * kickoutVariation) + (rng->NextDouble() * 100 * kickoutVariation); // final angle (in degrees) is random value within (50 * userVariation) degrees of base angle } else { finalSpeed = baseSpeed; finalAngle = baseAngle; } ...[/CODE] And so on and so forth... [/QUOTE]
Verification
Post reply
Members online
No members online now.
Latest posts
D
Anyone still playing?
Latest: Dan
Mar 3, 2025
The Pinball Arcade / Farsight Studios
Home
Forums
Farsight Studios
Pinball Arcade Tables
Bally Tables - Retired Tables
Twilight Zone (1993)
My impressions as a TZ machine owner
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Accept
Learn more…
Top