OSDM ??? Oldskool Demomaker ??? Scripting Tips and Tricks 1

Categories: OSDM, TIPS, Tools
Tags:
Comments: No Comments
Published on: July 8, 2010

I did a lot of OSDM demos recently and thought that I should share some tips and tricks about the tool, especially the scripting feature, which I use almost exclusively for controlling the flow of my own OSDM production. I would like to start with high-lighting some of the new cool feature that became available with the April or June, 2010 versions of the Oldskool Demomaker tool by Peace/Testaware..

You can find all my own production at the special OSDM section here on my site. There you can also find additional resources, tools and more related to the Oldskool Demomaker, like my OSDM Script Cheat Sheet, Tutorials and my VOBJ Vector Object manipulation tool and more.

Table of Contents

  • Dynamic Layer Ordering
  • Vector Object Control
  • Addition to (Sprite) Cloning Feature
  • Macros

Dynamic Layer Ordering

I remember when I first checked out OSDM. The interface was not very intuitive, but what???s new when it comes to scene stuff (Elite has to suffer or something like that hehe) and I struggled with a couple specific issues. One of which was the rendering order of effects on the screen (= what is in front and what is in the back ground etc.)

Only when Peace himself explained to me in detail how the ???Storyboard??? page in the ???Regie??? tab worked, did I finally realized how this is being accomplished. It didn???t even occur to me when I looked at the interface myself that you can do more on that page than just controlling start and end times for the effects via the sliders.

I wouldn???t be surprised, if you didn???t get it either, so I will explain it quickly.

Each effect in that page has a letter encapsulated in apparentness in front. That letter is a hotkey. Press it on the keyboard (no ALT, CTRL or Shift key needed) and then use the Cursor UP/Down keys to move the selected Effect up or down in that list of effects. The further an effect is listed towards the top, the further ???back??? the effect is rendered. The active effect closest to the bottom of that list is rendered in front.

In the case of the ???Reflection (R)??? effect for example, only effects that are ???Behind??? it are actually being reflected. The effects below of it are not. osdm-storyboard

Since OSDM Version v2.20.160 you can change this layer order via OSDM Script in your production on the fly. This is cool for my multi-part demos that combine different effects in a different way for each part, but also makes sense to be used within a single demo part. I used it in several of my demos in combination with the reflection effect. I wanted an object reflected while it was further in the back, but not when I zoomed in on it. So within my Zoom script, I included the changing of the layer order to position another effect in front or behind the reflection effect as I needed.

The command is IDL = EFFECT. Important is that EFFECT is the effect you want to SWAP position in the layer hierarchy with. You have to have another effect selected via LEA = EFFECT first. You need to know the original layer order of course. That is your starting point.?? For example, if the Storyboard lists ???Amigatext (W)????? and ???Reflection (R)??? below, meaning that the Amigatext is being reflected and you want to move it in front of the Reflection effect, you use the following code:

CAL = AMIGATEXT
CAL = REFLECTION
LEA = AMIGATEXT
IDL = REFLECTION
 ;Amigatext is now in front of Reflection
 NOP = 3
 ;Wait a bit, like "Sleep" in VB
 IDL = REFLECTION
 ;Amigatext and Reflection swapped position again.
 ;Amigatext is reflected again also.
 END

Vector Object Control

The commands that probably exited me the most in OSDM v2.20.160?? were the ARX, ARY, ARZ, AAX, AAY, AAZ and corresponding MRX, MRY, MRZ, MAX, MAY and MAZ commands to dynamically control the rotation and angle of an vector object within your demo, beyond the initial settings that you could specify via the interface.

Direction is still a bit tricky and takes some trial and error before you get to the desired results, but it is something and indefinitely more than what was available before (nothing hehe).

All Commands that start with an ???M??? are to ???SET????? an exact value for a property, while commands that begin with an ???A??? always adjust properties with the result depending on the value of the property before the command was invoked. Positive and negative values are okay in both instances.

The last character does in this case specify the Axis in three-dimensional space; X, Y and Z.?? That leaves only the middle characters of the commands left, which are ???R??? and ???A???.?? Take a guess :)! Okay, ???R??? is for ???Rotation??? and ???A??? for Angle (Tilt).

When I created my first OSDM Vector object, I noticed something strange. I thought that I did something wrong at first, but I was assured that nothing was wrong with my object, but OSDM. For reasons unknown to anybody I know, VOBJ 3D Vector Objects are Flipped on the Y-Axis (Upside-Down); ???Y is at the top and +Y at the bottom for whatever reason.

Well , instead of flipping the object in the definition file, which tricky at best, if done by hand (and not by using my OSDM VOBJ tool hehe), you also can now simply flip it around via OSDM Script.

To flip the upside/down objects?? around use the command:?? MAX = 180.

First Note: The use of MAX, MAY, MAZ or initial use of AAX, AAY and AAZ also have the (IMO positive) side effect in the current version of OSDM, that they reset the vector objects rotation back to the original starting point. That helps with timing and positioning, especially if you are using multiple vector objects in one demo via the Multi Vector Object feature (see Tools section, Utilities dropdown).

