Jump to content



Photo
- - - - -

Demo - Ball Rolling Sights and Sounds


  • Please log in to reply
28 replies to this topic

#1 rascal

rascal

    two-faced as they come

  • VIP
  • 1,374 posts
  • Location:Indiana USA

  • Flag: United States of America

  • Favorite Pinball: Bally Eight Ball



Posted 28 March 2010 - 05:33 PM

Demo - Ball Rolling Sights and Sounds



Version: 1.1.0
Category: Tutorials

Author(s): Rascal

Description:
This is a demo table for making a VP table with ball rolling enhancements. Both sights and sounds.
This table uses 8 ball images to simulate it rolling. This is done without using the front and back image decals in VP, so the entire ball rolls.

It also has a ball roll sound scripting as they should go together. This demo works in VP9 and VP8.

Version 1.1 is way smaller now. The images I used for the ball were way too big... sorry.

View File

Submitted by rascal, on Mar 28 2010, 01:33 PM

Posted Image


#2 unclewilly

unclewilly

    sofa king.....

  • VIP
  • 5,173 posts
  • Location:Baltimore, Maryland

  • Flag: United States of America

  • Favorite Pinball: tz, tom, big hurt, who dunnit



Posted 28 March 2010 - 06:08 PM

thanks rascal, can't wait to check it out. rolling sounds add alot to the table. you might consider adding the ball collision engine pinball Ken and steely developed in this demo to give the full ball sounds for a table. I appreciate it.

"it will all be ok in the end, if it's not ok, it's not the end"
 
Monster Bash VP10 WIP https://dl.dropboxus... (vpx)WIP15.vpx

uw2.gif


#3 rascal

rascal

    two-faced as they come

  • VIP
  • 1,374 posts
  • Location:Indiana USA

  • Flag: United States of America

  • Favorite Pinball: Bally Eight Ball



Posted 28 March 2010 - 06:13 PM

I'm already modifying it, so hold off on downloading please. I will announce when ready. Sorry.

Posted Image


#4 rascal

rascal

    two-faced as they come

  • VIP
  • 1,374 posts
  • Location:Indiana USA

  • Flag: United States of America

  • Favorite Pinball: Bally Eight Ball



Posted 28 March 2010 - 06:26 PM

Ok version 1.1 is now uploaded. I had each of the 8 ball images at 380 X 380, which was not necessary as the ball is only 60 X 60. So I reduced the images and they should paint faster and the file is much smaller. Sorry for being in a hurry to upload it. fool.gif

Posted Image


#5 Gravy

Gravy

    Pinball Fan

  • VIP
  • 1,147 posts

  • Flag: Australia

  • Favorite Pinball: Simpsons pinball party



Posted 29 March 2010 - 03:04 AM

QUOTE (rascal @ Mar 29 2010, 05:26 AM) <{POST_SNAPBACK}>
Ok version 1.1 is now uploaded. I had each of the 8 ball images at 380 X 380, which was not necessary as the ball is only 60 X 60. So I reduced the images and they should paint faster and the file is much smaller. Sorry for being in a hurry to upload it. fool.gif


This is awesome work Rascal. I think people could enhance it with some different roll sounds but its a very good base to work with.

The ball images do appear to have a flat spot on the left hand side when I play it and Im not 100% sure if thats a result of the images or some other problem.

Perhaps this idea could morph even further whereby the script detects ball direction as well as speed and inserts an appropriate image to match direction, ie... if the ball is heading in a diagonal direction from lower left to upper right, insert a sequence of images that have a diagonal blurring of a scratch texture so that it adds even more realism.

Well done and thankyou, I hope people use this.

Pinball Addict


#6 rascal

rascal

    two-faced as they come

  • VIP
  • 1,374 posts
  • Location:Indiana USA

  • Flag: United States of America

  • Favorite Pinball: Bally Eight Ball



Posted 29 March 2010 - 11:10 AM

QUOTE (Gravy @ Mar 28 2010, 10:04 PM) <{POST_SNAPBACK}>
QUOTE (rascal @ Mar 29 2010, 05:26 AM) <{POST_SNAPBACK}>
Ok version 1.1 is now uploaded. I had each of the 8 ball images at 380 X 380, which was not necessary as the ball is only 60 X 60. So I reduced the images and they should paint faster and the file is much smaller. Sorry for being in a hurry to upload it. fool.gif


This is awesome work Rascal. I think people could enhance it with some different roll sounds but its a very good base to work with.

