Universo Online Web Sites Pessoais
Digital Bumper - A Visual Pinball page
Download the
Latest Releases
Bomb Squad Beta 0.1
Eight Ball Pool Beta 0.7
Click on the screenshot to know more about the tables.

Bomb Squad Beta01
Bomb Squad

-

Eight Ball Pool Beta07
Eight Ball Pool

Digital Bumper - Developing pinball tables with VISUAL PINBALL

VISUAL PINBALL

News
Introduction
VP Design FAQ
Code Samples

MY TABLES

Eight Ball Pool
Bomb Squad
Shooting Gallery

EMULATION

PinMAME

LINKS

Tables

Visual Pinball Design FAQ

The information on this FAQ was collected from answers Randy Davis (Visual Pinball creator) has posted on the VP Forum. It's not very well organized yet but I think it still a good resource for designers. It's a good thing to read the FAQ before posting any design questions to the VP Forum. 
This FAQ is far from being complete, I'll be adding more information weekly. Check for updates. There's also the official VP FAQ at www.VisualPinball.com .

1. Getting Started
2. Scrolling textbox and texbox background
3. Kicker Radius
4. Changing the background color in the player window
5. Transparency on ramps
6. Magnets
7. Applying textures to sides and ramps
8. Setting the height of every ramp
9. Ball clearence
10. Control Points
11. Ramps
12. Reducing the size of the vpt file
13. Random number generator
14. Kickers
15. Auto-plunger
16. Triggers on ramps
17. Music and WMA
18. Match Number
19. Illumination and blink interval
20. Table size images and selecting objects
21. List of features of Tech Beta 3 (dogfood3)

1. Getting Started


Although there is no great tutorial yet, you can learn most of what you need for simple tables functions from the pre-existing tables. If you create a new table, it already includes script to create a ball, and operate the flippers and the drain. The code you want for creating a ball is in Plunger_Init, where it calls Plunger.CreateBall.

2. Scrolling textbox and textbox backgroung

When I was looking for a a good display font, I was only able to find that LED font that comes with VP. I was planning on making it non-proportional someday to better support scrolling. I do still like the bold look of it. I plan to have a texture as a background for a textbox someday, although I'm not sure how the effect will be if you try to position text perfectly over the dimmed texture (Since everything has to scale up/down perfectly). Actually, this setup might be possible someday - One textbox with a black background, constantly filled with the dimmed lights. Then a textbox on top of it with a transparent background, with contains the actual text. But of course that's all in the future...
I haven't done any work to create a full-fledge dot-matrix display, since I had to question how many people would have the patience to sit down and creating animations for it, but it is possible to get a scrolling text box. Here is how to create a simple looping message in VP:

Create a Textbox called MyTextBox, and change it's font to be the LED font that comes with VP. Make it big enough to hold, say, 10 characters.

In script:

Dim MyText
'Global variable that contains the entire message to be scrolled
Dim CurrentScrollPosition
'How far through the scroll we are
sub Table1_Init()
'or whatever function you want that sets the message
MyText = " Hello this is my scrolling message "
'pad with spaces so message doesn't pop onto screen
CurrentScrollPosition = 1
MyTextBox.TimerInterval = 250
'Scroll one character every 250 milliseconds (1/4 second)
MyTextBox.TimerEnabled = True 'Let 'er rip
end sub

sub MyTextBox_Timer()
MyTextBox.Text = Mid(MyText, CurrentScrollPosition, 10)
'Mid is a built in function to return a subset of a string
CurrentScrollPosition = CurrentScrollPosition + 1
if (CurrentScrollPosition + 10 > Len(MyText)) then
CurrentScrollPosition = 1
end if
end sub

3. Kicker radius

I think what I'm gathering about kickers is that people want to be able to set a radius for them to use as holes. I guess I hadn't anticipated the need for strategic holes - I use the kicker as a drain as kind of a cheat. But it is pretty easy to add a radius option. Drawing holes will be another trick altogether.

4. Changing the background color in the player window

Currently (with Tech Beta 3) you can change the background color and put a picture back there.

5. Transparency on ramps

Semi-transparency is something I really want to do, but there are a lot of issues with it. I will keep thinking about it.

6. Magnets

Magnets would not be too hard - I wasn't sure if they would be a popular item or not. It's difficult to recreate the wonder of a hidden magnet on a computer. In real life, if a metal ball suddenly defies gravity, it's amazing - on a computer, it looks more like a drawing error.

7. Applying textures to sides and ramps

Applying textures to ramps and flipper would be cool - I'm a little afraid though, I've had some pretty weird descriptions of what textures certain people want to put on the flippers. As with a lot of things, that feature is on a giant list. Texturing walls will almost certainly be in at some point in time, since that is a key feature of drop-targets. Rubber and plastic posts should be covered by an upcoming overhaul of allowing the user to change the properties of render wall edges.

