DVDSTEPBYSTEP.COM  
Friday Oct 19, 2018

DVD STUDIO PRO

FAQS

The Lay Of The Land

Fast Track From Final Cut Pro to DVD SP

Quick Menu From Photoshop to DVD SP

Using VTS Views

Setting Build Folder

Quick Compressor Overview

Layered Menus

Transitions In Menus

Rotating Drop Zones

Quick Mapping (early verions)

More Mapping Examples

Using Motion to Create
Animated Backgrounds (FADE IN )

Using DVD SP Assets From Templates

Auto Assigning Buttons/
More Button Creation-Mapping

Semi/Pseudo Animated Rollovers Sort Of

Basic Return To Menu

Track Markers Jumps

Stories Details

Scriptless Play All/Scene Selection

Stories & Jumps

Random Return To Menus

Make A "Secret" Passcode

Using Scripts For Preferences (Audio Selection)

Random Fun (Making Random Jumps to Material)

Bit Shift Bingo

DVDSTEPBYSTEP.COM / Bit Shifting Bingo

Often people ask how to make games in DVD SP. The general answer is DVDs are not the bes things for games, and often, for the most part, other programs and media, such as Flash or Director on a CD-ROM, may provide more pleasent and repsonsive results. Plus the programing languages, when compared to DVD SPs scripting, are often more robust and/or just generally easier to deal with than drop downs for scripting. That being said, there wwas a question on how to make a Bingo Game. I did the brute force method to start with the caveat that it was, well just brute force, and there are better ways to approach it - meaning less coding and faster interactivity.


The first thing I did was to patirtion the first GPRM into 2 sections, called RandomomSelected and RandomHolder. I then namesed 5 GRPMs as in the list below. This is also a script, called "Clearer", which sets the variables to 0 and then jumps to another script called mixer. (As an aside the DVD starts with a Menu that has a button that when pressed calls "Clearer")


The next script is Mixer, where most of the action occurs.

<

Before going further, it is important to note how DVD SP holds" numbers - the maximum number value in a NON-partitioned GPRM is 65535, and the GRPMs have 16 bits which are either on or off. As the able below shows, if bit 0 is one it represents a value of 1. If bit 11 is on it represents a value of 2048. If any bit is off, it is a value of 0. If all 16 bits are on, the total value is 65535. And by combining the on and offs you can get every value in between. The table right below shows the names I used for the GPRMs and the respective Bingo Numbers for the bits. If, for example, bit 3 in GPRM 1-16 is On (not equal to 0) then it has been selected, otherwise it has not. Now onto the script.



Bits 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Total
VALUES 1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65535
THE GPRM NAME
BINGO TABLE
GPRM 1-16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
GPRM 17-32 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
GPRM 33-48 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
GPRM 49-64 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
GPRM 65-75 65 66 67 68 69 70 71 72 73 74 75

Lines 1 -5 check to see if all balls have been selected. If the GPRMs are equal to 65535 (or 2047 for Balls 65 through 75) then all balls for the GPRM have been pulled. If the script makes through line 5 then all have been pulled, so it goes to the game over screen (Line 6). Otherwise the lines break the script out by calling line 7 and starting the random process.

Line 7 places the value into RandomHolder.

Line 8 moves the RandomSelected into RandomHolder and Line 9 makes the RandomHolder mod 16 (values of 0 through 15).

Since mod 16 will produce 0-15 (with 0 being 16 for purposes of this script), line 10 changes Mod 0 to 16

Line 11 sets a GPRM which I called MaskValue, to 1

Line 12 jumps to line 14 which subtracts 1 from the value of RandomHolder (which is a number between 1-16). If RandomHolder is > 0 then the line 15 of the script goes back to line 13 and multiplies the MaskValue by two. This process will generate one of the following numbers 1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192 and you can probably guess the rest - they are the numbers in the table above.

Lines 16-20 moves (mov) the value of the GPRMs representing the balls we want to look at into GPRM 7. You could jump lines after each of these lines (i.e., make line 17 jump line x if RandomSelected is y) but I saved a few lines of code. 21 is the important line, the "and" operator masks a GPRM to isolate certain registers and values. For instance add GPRM 7, 2 means the value in bit 2. If the bit has not been turned on it is 0 and if the value HAS been turned on then the value is NOT equal to 0. And line 22 kicks up to Line 7 to run another RandomSelected if the bit is already on (ball selected) or it adds the MaskValue to the proper BallSelection GPRM (23-32).

Lines 32 through 35 then go to the proper menu. NOTE THAT JUMP INDIRECT MAY NOT BEHAVE PROPERLY SOMETIMES SO BEWARE!!! Also depending on the version of DVD SP lines 33 and 34 may need to be changed!! Anyway, Line 32 moves the RandomSelected (values of 1-75) into GPRM 7 Line 33 multiplies the number by 32. Here's the trick - DVD SP "knows" which menu to jump to based on this value. For instance Menu 1, is 32 and so on. (Again keeping the earlier warnings in mind and also noting that if you look in VTS view the menus are in the order of the image below.)

 

 

NOTE: To hard code the items (changing lines 32 and on) you can route to the menus, though it will be a bit slower. I am fairly certain these scripts work properly, but have not all the debugging and testing I would do if this was "for real". You can download the zip files with both versions here
Bingo_Script_V1 has the short cut of using Jump Indirect and Bingo_Script_V2 is the longer version/more lines/ a bit slower. Lastly, DVD SP (and DVDs) is not the ultimate platforms for these types of things, and the programay slow down a bit more as you move past 50 or so numbers pulled.

All material ©2006 Drew13 and the respective owners of materials