The ball images do appear to have a flat spot on the left hand side when I play it and Im not 100% sure if thats a result of the images or some other problem.

Perhaps this idea could morph even further whereby the script detects ball direction as well as speed and inserts an appropriate image to match direction, ie... if the ball is heading in a diagonal direction from lower left to upper right, insert a sequence of images that have a diagonal blurring of a scratch texture so that it adds even more realism.

Well done and thankyou, I hope people use this.

Thanks Gravy, I wanted to keep it simple at first so that everybody can use this code. I was prepared to do frames of different angles and I was planning on it. I was supprised to see how just the eight frames always going in the same direction actually appear to change directions depending on the direction of the ball. The roll was definately more defined when I just had a gray ball with texture, once I overlayed it with a semi transparent shiny ball, the roll became more subtle. In lowering the resolution of the balls from 380 X 380 to 60 X 60, I probably lost the true black edges on the ball, this is probably the flat area you are seeing. I will probably redo the balls, and maybe add some different balls to select from. Anyway, it's a start, and it gives authors an idea on how to use ball Vel speed to their advantage.

I may still try to do the directional spin, but that entails a lot more images. Eight for each direction. I think that 21 images might do it as the first image can be reused in all directions. Then you can just subtract from the ballimagectr when the ball is rolling in a downward direction to reverse the frames, and add to the ballimagectr when going upwards. Same thing with right and left. I'll play around with this somemore to see if that is worth the hasle.

As for the sound, it's a fine balance to get a sound that can be stopped in mid roll (when the ball hits something). The sound needs to be a pretty constant volume. The stop sound is a quick fadeout of the original roll sound (very small bite), just to help make the sound not sound like it ended short. It's not perfect, but with added game sounds and music, it blends in pretty good. Ideally it would be much nicer if we could script the volume levels of VP. Even fading from left to right balance would be awesome. Maybe that could be added to VP now that it is open sourced. Hell while we're at it, maybe the ball roll sights and sounds could be added straight to the VP source. wink.gif

Posted Image


#7 unclewilly

unclewilly

    sofa king.....

  • VIP
  • 5,173 posts
  • Location:Baltimore, Maryland

  • Flag: United States of America

  • Favorite Pinball: tz, tom, big hurt, who dunnit



Posted 29 March 2010 - 11:51 AM

hey rascal, I like this much better than the large trigger I've been using for ball roll sounds. have you by any chance tried it in a table with a lot going on to determine if there is any kind of CPU hit. a really appreciate this work. I wish I had more time to work on stuff like this. I think this will be a new standard in all my table releases from now on for ball roll sounds.

"it will all be ok in the end, if it's not ok, it's not the end"
 
Monster Bash VP10 WIP https://dl.dropboxus... (vpx)WIP15.vpx

uw2.gif


#8 rascal

rascal

    two-faced as they come

  • VIP
  • 1,374 posts
  • Location:Indiana USA

  • Flag: United States of America

  • Favorite Pinball: Bally Eight Ball



Posted 29 March 2010 - 01:35 PM

QUOTE (unclewilly @ Mar 29 2010, 06:51 AM) <{POST_SNAPBACK}>
hey rascal, I like this much better than the large trigger I've been using for ball roll sounds. have you by any chance tried it in a table with a lot going on to determine if there is any kind of CPU hit. a really appreciate this work. I wish I had more time to work on stuff like this. I think this will be a new standard in all my table releases from now on for ball roll sounds.

I have the ball rolling system in my unreleased Mata Hari table and I don't see any slowdowns from it. Noah and UncleReamus have it in their Silverball Mania table too. In fact, the script has been optimized even more in this demo release, because I used the Abs function to strip the sign from the Vel values, so it doesn't need to know if the ball is going up, down, right, or left.

Posted Image


#9 lettuce

lettuce

    Pinball Fan

  • Silver Supporter
  • 929 posts

  • Flag: England

  • Favorite Pinball: Monster Bash

Posted 29 March 2010 - 02:07 PM

This sound like it will work great, I really like jp's table as he has ball rolling sounds and really adds alot to a table. Can this script be easyly added to exsisting tables?

#10 rascal

rascal

    two-faced as they come

  • VIP
  • 1,374 posts
  • Location:Indiana USA

  • Flag: United States of America

  • Favorite Pinball: Bally Eight Ball



Posted 29 March 2010 - 04:31 PM

