by walamab

More on my attempt to model Whirlwind in VPX

September 15, 2016 in posts

So I “installed” all of the plastics and a couple of home grown primitives Red ramp Flashers and Skyway Toll Booths). I also tried to finish the cabinet components surrounding the table (sort of).  It still needs a lot of detail work to look just right but I’m well on my way. I haven’t worked on the script in a couple of days. I’ll pick that up this weekend. Oh and it needs an Apron. I’ll try to knock that out this weekend too.

Its beginning to look like a pinball machine

Its beginning to look like a pinball machine

by walamab

A break from VPX for dummies (like me)

September 13, 2016 in posts

So I know I said I would cover lighting in my next post but…well…I think I’ll do that later. What I am posting is a VERY early screen shot of my current learning project Whirlwind. I started this table to learn more advanced aspects of VPX. Namely turntables and subways. I also wanted to try my hand at creating primitives in Blender. So here’s the screenshot.

No plastics yet and only somewhat playable

No plastics yet and only somewhat playable

So, I’m having issues that I think are related to timing with a couple of the solenoid callbacks. The disc/wheel animations, when on, look fine but the solenoid that controls the motor seems to pulse them so they constantly start and stop. There may be a way to code around this but I haven’t figured it out yet. So I’ve moved on to areas of the table that I know I get working to give myself time to think about solutions to the problems. I’ll publish the table for beta tests to anyone that wants it and I’ll publish for the general public once it has been adequately tested.

I’d love suggestions on how to handle the disc problem

…comment away…

by walamab

VPX modeling for dummies (like me) 1 of many

September 2, 2016 in posts

General thoughts before starting

1) Be smart with the table you first want to model. I started with something that didn’t have a lot of ramps, toys or mechanics (i.e. moving Dracula, lowering drawbridges or spinning lamps). If you want more of a challenge, then by all means jump right in. However, I won’t cover these items because I haven’t tried to implement them…yet :).

2) Photoshop (or similar) application skills are a must to build independently. I won’t try to teach Photoshop here.

3) VB and/or VBScript knowledge is also a must. However, I’ll include enough examples in this tutorial to give plenty of fodder for “hacking” things together.

3) Save non-playfield lighting for last. Trying to select playfield items (lights, walls, kickers etc.) is a real pain if you’ve already put in all of the GI lighting effects. If this doesn’t make sense it will later in this tutorial.

4) Start from a blank table. In VPX, clicking “new” gives you a table with bumpers, slingshots and other assorted items to start with. It also gives you scripts for these items. I learned that ultimately using the provided code can mask problems in the way a re-creation operates as compared to the real table. However, don’t through everything away. the side rails, lockdown, plunger, and primitive posts, pins and bumper caps are useful.

5) Don’t try to finish in a day.

6) Comment your script. It will help when you come back to it to fix things and it helps others that may be trying make adjustments to your table.

7) When you finally publish a Beta, pay attention to the posts of those trying it out. I received excellent advice from the community on lighting and physics that I would otherwise never have adjusted.

Assumptions

1) You already have a working installation of VPX

2) You already have  a working installation of VPinMame (and optionally directB2S)

3) You have collected graphics resources for the playfield, plastics and other items on the table. Some of these you will need to create/find/edit during the modeling process. The main thing is the playfield to get started.

4) You have reference materials to provide the light, switch and solenoid numbers for the real machine you are modeling.

5) You have a properly obtained ROM for the table you are re-creating.

 

 

Get started

Setup

Make sure the Options button  is toggled on in VPX. This ensures you have access to all of the parameters that need to be set for the Table and other objects you place on the playfield.

Under the “Table” Menu item, pick “Image Manager…” (Table->Image Manager…). This interface lets you import your collected graphics into VPX so they can be used with the elements you place on the playfield (and the playfield image itself). Click the import button then browse to the location on your system where your images are stored. Select one or more images and click “Open”. This will add the images to the list and make them “pickable” from the drop downs in the options interface. Generally I would recommend using .png files because they maintain the alpha channel (i.e. transparent) part of the graphics rather than just filling it with a solid color and they are generally smaller in size than other formats.

Next add two timer objects to the editor. Name the first one PinMameTimer and the other PulseTimer. Enable both timers and set PinMameTimer Timer Interval to 1. Set the PulseTimer Timer Interval to 40.

Start the framework for your code. Click the Script  button to bring up the scripting window. Go ahead and delete everything that is included in the script by default. You will want to write your own functions based on what is included in this tutorial.

The first non comment command in the script should be

Option Explicit

 

This command forces the declaration of all variables. Each variable must be “explicitly” dimensioned using a “Dim” statement.

 

 

Next we need to setup the controller that VPX will use for executing the game. VPX includes a nice addition that handles the setup/selection of the controller for your particular setup. It is either VPinMame, B2s Server or UVP. To set this up add the following somewhere after the Option Explicit statement.

On Error Resume Next

ExecuteGlobal GetTextFile(“controller.vbs”)

If Err Then MsgBox “You need the controller.vbs in order to run this table, available in the vp10 package”

On Error Goto 0

 

These statements look for controller.vbs and this in turn looks for controller.txt to retrieve your controller preferences. Controller.txt is created the first time you run a VPX table that uses this construct by presenting a dialog asking about DOF and other items.

 