8. Setting the height of every ramp point

I do want to allow the user to edit the height at every ramp point, but I ran into a couple problems. Mostly, it's difficult to sculpt the perfect 3D ramp in a 2D editor. Not impossible, but it takes patience.

9. Ball clearence

The ball needs at least 50 for clearence. Right now you will find that it needs less because the bottom of walls are not hit-tested at all, but for future compatibility make it 50. Actually, make it like 50.01 to account for round-off errors.

10. Control Points

VP uses a derivative of B-Spline curves, the generally accepted method of producing curved surfaces in design applications. The difference between the most common B-Spline, Bezier, and VP is in VP the line goes through all control points, instead of having control points which only 'suggest' the line. The hope is that this would make it more intuitive for people not used to creating curved lines. When you look at all the control points in some of the more extravagent tables, you can imagine how confusing it might be if the points weren't actually on the lines but instead floating in space. In general, anything you can do with a Bezier you can do in VP, although the control points won't go in that exact same places.
As a side note, no B-Spline can reproduce a circle perfectly, as far as I'm aware. A B-Spline will always be polynomial and not circular. With a few points, though, you can't tell the difference.

11. Ramps

Ramp walls are higher than they look, I made it that way because balls had a tendency to fly off at high speeds, but it looks good to see the ball instead of it being hidden. But 100 should be enough to clear it. I will try this out and let you know. It looks like the wall height was a bit high - it needed 89 clearance. Since some parts of the ramp are higher than other, it could certainly the case that an apparent clearance of 100 would still hit. I have changed some of the physics since I had my previous problems, so I lowered the wall height, and it seems to work okay in Top Speed (where the ball would ride up the left wall and fall off if hit too hard). Now it only needs 50 clearance (for two horizontal ramps crossing each other.) This will be in the upcoming release.

12. Reducing the size of the vpt file

The tables are not encrypted, although I've thought about it. The bitmaps are LZW compressed, which is the best non-lossy compression I know how to do. The thing that adds up and doesn't compress well at all are wav files. Top Speed is 101K saved without images or sounds. I use 22KHz mono sounds, to save some space over 44/stereo. (Note: Another tip to reduce the size of the vpt file is to decrease the color depth of your bitmaps to 8-bit. This was pointed out by Boris).
Splitting the table into multiple files is probably a good idea. I might do that for the VP download too, so people will have less problems getting it. I thought long and hard about whether to have graphics and sound seperate from tables. I finally concluded that since graphics and sounds were not really sharable between tables, and since it's a lot easier for the user to not have to keep all the files straight, that it would all just be one big lump (except for the font files will are seperate currently). That is a good point about beta versions though - its a lot easier if you don't have to get everything. The best I can offer for now is that you could allow people to download the pieces seperately, and they could import them themselves. You could make a version of the table that just had 1x1 bitmaps for everything until they were reimported. Not such a great solution, but hey I'm trying to use the creative part of brain here. Perhaps in the future it could work like this. If you had MyTable.vpt, when it loads, VP would also look for MyTable.vpr, and if it finds it, loads resources from it. Then it could be mix'n'match.

13. Random number generator

Random numbers are built into VBScript. You can look at the page for the Rnd function, in the VBScript reference listed on the VP reference page. Basically you call Rnd(1), which returns a number between 0 at 1. Then you take that and multiply by your range (i.e. (Rnd(1) * 3) + 1 would get you a number from 1-4). When the table starts, call Randomize to make it set the random seed off the clock, and then when you need a random number call Rnd(1). Top Speed does this to select a randomly blinking target in the function NewLight(). There are other things you can do with Rnd for I forget them off the top of my head. I have been thinking about including a random number generator from VP itself. That way, VP could record a game and play it back just by recording user input. If you use random numbers from VBScript, though, you wouldn't be able to get the same game! That's in the future though.

Taken from the VBScript reference:
"To repeat sequences of random numbers, call Rnd with a negative argument immediately before using Randomize with a numeric argument. Using Randomize with the same value for number does not repeat the previous sequence."

14. Kickers

Kicker.Kick is one of those things that really needs to be documented. The format is:

Kicker.Kick Angle, Speed.

To get the kicker to delay, use the timer. Both Top Speed, Alien Reactor, and many user tables use this. Set up the Kicker timer interval to the desired number of milliseconds (1000 would be 1 second) in the options panel.

Sub Kicker1_Hit()
Kicker1.TimerEnabled = True
End Sub
Sub Kicker1_Timer()
Kicker1.Kick angle, speed
Kicker1.TimerEnabled = False
End Sub

You can do site-to-site transport with kickers. Create the 'from' kicker, and create the 'to' kicker and make it disabled. When the 'from' kicker gets the hit event, destroy that ball, create one in the 'to' kicker and kick it out as appropriate.
For vertical kickers, would you rather the interface take an angle upwards, or just an upward force. So it could be:

Kicker.Kick Rotation, Force, [Inclination]

or

Kicker.Kicker Rotation, Force, [Upward Force]

Either way it can be an optional parameter so existing code still works.

15. Auto-Plunger

A kicker can work as an auto-plunger. For a neat looking auto-plunger, you can look at Wild West by Mimuklas. It has a plunger which is manual part of the time, but then goes to automatic when it needs to spit out multiballs and such. It's a pretty cool idea.

16. Triggers on ramps

Triggers on ramps now works on Tech Beta 3.

17. Music and WMA

When I mentioned using WMA for sounds, I was thinking more of decompressing them at load, turning them back into samples for faster play. Trying to play everything as WMA on the fly would not be good. I know there are plenty of performance problems with WMAs. I hope they can be sorted out. The only way to fix that pause at the start may be to preload all the music, I'm not sure. (The music libraries apparently aren't clear on the whole point of 'streaming'). My problems with wma actually have nothing to do with the quality of the music - the quality is great at small file sizes. The reason is the inability of the wma libraries to do things like allow the app writer to decide when the music stream gets decoded, and how much and how fast. So, there are very few ways for me to try to find workarounds for the current music problems in VP besides crossing my fingers and trying various ritual dances. Thus, changing music libraries starts to look better and better. Now if XAudio was able to do wmas, that would be perfect.
Music does go into the music directory. Make sure you have the music runtimes listed on the download page. I'm not sure if installing media player 7 will get all the right files - there may be some old version 4 files that need to be still installed.
The PlaySound and PlayMusic functions in VP are native, they are not VBS functions. They do not currently but will support looping, but this is the plan:
PlaySound will be able to loop N times or infinitely PlayMusic will fire an event when done so you can either start it again or play a different track. They are both always asynchronous. The way I understand it, VB calls PlaySound through the windows API, which VBS can not do.

18. Match Number

VBScript supports the mod operator, so it should be as easy as this:

if MatchNumber = (Score Mod 100)

A Mod B returns the remainder when you divide A by B.

19. Illumination and blink interval

Doing things with illumination is cool, but tricky to make it look real without actual making it be real, which takes up a huge amount of processing. By changing the intenity of existing lights, do you mean on the fly, like being able to have a light ramp up to full bright? Or just to have a darker light. You can make a darker light by changing the color to a darker value.
Setting the blink interval of a light will reset the timer, but it shouldn't do anything to the pattern. I can see how it might look choppy though if this happened:

Light.BlinkInterval = 500, pattern = 10

Timer.Interval = 2000 (light blinks 4 times before changing timing)

When the clock hits 2000, the timer gets called, and changes the blink interval to 250. But this resets the light, so the light, which was just about to turn on, waits another 250 ms, giving the appearance of slowing down before speeding up. This could be solved by checking the lights first instead of the timers first in VP. I don't know if this is the right thing to do. Another way to fix it would be to set the light pattern to 10 again when setting the interval - that would reset the pattern and make it change.

20. Table size images and selecting objects

There is no real 'correct' size for table images - any image will stretch to cover the table. If you go to the menu item File/Export/Blueprint, it will spit out a bmp that you can open in a paint program, and paint over your layout. Then you can just import that image back into the editor. I think the image it spits out is 512x1024, although I'd like to make this changable.
Although you can't hide or ghost an object in the editor, if you right click it and tell it to 'draw in back', it will go beneath all other objects. So you could have a wall which is technically above some lights, but which is drawn in the editor as being beneath so that you can select the lights.
At some point in time I plan to do a renovation of wall edges so that you can select things like making it look like it is poles with a band around them. Also, I am going to allow the user to select what material a wall section is made of to determine how much the ball should bounce off of it.

21. List of features of Tech Beta 3 (dogfood3)

-Flipper Rubber
-Kicker rendering - hole, cup, hidden
-Flipper strength
-Slingshot strength
-Physics of nudging improved - nudge strength will probably have to be recalibrated on your table
-Backdrop layout - image, color, lights, decals, textboxes
-Faster table rendering
-Improved editor speed
-More robust file format. It is more likely that going forward, old versions will be able to load newer files, just without the new features.
-Kickers can kick up as well as out. (Kicker.Kick angle, speed [,inclination])
-Subtle physics improvements
-Undo and file change notification now works on main table options
-Timers on flippers and walls work
-Spinners respect the transparency color set in the image manager for true shaped spinners.
-UserDirectory script function: provides a place to put user files created in script
-Control of bumper light state
-Bumper image now works
-Bumper side color
-Bumper shape and default values altered to more closely reflect real life
-Sounds can be looped, and stopped on command
-Textboxes with transparent background
-Flipper visibility property (to bring flippers into existence when needed, or to simulate zipper flippers.)
-Objects can be placed on ramps, as well as on walls.