QUOTE (lettuce @ Mar 29 2010, 09:07 AM) <{POST_SNAPBACK}>
This sound like it will work great, I really like jp's table as he has ball rolling sounds and really adds alot to a table. Can this script be easyly added to exsisting tables?


The way the script is here now, it can be added to any table that has a single ball. Multiball tables would take more work. You can copy and paste the commented code from this table and paste it into the existing table. You have to extract and add the ball images to the table. Then you have to add two timers, Timer1 and Timer2, you would have to change the names of these timers and the script that goes along with them, if the table already has these timers used. Then do a search on CreateBall throughout the existing script and put "Set ball =" in front of the object that is creating the ball (Either a plunger or a kicker can create a ball).

Posted Image


#11 Shockman

Shockman

    Pinball Fan

  • VIP
  • 1,717 posts
  • Location:Portland Or.

  • Flag: United States of America

  • Favorite Pinball: Star Trek

Posted 29 March 2010 - 05:00 PM

Nicely done rascal.

#12 Bob5453

Bob5453

    I'm taking a nap

  • VIP
  • 3,896 posts
  • Location:Near Dayton, Ohio USA

  • Flag: United States of America

  • Favorite Pinball: Any table I can play while sitting in a rocking chair




  • Trophies:

Posted 29 March 2010 - 05:15 PM

That is awesome Rascal! The ball roll sounds are better than no sounds, not great, but I understand the problems of achieving this in a demo. The ball rolling visuals are fantastic! I can see this evolving into something big! How come you didn't use Faralos' custom plunger in this demo?

Posted Image

You have discovered an Easter egg. Pat yourself on the back.


#13 The Hermit

The Hermit

    Hobbyist

  • Platinum Supporter
  • 45 posts

  • Flag: United Kingdom

  • Favorite Pinball: .

Posted 29 March 2010 - 06:55 PM

Brillantly done! cool.gif

I've come up with some optimizations for the code you might like...

Replace the Timer2_Timer() code with this:
CODE
Sub Timer2_Timer()
    Dim BallVel 'Added variable that will hold the ball's combined X & Y velocity as a positive number
    BallVel = abs(ball.velx) + abs(ball.vely) 'Add the velocities together ignoring wether they are + or -
    'IF THE BALL IS STOPPED THEN TURN OFF TIMER1, ELSE TURN ON TIMER1 (SIGHTS)
    If Int(BallVel) = 0 then 'Round BallVel to a whole number then check if the ball is stopped (or very, VERY slow)
        Timer1.Enabled = False
    Else
        Timer1.Enabled = True
    End If

    'IF BALL IS ROLLING FASTER THAN A VELX SPEED OF 7 OR FASTER THAN A VELY SPEED OF 7 THEN PLAY ROLL SOUND,
    'ELSE IF VELX OR VELY ARE SLOWER THAN A SPEED OF 8 THEN STOP ROLL SOUND.
    'ROLL BOOLEAN SET TO TRUE OR FALSE TO STOP REPEAT OF SOUNDS
    If BallVel > 14 and roll = False then 'Is Ball moving fast? (Chose 14 as it was the sum of the X & Y checks)
        roll = True
        StopSound "rollstop"
        PlaySound "roll1"
    ElseIf BallVel <= 14 and roll = True then 'Is Ball moving slow
        roll = False
        StopSound "roll1"
        PlaySound "rollstop"
    End If
End Sub


This will decrease the length of time it takes to perform the routine by only checking the Ball Velocity once instead of four times and reducing the amount of ABS and INT functions used meaning the check is done more often! biggrin.gif

Edited by The Hermit, 29 March 2010 - 07:01 PM.


#14 rascal

rascal

    two-faced as they come

  • VIP
  • 1,374 posts
  • Location:Indiana USA

  • Flag: United States of America

  • Favorite Pinball: Bally Eight Ball



Posted 29 March 2010 - 08:15 PM

Thanks for the kind comments and suggestions. I will implement some of them in the demo.

Hermit, I think that it is necessary to separate the VelX from the VelY as the ball can go in a straight down/up direction and also right/left. At which point one of the other speeds would be close to zero and not adding up to 14. It could be vely = 7 and velx = 0 or the opposite at which point the ball is moving fast, but in only one direction. I'm talking mainly for the roll sound. For the ball rolling graphic part, combining them would be fine.

But I see what you mean about checking them once and assigning to a variable. Also if I am going to put direction into the ball spin, then I will need to know the + or - of each Val. I can gain that by using the Sgn function to a variable too.