You will now need to know what controller or computer system the table you are modeling ran/runs on. This information should be included in the references that have the switch and solenoid numbers. There are .vbs files for each of these included with VPX in the Scripts folder. They have names like S6.vbs, S11.vbs, WPC.vbs or stern.vbs. The contents of these scripts really isn’t that important to understand you just need to include a snippet of code to reference the appropriate system. That snippet is as follows

 

LoadVPM “01560000”, “S6.VBS”, 3.26

 

In this case, I am using  System 6 from Williams hence “S6.VBS”. To use a different system just replace the .VBS file name with the system for the table you are modeling. Other system entries would look like the following

 

LoadVPM “01560000”, “S11.VBS”, 3.26 – for Williams System 11

LoadVPM “01560000”, “WPC.VBS”, 3.26 – for newer Williams Machines

LoadVPM “01560000”, “stern.VBS”, 3.26 – for Stern Pinball machines

 

Next, you will need to set a Const variable with the name of the ROM that will control your table. Add the following to the script

Const cGameName = “XXXXX_XXX” – The X’s should be replaced with the ROM name you are using like frpwr_b6 or st_161

A Const variable cannot be reassigned or re-allocated by the script once it is established. Technically you can call this variable anything you want (other than cGameName) however this seems to be the general convention by other table modelers. The main thing is that this variable name is used consistently in other parts of the script.

Table Name and Playfield Back Ground Image

Before we can continue coding we need to set  some items in the VPX editor. Clicking in the blank space around the new table will bring up the “Table” parameters in the option GUI. Change the “Name” box to the name of the table you are modeling. I would not suggest trying to track version numbers here because the init routine in your code will reference this name. You don’t want to have to change your script just because you made a slight modification to this field. Under the Playfield Graphics tab  There are 2 dropdown boxes. One for material and one for Image. Set the Material box to “Playfield”. This is a material included by default that makes the reflections and such look right when the table is run. Set the Image box to the playfield graphic you imported during setup. Once selected the playfield image will appear in the main editing window.

Table Initialization

You will need to setup the code that initializes the table when it starts. In the script windows there are 3 drop down boxes across the top. In the left most box select the table name you typed in the Table options Name box in the previous step. Then, in the middle box select “Init”. If you left the table name as the default this will create a subroutine called

Sub Table1_init()

End Sub

If you changed the name of the table, Table1 will be replaced with the name you gave the table i.e. Sub Firepower_init(). All of the tables initialization code goes in this subroutine. I will use the default Table1 for my examples. The first items in this subroutine should be as follows:

Sub Table1_init()
vpmInit Me
With Controller
.GameName = cGameName
If Err Then MsgBox “Can’t start Game ” & cGameName & vbNewLine & Err.Description:Exit Sub
.SplashInfoLine = “Table1 by Manufacturer Date” & vbNewLine & “Created for VPX by Your Name”  ‘This line is for editing the VPinMAME spash screen
.HandleKeyboard = 0
.ShowTitle = 0
.ShowFrame = 0
.HandleMechanics = 0
.ShowDMDOnly = 0
.Hidden = 0
End With
Controller.Run

PinMameTimer.enabled = 1

Notice the use of cGameName in this subroutine. This is where the connection to the ROM is made. The other options .Hidden, .HandleKeyboard etc. are well documented and won’t be covered here. However I will say that these control what items VPinMAM will display or control.

The table should run at this point but won’t do anything because we haven’t told it what to do. We’ll leave the script for now work in the editor

Playfield Light inserts (not GI)

Other than the playfield image, playfield lights may be the easiest item to get working and, for me, gave me confidence that I was going to be able to succeed.

For each playfield light/insert (not General Illumination (GI)), place a light object  on each light location based on your research material and playfield image. Manipulate and add control points to follow the outline of each playfield light. For each of these lights put the lamp/light number from the documentation in the “Timer Interval” field under the Misc tab for the light object. I’m not sure why this particular parameter was chosen but I imagine it was available  and not likely to be needed for a light object. This number will be used by VPinMame to automatically control lights and light animations from the ROM once added to the script. Once you have placed each light. select them all and add them to a collection called “AllLights” or something else descriptive. To Create the collection click the Table menu item and selection manager. Click “New” then select the newly created collection and then click “Rename”. Rename the collection to “AllLights”. Next click edit to set properties of the collection. Generally, I uncheck “Group Elements Together” on this screen. You can add all the lights you created here or right click on them, selecting “To Collection” and then picking the AllLights Collection name. To activate control of the lights by the ROM, add a line to the Table1_init() script as follows.

vpmMapLights AllLights

Where AllLights is the name of the lights collection you just created.

Table1_init should now look something like this

Sub Table1_init()
vpmInit Me
With Controller
.GameName = cGameName
If Err Then MsgBox “Can’t start Game ” & cGameName & vbNewLine & Err.Description:Exit Sub
.SplashInfoLine = “Table1 by Manufacturer Date” & vbNewLine & “Created for VPX by Your Name”  ‘This line is for editing the VPinMAME spash screen
.HandleKeyboard = 0
.ShowTitle = 0
.ShowFrame = 0
.HandleMechanics = 0
.ShowDMDOnly = 0
.Hidden = 0
End With
Controller.Run

PinMameTimer.enabled = 1

vpmMapLights AllLights

End Sub

When you run the table, the table light animations from the ROM should be displayed.

I’ll cover how to make the lights look real in my next post on this subject. Stay tuned….

©2019 VPinBall.com

Log in with your credentials

or    

Forgot your details?

Create Account