Second Note: Those new commands are only for rotation and tilting. Use the commands ADX, ADY / MVX, MVY for translation and ADZ / MVZ for scaling as in previous OSDM versions.
Sample Code:

 CAL = 3DVECTOR   ;Start 3DVector Effect
 LEA = 3DVECTOR   ;Select 3D Vector Effect
 IDN = 0          ;Select 1st Vector Object in Multi .mVOBJ Object File
 ;Enable Fast Vector Shading for Lighting Effects
 BFX = 4
 ;Initialize X and Y Positions to center object
 ;in Windowed Mode in 640??480 (Use 0 for Full Screen Mode)
 MVX = -600
 MVY = -300
 ;Default Z position
 MVZ = 500
 ;Adjust X-Axis Angle
 MAX = -92
 ;Set Rotation Speed for Y-Axis
 MRY = 20
 ;Loop and  adjust X, Y and Z coordinates
 REP = 150
    ADX = -2   ;Move left
    ADY = -2   ;move up
    ADZ = 5    ;Zoom out
 LOP
 ;Set Rotation to -15 (reversed)
 MRY = -15
 ;move object back to where we started
 REP = 150
    ADX = 2  ;Move right
    ADY = 2   ;Move down
    ADZ = -5  ;Zoom in
 LOP
 ;Stop Rotation
 ADY = 15   ;MRY = 0 would have done the same
 ;change X-Angle (after loop, the object was effectively
 ;turned around itself full circle once)
 REP = 360
    AAX = 1
 LOP
 STP = 3DVECTOR
 ESC

Addition to Cloning Feature

The latest version of OSDM V2.21.274 also introduced a new feature for the cloning of sprites. Cloning is a feature that is only available via OSDM script for the use with the 3D Vector, Bouncer (Bouncing Bobs) and Sprites.

This new addition is actually only available for Sprites. I hope that it will become available for 3D Vectors too one day though.

In the past you could only clone an object once or multiple times on its X and/or Y axis. You specified the distance of the clones from the original and to each other in the case of multiple clones via CPW (for X) or CPH (for Y) and then CPX or CPY = NUMBER OF CLONES to clone the currently selected object.

All clones did the same movements etc. as the original object and all adjustments that you apply to the original will also be applied to the clones. Nice and good, but you always ended up with the same thing aligned in a ???string??? or arranged in a grid like shape doing exactly the same thing.

The new IDC command now lets you create a clone of a Sprite, assign its own ID to it and then control the clone independent from the original, just as you would the original.
It seems that IDC only supports ID???s up to 15, which gives you 8 additional Sprite objects, if you used up all your 8 Sprite slots in the OSDM interface or 15 clones, if you only use one sprite slot and just clone that single sprite.
Sample Code:

 CAL = SPRITE   ;Start Sprites
 LEA = SPRITE   ;Select Sprite effect
 IDN = 0        ;Select First Sprite
 IDC = 8        ;Clone Sprite and Assign ID 8 to it
 ;Move original Sprite around
 REP = 200
    ADX = 1
    AAZ = 1
 LOP
 ;Select Clone
 IDN = 8
 ;Move cloned Sprite around
 REP = 100
    ADX = -1
    ADY = 2
    ADH  = 1
 LOP

Macros

Also new with Version v2.20.160 is a feature called ???Macros???. The difference between a Macro and traditional OSDM script sub routine (or label) is the option to pass to the macro one or more parameter values. OSDM script does not support user variables at this time so this new Macro feature is a good addition and direction towards something like custom user controls that can be reused within a demo and help to reduce the overall amount of script code to write.
Sample Codes

 ;Initialize 3D Vector Object
 @INITV   ;2 Parameters: IDN of 3D Vector and Blending Mode Enum
 LEA = 3DVECTOR
    IDN = /0
    BFX = /1
    ;For use with Windowed Version
    ;MVX = -600
    ;MVY = -300
    ;For use with Full Screen Version
    MVX = 0
    MVY = 0
    MVZ = 500
 @END
 ;Initialize 3D Ball Object
 @INIT3DB
    LEA = 3DBALL
    IDN = /0
    ; For use with Windowed Version
    ;MVX = -500
    ;MVY = -200
    ;For use with Full Screen Version
    MVX = 0
    MVY = 0
    MVZ = 500
 @END

 FPS = 60 ;Set Frame Rate
 PSH            ;Update All Effect Values
 CAL = DISPLAY   ;Start Display
 CAL = MUSIC     ;Run Music
 JSR = 1        ;Gosub Routine 1
 ESC             ;Quit Demo
 END             ;End OSDM Script Processing

 LAB = 1
 CAL = 3DVECTOR  ;Start 3D Vector Effect
 @INITV = 0, 4   ;Initialize First Object in mVOBJ Multi Vector Object
 ;File and set Blending Mode to Fast Vector Shading
 CAL = 3DBALL    ;Start 3DBall Effect
 @INIT3DB = 1    ;Initialize Second Object in mOBJ Multi 3D Ball Object File
 NOP = 4
 RTS ;Return
 

That???s it for now. I hope that you liked it. As you can see from the ???1??? at the end of the title for this post, I might write up some additional tips and tricks for OSDM script :).

Cheers!

Carsten aka Roy/SAC