@Bob - I would have put the ball plunger in this demo if I thought I was smart enough to figure it out. Now you just stop it Bob, you little instigator you. tease.gif

Posted Image


#15 The Hermit

The Hermit

    Hobbyist

  • Platinum Supporter
  • 45 posts

  • Flag: United Kingdom

  • Favorite Pinball: .

Posted 30 March 2010 - 07:39 PM

QUOTE (rascal @ Mar 29 2010, 09:15 PM) <{POST_SNAPBACK}>
Hermit, I think that it is necessary to separate the VelX from the VelY as the ball can go in a straight down/up direction and also right/left. At which point one of the other speeds would be close to zero and not adding up to 14. It could be vely = 7 and velx = 0 or the opposite at which point the ball is moving fast, but in only one direction.


Well the reason I have it adding the absolute VelX & VelY is to solve that problem! wink.gif
As you have it, you are checking a square set of velocities, where as my version is checking a circle. Not particularly important but can seem a little inconsitent in triggering the sound. For example if the X & Y velocities are both 6 then the ball is moving at a total velocity of 12 almost double that of moving at 7 in one axis and 0 in the other yet makes no sound! I think a value of 10 in my version would be closer to what you were expecting you checks to do in yours.

Let me try and describe what I mean...

As I said the original code checks a square of values and mine checks a circle, which I consider feels more natural! smile.gif Anyway, picture a square inside a circle where the corners are touching the circle but do not break outside. All the values inside the circle, but not in the square are additional speeds that the sounds won't activate. So if I changed the BallVel check to 10 this will reduce the size of the circle so that the corners now stick out and the area inside those corners is close to the area inside the sections of the circle that are outside the square and will appear to work almost the same as the original. Why didn't I stick with 7? Well in that case the circle is fully in side the square and seemed to trigger to often...

Did that make sense? I think I confused myself there! lol

Any way the main reason that I went for the "circle check" method was so that you could use different volumes of the sound for different speeds to make it even more "authentic".

I really hope that I've made that understandable. I'd have attatched a pic but can't see any way to do that! huh.gif

If you do decide to use directional spinning for the BallImage then yes you would need the SGNs of VelX & VelY. Again I would assign a variable for X with another for Y so that the If Then or what ever method you use doesn't have to recalculate it too often.

I can mock up an example if you like. smile.gif

#16 rascal

rascal

    two-faced as they come

  • VIP
  • 1,374 posts
  • Location:Indiana USA

  • Flag: United States of America

  • Favorite Pinball: Bally Eight Ball



Posted 30 March 2010 - 08:39 PM

QUOTE (The Hermit @ Mar 30 2010, 02:39 PM) <{POST_SNAPBACK}>
QUOTE (rascal @ Mar 29 2010, 09:15 PM) <{POST_SNAPBACK}>
Hermit, I think that it is necessary to separate the VelX from the VelY as the ball can go in a straight down/up direction and also right/left. At which point one of the other speeds would be close to zero and not adding up to 14. It could be vely = 7 and velx = 0 or the opposite at which point the ball is moving fast, but in only one direction.


Well the reason I have it adding the absolute VelX & VelY is to solve that problem! wink.gif
As you have it, you are checking a square set of velocities, where as my version is checking a circle. Not particularly important but can seem a little inconsitent in triggering the sound. For example if the X & Y velocities are both 6 then the ball is moving at a total velocity of 12 almost double that of moving at 7 in one axis and 0 in the other yet makes no sound! I think a value of 10 in my version would be closer to what you were expecting you checks to do in yours.

Let me try and describe what I mean...

As I said the original code checks a square of values and mine checks a circle, which I consider feels more natural! smile.gif Anyway, picture a square inside a circle where the corners are touching the circle but do not break outside. All the values inside the circle, but not in the square are additional speeds that the sounds won't activate. So if I changed the BallVel check to 10 this will reduce the size of the circle so that the corners now stick out and the area inside those corners is close to the area inside the sections of the circle that are outside the square and will appear to work almost the same as the original. Why didn't I stick with 7? Well in that case the circle is fully in side the square and seemed to trigger to often...

Did that make sense? I think I confused myself there! lol

Any way the main reason that I went for the "circle check" method was so that you could use different volumes of the sound for different speeds to make it even more "authentic".

I really hope that I've made that understandable. I'd have attatched a pic but can't see any way to do that! huh.gif

If you do decide to use directional spinning for the BallImage then yes you would need the SGNs of VelX & VelY. Again I would assign a variable for X with another for Y so that the If Then or what ever method you use doesn't have to recalculate it too often.

I can mock up an example if you like. smile.gif

Yes, I fully understand what you are saying and yes a value of 10 would probably work well. It was the value of 14, I thought would be to high. From what I'm seeing when I add two textboxes to display VelY and VelX, is that naturally VelY is the main trigger, because of the table slope and space to build up speed. Plus, you are always flipping the ball in an upward direction. I would say without going off something like the bumpers, the average VelX value is around 3 or 4. So yes a combined value of 10 would probably work out quite well. I will do some more experimenting with that too.

I appreciate your interest and input in this project, and by all means, feel free to mod it if it makes it better... really. It can be a group project or open source if you like, whatever is best for the community I say. Just PM me with your revisions and add your name to them. I will upload it as a new upgraded version here and list your changes with credit to you. I'm not married to it, I just opened a new direction to go in. The next obstacle for me now is trying to add a ball reflection... if possible. One that would be independent of the playfield colors. Got any ideas for that?

This is what the VP and FP community is all about... ideas and building on ideas. Imagine what our tables would look like if we didn't venture off from the standards.

Posted Image


#17 Gravy

Gravy

    Pinball Fan

  • VIP
  • 1,147 posts

  • Flag: Australia

  • Favorite Pinball: Simpsons pinball party



Posted 31 March 2010 - 12:42 AM

scapino did have a bit of a play with ball reflection (matahari i think) but the texture swaps were a little too obvious. There was spaceshuttle released years ago which prerendered the ball in nearly every possible position and changed the texture accordingly to its position, brilliantly done really but must have been a huge amount of work.

I think the checkerboard transparency texture on the ball makes for a reasonable reflection method as well, though not perfect of course.

If we can turn on alpha transparency within the vp code itself that would be a help.

Pinball Addict


#18 The Hermit

The Hermit

    Hobbyist

  • Platinum Supporter
  • 45 posts

  • Flag: United Kingdom

  • Favorite Pinball: .

Posted 31 March 2010 - 05:07 PM

QUOTE (rascal @ Mar 30 2010, 09:39 PM) <{POST_SNAPBACK}>
[SNIP!]The next obstacle for me now is trying to add a ball reflection... if possible. One that would be independent of the playfield colors. Got any ideas for that?


Are you talking about the reflection of the table on the ball or the refection of the ball on the table?

And I do like venturing off from the standard... As yet everything I've released for VP hasn't really been a pinball table! wink.gif

#19 Noah Fentz

Noah Fentz

    'Rasslin' Fan

  • VPF Administrator
  • 12,271 posts
  • Location:South Lyon, MI

  • Flag: United States of America

  • Favorite Pinball: Whitewater

  • PS3 Gamer Tag: noahfentz


Contributor

Posted 31 March 2010 - 05:19 PM

I implemented ball reflections in Silverball Mania based on where the ball was, you'll see reflections of light and table objects.

If it's a ball reflection in the playfield surface you want, I fear creating/destroying a ball that much would slow VP to a crawl, but I've never tried it myself.

IdleReel.gif RumbleDMD.jpg HS2-DMD.jpg SBM.jpg ww_logo.jpg EK.jpg

 
T2.jpg Sorcerer.jpg Breakshot.jpg Firepower.jpg GorGar.jpg StarTrek.jpg


My Photobucket Resources
Whether You Believe You Can, Or You Can't, You Are Right." - Henry Ford
The future of pinball lives, it just needs to be nurtured!
If you're here to stab me in the back, you're going to have to get in line.


#20 rascal

rascal

    two-faced as they come

  • VIP
  • 1,374 posts
  • Location:Indiana USA

  • Flag: United States of America

  • Favorite Pinball: Bally Eight Ball



Posted 31 March 2010 - 05:30 PM

QUOTE (The Hermit @ Mar 31 2010, 12:07 PM) <{POST_SNAPBACK}>
QUOTE (rascal @ Mar 30 2010, 09:39 PM) <{POST_SNAPBACK}>
[SNIP!]The next obstacle for me now is trying to add a ball reflection... if possible. One that would be independent of the playfield colors. Got any ideas for that?


Are you talking about the reflection of the table on the ball or the refection of the ball on the table?

And I do like venturing off from the standard... As yet everything I've released for VP hasn't really been a pinball table! wink.gif

Reflection of the ball on a finely waxed playfield. Like they have in FP.

Posted Image