Register    Login    Forum    FAQ    PinSimDB.org

Board index » Resources » FP Addons




Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Physics Workshop
 Post Posted: Fri Sep 06, 2013 2:03 am 
Offline

Joined: Sun Jul 28, 2013 2:23 am
Posts: 103
Location: QLD, Australia
Now that "ravarcade" through his BAM project has made it possible to alter FP's physics properties via .xml. I propose a community workshop for the betterment of the game and try to implement the best possible physics solution utilizing the vast experience of the whole of this community.
"Zedonius" thread (can someone please show me how to refer a thread?) inspired me to look for answers into why FP physics are so wrong.

The first information that I will provide are excerpts from the "Newton" physics engine. These were taken from comments in the code (now open source) and relate to how FP interacts with Newton. Included are some of my observations.

Code:
NewtonUpdate:
Remarks: This function will advance the simulation by the amount of time specified by *timestep*. The Newton Engine does not perform sub-steps, and does not need tuning parameters. It is the responsibility of the application to ensure that *timestep* is small enough to guarantee physics stability.
Return: This function call NewtonCollisionUpdate at the lower level to get the colliding contacts.

(Comments: physics fps: default value 256. Increasing this value can only help Newton to calculate contact dynamics but is dependent on what is coded into FP. I've seen no detriment in increasing this parameter to 500. Needs further investigation.)


NewtonMaterialSetSurfaceThickness:
Set an imaginary thickness between the collision geometry of two colliding bodies who’s physics properties are defined by this material pair

Remarks: when two bodies collide the engine resolve contact inter penetration by applying a small restoring
velocity at each contact point. By default this restoring velocity will stop when the two contacts are at zero inter penetration distance. However by setting a non zero thickness the restoring velocity will continue separating the contacts until the distance between the two point of the collision geometry is equal to the surface thickness.
Surfaces thickness can improve the behaviors of rolling objects on flat surfaces.
Surface thickness does not alter the performance of contact calculation.


NewtonMaterialSetDefaultFriction:
Set the default coefficients of friction for the material interaction between two physics materials

Remarks: *staticFriction* and *kineticFriction* must be positive values. *kineticFriction* must be lower than *staticFriction*.
It is recommended that *staticFriction* and *kineticFriction* be set to a value lower or equal to 1.0, however because some synthetic materials can have higher than one coefficient of friction Newton allows for the coefficient of friction to be as high as 2.0.

(Comments: All FP settings disobey these recomendations?)


NewtonMaterialSetDefaultElasticity:
Set the default coefficients of restitution (elasticity) for the material interaction between two physics materials

Remarks: *elasticCoef* must be a positive value.
It is recommended that *elasticCoef* be set to a value lower or equal to 1.0

(Comments: FP is very reactive to changes of this setting)


NewtonMaterialSetDefaultSoftness:
Set the default softness coefficients for the material interaction between two physics materials

Remarks: *softnessCoef* must be a positive value.
It is recommended that *softnessCoef* be set to value lower or equal to 1.0
A low value for *softnessCoef* will make the material soft. A typical value for *softnessCoef* is 0.15

(Comments: FP has these values reversed? I think it can alter collision reactions)


NewtonMaterialSetCollisionCallback
Set userData and the functions event handlers for the material interaction between two physics materials .

Remarks: When the AABB extend of the collision geometry of two bodies overlap, Newton collision system retrieves the material interaction that defines the behavior between the pair of bodies. The material interaction is collected from a database of materials, indexed by the material gruopID assigned to the bodies. If the material is tagged as non collidable, then no action is taken and the simulation continues.
If the material is tagged as collidable, and a *aabbOverlap* was set for this material, then the *aabbOverlap* function is called.
If the function  *aabbOverlap* returns 0, no further action is taken for this material (this can be use to ignore the interaction under certain conditions). If the function  *aabbOverlap* returns 1, Newton proceeds to calculate the array of contacts for the pair of colliding bodies. If the function *processCallback* was set, the application receives a callback for every contact found between the two colliding bodies. Here the application can perform fine grain control over the behavior of the collision system. For example, rejecting the contact, making the contact frictionless, applying special effects to the surface etc.
After all contacts are processed and if the function *endCallback* was set, Newton calls *endCallback*. Here the application can collect information gathered during the contact-processing phase and provide some feedback to the player.
A typical use for the material callback is to play sound effects. The application passes the address of structure in the *userData* along with three event function callbacks. When the function *aabbOverlap* is called by Newton, the application resets a variable say *maximumImpactSpeed*. Then for every call to the function *processCallback*, the application compares the impact speed for this contact with the value of *maximumImpactSpeed*, if the value is larger, then the application stores the new value along with the position, and any other quantity desired.
When the application receives the call to *endCallback* the application plays a 3d sound based in the position and strength of the contact.

(Comments: This just explains how Newton assesses the many funtions inherent to Newton and controlled by FP. We have no control over these functions)


(Comments: Selected points of interest)

NewtonBodyGetForceAndTorqueCallback
Return the pointer to the current force and torque call back function.

Remarks: This function can be used to concatenate different force calculation components making more modular the
design of function components dedicated to apply special effect. For example a body may have a basic force a force that only apply the effect of gravity, but that application can place a region in where there can be a fluid volume, or another gravity field.
With this function the application can read the correct function and save into a local variable, and set a new one.
This new function will first call the save function pointer and upon return apply the correct effect.
This similar to the concept of virtual methods on objected oriented languages.
The function *NewtonApplyForceAndTorque callback* is called by the Newton Engine every time an active body is going to be simulated.
The Newton Engine does not call the *NewtonApplyForceAndTorque callback* function for bodies that are inactive or have reached a state of stable equilibrium.


NewtonBodySetMassMatrix
Set the mass matrix of a rigid body.

Remarks: Newton algorithms have no restriction on the values for the mass, but due to floating point dynamic range (24 bit precision) it is best if the ratio between the heaviest and the lightest body in the scene is limited to 200.
There are no special utility functions in Newton to calculate the moment of inertia of common primitives.
The application should specify the inertial values, keeping in mind that realistic inertia values are necessary for realistic physics behavior.

(Comments: Mass values in FP far excede recomendations but only drawback is slower computation?)


NewtonBodyCalculateInverseDynamicsForce
Calculate the next force that net to be applied to the body to archive the desired velocity in the current time step.

Remark: this function can be useful when creating object for game play.
This treat the body as a point mass and is uses the solver to calculates the net force that need to be applied to the body such that is reach the desired velocity in the net time step.
In general the force should be calculated by the expression f = M * (dsiredVeloc - bodyVeloc) / timestep however due to algorithmic optimization and limitations if such equation is used then the solver will generate a different desired velocity.


NewtonBodySetCentreOfMass
Set the relative position of the center of mass of a rigid body.

Remarks: This function can be used to set the relative offset of the center of mass of a rigid body.
When a rigid body is created the center of mass is set the the point c(0, 0, 0), and normally this is the best setting for a rigid body. However the are situations in which and object does not have symmetry or simple some kind of special effect is desired, and this origin need to be changed.
Care must be taken when offsetting the center of mass of a body.
The application must make sure that the external torques resulting from forces applied at at point relative to the center of mass are calculated appropriately.

(Comments: Could relate to flipper offsets?)


NewtonMaterialSetContinuousCollisionMode:
Set the material interaction between two physics materials to enable or disable continue collision.
continue collision is on by defaults.

Remarks: continue collision mode does not prevent rigid bodies from inter penetration instead it prevent bodies from passing trough each others by extrapolating contact points when the bodies normal contact calculation determine the bodies are not colliding.
For performance reason the bodies angular velocities is only use on the broad face of the collision,
but not on the contact calculation.
Continue collision does not perform back tracking to determine time of contact, instead it extrapolate contact by incrementally extruding the collision geometries of the two colliding bodies along the linear velocity of the bodies during the time step, if during the extrusion colliding contact are found, a collision is declared and the normal contact resolution is called.
For continue collision to be active the continue collision mode must on the material pair of the colliding bodies as well as on at least one of the two colliding bodies.
Because there is penalty of about 40% to 80% depending of the shape complexity of the collision geometry, this feature is set off by default. It is the job of the application to determine what bodies need this feature on. Good guidelines are: very small objects, and bodies that move a height speed.


NewtonBodySetLinearDamping
Apply the linear viscous damping coefficient to the body.

Remarks: the default value of *linearDamp* is clamped to a value between 0.0 and 1.0; the default value is 0.1.
There is a non zero implicit attenuation value of 0.0001 assume by the integrator.
The dampening viscous friction force is added to the external force applied to the body every frame before going to the solver-integrator.
This force is proportional to the square of the magnitude of the velocity to the body in the opposite direction of the velocity of the body.
An application can set *linearDamp* to zero when the application takes control of the external forces and torque applied to the body, should the application desire to have absolute control of the forces over that body. However, it is recommended that the *linearDamp* coefficient is set to a non-zero value for the majority of background bodies. This saves the application from having to control these forces and also prevents the integrator from adding very large velocities to a body.


NewtonBodySetAngularDamping
Apply the angular viscous damping coefficient to the body.

Remarks: (exactly as "SetLinearDamping")


NewtonBodyAddImpulse
Add an impulse to a specific point on a body.

Remarks: This function will activate the body.
*pointPosit* and *pointDeltaVeloc* must be specified in global space.
*pointDeltaVeloc* represent a change in velocity. For example, a value of *pointDeltaVeloc* of (1, 0, 0) changes the velocity of *bodyPtr* in such a way that the velocity of point *pointDeltaVeloc* will increase by (1, 0, 0)
Because *pointDeltaVeloc* represents a change in velocity, this function must be used with care. Repeated calls to this function will result in an increase of the velocity of the body and may cause to integrator to lose stability.
This function apply at general impulse to a body a oppose to a desired change on velocity
this mean that the body mass, and Inertia will determine the gain on velocity.

(Comments: Bumpers)

_________________
Tables completed - Battle Of Britain, Klondike, Yukon, Yukon Special, Gold Rush, Jackpot, Lucky 7, Powerplay2.0


Top 
 Profile  
 
 Post subject: Re: Physics Workshop
 Post Posted: Fri Sep 06, 2013 2:09 am 
Offline

Joined: Sun Jul 28, 2013 2:23 am
Posts: 103
Location: QLD, Australia
Here my limited observations of FP's xml.
This is only the first part and doesn't include materials yet.

Code:
Ball:
"gravity"
Universal effect. Adds force from table top towards bottom (apron). Akin to increasing table angle.
Affects flipper shots, adds bias towards edges of table.
Speeds up the ball and tends to limit horizontal ball movent eg draws the ball towards the bottom.
Adverse effect on reverse facing ramps.
Most notable effect on spinners (relative to "mass"). Makes them levitate or get stuck horizontal.

"mass" influences colliding objects. Determines rebounding force applied to collisions. Remember the ball moves very fast and the force relative to mass increases exponentially with increase in velocity.
There is a common perception that increasing ball mass is benefitial to FP physics. I tend to dissagree, increasing mass has minimal effect on "real gravity", one of Newtons early flaws. Brilliant as he may be Newtons developer must have been born on planet "Helium". In FP "mass" is overidden by it's unique "gravity" (I always thought mass and gravity were the same), anyway, mass is only relative to other objects.
Increasing ball mass realy only increases computational demand, the ball will still "fly". The lower limit for ball mass is it's ability to turn those spinners which start to float under "FP gravity" when their mass is reduced.

"damping" just another comprimise I think and best set to minimum amount. Works sort of like liquid "friction". It does slow ball spin though.


Flipper:
"mass" increases the flippers ability to rebound the ball. Increasing flipper mass reduces give when the ball collides thus biasing shots to the centre. Interestingly the give allows very good control of wide shots but centre shots are imposible.

"omega" as stated rotational force. Propels flipper "mass". Further enhances bias towards centre shots.
*The flipper strength slider in the editor adjusts both mass and omega?

"moeMethod" Always use "0"

Offsets. Physics 2.5 uses YOff=1500 I would assume that it changes the centre of mass but resetting back to "0" showed no marked effect. Could be used to adjust flipper bais in all three dimensions?

Bumper:
"impuse" exerts force relative to ball velocity and mass.
"impulseRandomness" percentage + and/or -? variation on impulse strength
"vectorRandomness" degree + or -? variation on impulse direction

AutoPlunger:
"mass" as above
"force" as opposed to bumper impulse applies direct acceleration to the ball.

Diverter:
same as flipper

Gate:
"mass" affects resistance to ball similar to static friction. Keep it low. Gates also move at high speed and a high mass ratio to the ball will stop it.
"gravity" affects speed and ability to return to normal position?
"damping" affects acceleration and applies "gravity"? similar to kinetic friction

Kicker:
"impulse" works as emkicker "omega" unlike bumpers
"randomness" same as with bumpers

Plunger:
same as autoplunger

Slingshot:
same as kickers.
Randomness is required or the ball can tend to bounce perpetually between slingshots.
* I'm looking at wild slingshot behavior and it may be due to the placement of shapepoints either side of the slings kicker. Taking the nearest shapepoints OFF the pegs seems to stop the ball spraying. Maybe to do with a collision detection between rubber and peg creating a tangent?

Spinner:
"mass" same as gate
"gravity" same as gate except severely overidden by "ball gravity"
"angularDamp" similar to ball damping but in relation to angularAccel?
"angularAccel" to do with transfer of momentum to rotation as opposed to the spinner being pushed across the table by the ball?
"spinDamp----" friction? low number will spin forever but set as low as posible.
"spinBack----" similar to spinner gravity but applies negative force to spin? once again severely overidden by "ball gravity"
* Spinners are sensitive and tempremental and will give you a headache.....

EMkicker:
"mass" ability to propel ball?
"omega" applies direct acceleration to ball (but with vertical spin component)?

Varitarget:
? Have not looked yet.

Magnet:
???????????? Can we get FPM Editor to create a catagory? Is it implemented into the code?

Nudge:
"impulse" same as bumpers?
"impulseRandomness" same as bumpers
"warningLevel" actual value implecation???
"----Angle" impulse direction
"vectorRandomness" same as bumpers
"visualDistance" ??????
"waitPeriod" ??????
"maxBallVelocity" ??????

_________________
Tables completed - Battle Of Britain, Klondike, Yukon, Yukon Special, Gold Rush, Jackpot, Lucky 7, Powerplay2.0


Top 
 Profile  
 
 Post subject: Re: Physics Workshop
 Post Posted: Mon Sep 09, 2013 2:16 am 
Offline

Joined: Sun Jul 28, 2013 2:23 am
Posts: 103
Location: QLD, Australia
The silence is deafening - maybe your not keen on theory?
What can be achieved
Future Pinball with bounce!!!!!!!!!

Table alterations - adjust some rubbers, lower bumper one point stronger (5th position to 6th)
http://www.dailymotion.com/SupaNovaLTY#video=x14fmzr

same table with Physics 2_5
http://www.dailymotion.com/SupaNovaLTY#video=x14fnbm

_________________
Tables completed - Battle Of Britain, Klondike, Yukon, Yukon Special, Gold Rush, Jackpot, Lucky 7, Powerplay2.0


Top 
 Profile  
 
 Post subject: Re: Physics Workshop
 Post Posted: Tue Sep 24, 2013 6:22 pm 
Offline

Joined: Mon Jan 28, 2013 2:54 pm
Posts: 52
wow, seems so different from original FP, great job. Why aren't people responding to this. Seems incredible.


Top 
 Profile  
 
 Post subject: Re: Physics Workshop
 Post Posted: Wed Sep 25, 2013 9:15 am 
Offline

Joined: Sun Jul 28, 2013 2:23 am
Posts: 103
Location: QLD, Australia
Thanks, slydog43. I've long since given up other "physics" and now enjoy playing tables with B-B-Bounce. I haven't posted updated findings due to lack of interest.

_________________
Tables completed - Battle Of Britain, Klondike, Yukon, Yukon Special, Gold Rush, Jackpot, Lucky 7, Powerplay2.0


Top 
 Profile  
 
 Post subject: Re: Physics Workshop
 Post Posted: Wed Sep 25, 2013 10:50 am 
Offline
User avatar

Joined: Sat Jan 21, 2012 12:16 am
Posts: 1221
Location: Ontario, Canada
Wouldn't call it a lack of interest but rather too many different options out there in the past year. Most people just want to jump in and play without having to tinker 300+ tables every time someone has some new physics adjustment. If this is simply an xml file with all 'your' new settings then it can be used with BAM as yet another physics mod without having to modify any executable. Just add the xml as a 5th option to BAM.

Great job nonetheless.

My 2 cents.

Edit: I wouldn't mind checking it out if you have your settings to share (or xml).

_________________
http://www.youtube.com/open6l
http://www.twitter.com/open6l

Image


Top 
 Profile  
 
 Post subject: Re: Physics Workshop
 Post Posted: Wed Sep 25, 2013 11:43 am 
Offline

Joined: Sun Jul 28, 2013 2:23 am
Posts: 103
Location: QLD, Australia
open6l wrote:
Wouldn't call it a lack of interest but rather too many different options out there in the past year. Most people just want to jump in and play without having to tinker 300+ tables every time someone has some new physics adjustment. If this is simply an xml file with all 'your' new settings then it can be used with BAM as yet another physics mod without having to modify any executable. Just add the xml as a 5th option to BAM.

Great job nonetheless.

My 2 cents.

Edit: I wouldn't mind checking it out if you have your settings to share (or xml).


I absolutely agree with you. Why I created this topic was to try to eliminate proliferation and encourage cooperation so everyone could have the best possible solution(s) to some of the games limitations.

I have a prototype xml that works well with tables that are optimised for 2.5. Tuning a table is minimal effort, but not mandatory.
Some things can't be fixed with xml e.g. bumpers and flippers.

PS. check your inbox 6/9/2013 old sample

_________________
Tables completed - Battle Of Britain, Klondike, Yukon, Yukon Special, Gold Rush, Jackpot, Lucky 7, Powerplay2.0


Top 
 Profile  
 
 Post subject: Re: Physics Workshop
 Post Posted: Wed Sep 25, 2013 4:10 pm 
Offline
User avatar

Joined: Sat Jan 21, 2012 12:16 am
Posts: 1221
Location: Ontario, Canada
alright - I grabbed the settings you sent me a few weeks back. Tried it briefly (with the latest release of Time Warp) and first thing I notice is that there is quite a bit of bounce but also the ball is much faster. I had to drop the table angle ever so slightly to compensate the speed of the ball.

Will test it some more later.

thanks

_________________
http://www.youtube.com/open6l
http://www.twitter.com/open6l

Image


Top 
 Profile  
 
 Post subject: Re: Physics Workshop
 Post Posted: Fri Sep 27, 2013 7:38 pm 
Offline

Joined: Sun Jul 28, 2013 2:23 am
Posts: 103
Location: QLD, Australia
I had stated I didn't wish to proliferate the community with new physics settings but there maybe some of you that would appreciate a little bounce in your pinball. Yes, I've tried physics 2.6 and that bounces but only down and sideways not up.
My main emphasis has been reverse engineering FP's horizontal "gravity" not exaggerating it as seems to be the popular trend.

After playing tables with this for weeks I can't go back. FP 1.9 is like playing pinball with party balloons and everything else is like lead balls in syrup though 2.6 is an improvement on 2.5.

This is just what I have done and enjoy. I watch real pinball videos and try to replicate it with FP. I use soft rubbers for most things except ramp entries and rubbers in direct line of fire.

If a table doesn't work properly I just fix it. If a gate sticks build a surface and take it up a couple of mil. If the ball flies off a ramp put a lid on it etc.

Code:
<?xml version="1.0" encoding="utf-8"?>
<document>
 
  <!-- Physics processing -->
  <!-- Note. Changing the FPS will effect how how all the other values interact with each other and should
  be a high value due to the fact the ball in a pinball is moving very fast and lower values will cause the ball
  to go into objects fractionally (thus we must sample at a higher rate)

  threaded (true/false) defines if the physics runs in a separate thread for multicore CPU's (dev version only)
  -->
  <physics fps="500" threaded="0"></physics>

  <!-- Settings for various objects -->
  <ball mass="18" gravity="4000.0" damping="0.01"></ball>

  <!-- moeMethod="0" Auto-calculate the moments of Inertia for the flipper using internal Newton functions -->
  <!-- moeMethod="1" Calculate the Flipper MOE based on a rectangle (changes aiming behaivour) -->
  <!-- Note: omega is rotational force -->
  <flipper mass="80000.0" omega="42.0" moeMethod="0"
           leftXoff="0" leftYoff="5000" leftZoff="0"
           rightXoff="0" rightYoff="5000" rightZoff="0"></flipper>

  <!-- impluse            The amount of power applied to the ball (normal setting)..
                          this is then scalled up or down to suit the strength setting
       impulseRandomness  Random Percentage (of impulse) added to impulse when the ball hits the object
       vectorRandomness   Random Angle change +/- value to ball direction
  -->
  <bumper    impulse="0200" impulseRandomness="15" vectorRandomness="6"></bumper>
  <autoplunger mass="25000.0" force="60000.0"></autoplunger>
  <diverter    mass="10000.0" omega="33.0"></diverter>
  <gate    mass="2.0" gravity="4500.0" damping="0.25"></gate>
  <kicker    impulse="900.0" vukImpulse="1500.0" impulseRandomness="4" vectorRandomness="1"></kicker>
  <plunger    mass="20000.0" force="40000.0"></plunger>
  <slingshot    impulse="600.0" impulseRandomness="20" vectorRandomness="2"></slingshot>
  <spindisk    mass="10000.0" angularDamp="0.33" linearDamp="0.25"></spindisk>

  <!--
  <spinner    mass="100000.0" gravity="100000" angularDamp="0.5" angularAccel="5.25"
              spinDampLoose="0.22" spinBackLoose="1.8"
              spinDampNorm="0.325" spinBackNorm="2.7"
              spinDampTight="0.575" spinBackTight="3.2"></spinner>
  -->
  <spinner    mass="32.0" gravity="000.0" angularDamp="0.1" angularAccel="8.0"
              spinDampLoose="0.150" spinBackLoose="2.850"
              spinDampNorm="0.180"  spinBackNorm="3.000"
              spinDampTight="0.200" spinBackTight="3.150"></spinner>
  <emkicker    mass="10000.0" omega="80.0"></emkicker>
  <varitarget mass="100.0" damping="0.5" tension="3.0" return="15.0"></varitarget>
  <magnet    impulse="10.0" impulseRandomness="2"></magnet>

  <!-- Nugde Settings -->
  <nudge impulse="080.0" impulseRandomness="25.0" warningLevel="180" leftAngle="60" upAngle="0.0" rightAngle="300"
         vectorRandomness="4" visualDistance="2" waitPeriod="300" maxBallVelocity="0800.0"></nudge>

  <!-- Materials Settings -->

  <!-- Static coefficient
       - - - - - - - - - -
       Static friction is the force that holds back a stationary object up to the point that it
       just starts moving. Thus, the static coefficient of friction concerns the force restricting
       the movement of an object that is stationary on a relatively smooth, hard surface.

       Kinetic coefficient
       - - - - - - - - - -
       Once you overcome static friction, kinetic friction is the force holding back regular motion.
       This, kinetic fiction coefficient of friction concerns the force restricting the movement of
       an object that is sliding on a relatively smooth, hard surface.
       
       Both coefficients are based on material pairs (ie wood on wood, metal on wood) etc..

       In FP all the settings are for Ball on Wood/Plastic/Rubber/Metal etc..

       and from the Newton docs..
       staticFriction and kineticFriction must be positive values. kineticFriction must be lower or equal than
       staticFriction. It is recommended that staticFriction and kineticFriction be set to a value
       lower or equal to 1.0, however because some syntetic materials can have higher than one coeficient
       of friction Newton allows for the coeficient of friction to be as high as 2.0.

       For more information refer to http://en.wikipedia.org/wiki/Friction
  -->

  <!-- Default Materal Settings to act as defaults incase we forget to set an object during development. 
       There shouldn't be any objects set to this material so these are just a fail safe values -->
  <defaultMat softnessCoef="0.02" elasticCoef="0.1" staticFriction="0.02" kineticFriction="0.02"></defaultMat>

  <!-- Material Settings for surfaces marked as playfields -->
  <playfieldMat    softnessCoef="0.01" elasticCoef="0.2" staticFriction="0.01" kineticFriction="0.01"></playfieldMat>

  <!-- Primary Material Types -->
  <metalMat       softnessCoef="0.01" elasticCoef="0.27" staticFriction="0.01" kineticFriction="0.01"></metalMat>
  <plasticMat    softnessCoef="0.02" elasticCoef="0.18" staticFriction="0.02" kineticFriction="0.02"></plasticMat>
  <woodMat       softnessCoef="0.03" elasticCoef="0.21" staticFriction="0.03" kineticFriction="0.03"></woodMat>
  <rubberHardMat    softnessCoef="0.08" elasticCoef="0.37" staticFriction="0.08" kineticFriction="0.10"></rubberHardMat>
  <rubberIntMat    softnessCoef="0.09" elasticCoef="0.45" staticFriction="0.08" kineticFriction="0.10"></rubberIntMat>
  <rubberSoftMat    softnessCoef="0.10" elasticCoef="0.60" staticFriction="0.08" kineticFriction="0.10"></rubberSoftMat>

  <!-- Object Specific Material Settings -->
  <gateMat       softnessCoef="0.05" elasticCoef="0.70" staticFriction="0.00001" kineticFriction="0.00001"></gateMat>
  <kickerMat       softnessCoef="0.01" elasticCoef="0.01" staticFriction="1.00" kineticFriction="0.00"></kickerMat>
  <rampMat       softnessCoef="0.01" elasticCoef="0.01" staticFriction="0.01" kineticFriction="0.01"></rampMat>
  <plungerMat    softnessCoef="0.04" elasticCoef="0.30" staticFriction="0.02" kineticFriction="0.02"></plungerMat>
  <spindiskMat    softnessCoef="0.05" elasticCoef="0.40" staticFriction="1.50" kineticFriction="1.50"></spindiskMat>
 
</document>


Save as .xml

_________________
Tables completed - Battle Of Britain, Klondike, Yukon, Yukon Special, Gold Rush, Jackpot, Lucky 7, Powerplay2.0


Top 
 Profile  
 
 Post subject: Re: Physics Workshop
 Post Posted: Fri Sep 27, 2013 11:59 pm 
Offline

Joined: Tue May 01, 2012 11:13 pm
Posts: 301
Location: Abbotsford
Interesting

Couldn't you just parse the xml with VBScript so the table can just read the values without having to go through all this BAM/multiple physics stuff which is massively confusing to most people? Have it as a script library that people can just add themselves if they want to.

Not good with xml stuff at all, but looks possible, and should be easy for someone with coding experience, found a example with just a simple search. This example may not be suitable, but does show you can read xml into vbs.

parse_xml.vbs

Code:
option explicit

dim xmlDoc, objNodeList

set xmlDoc = CreateObject("MSXML2.DOMDocument")
'set xmlDoc = CreateObject("Microsoft.XMLDOM")

xmlDoc.load("obce.xml")

set objNodeList = xmlDoc.getElementsByTagName("OBEC")
' Create list of nodes OBEC, which have this form
' <OBEC>
'   <NAZOV>..</NAZOV>
'   <PSC>..</PSC>
'   <POSTA>..</POSTA>
'   <OKRES>..</OKRES>
' </OBEC>

if objNodeList.length > 0 then
  dim fso, csv_file_name, csv_file, csv_line
  WScript.Echo("Parsing XML and writing data to CSV-file ...") 
  ' Open CSV file
  csv_file_name = "obce.csv"
  set fso = CreateObject("Scripting.FileSystemObject")
  const ForReading = 1, ForWriting = 2, ForAppending = 8
  set csv_file = fso.OpenTextFile(csv_file_name, ForWriting, True)
  ' create CSV-header-line
  csv_line = "Názov obce;PSČ;Dodacia pošta;Okres"
  csv_file.writeline(csv_line)

  dim obec, child, nazov, psc, posta, okres

  for each obec in objNodeList
    ' parse each elements childs
    for each child in obec.ChildNodes
      select case child.NodeName
        case "NAZOV"
          nazov = child.Text
        case "PSC"
          psc = child.Text
        case "POSTA"
          posta = child.Text
        case "OKRES"
          okres = child.Text
      end select
    next
    ' compose CSV-line
     csv_line = nazov & ";" & psc & ";" & posta & ";" & okres
     csv_file.writeline(csv_line)
  next
  ' close CSV-file and release object from memory
  csv_file.Close
  set csv_file = nothing
  WScript.Echo("..done.")
else
  dim err_msg
  err_msg = chr(34) & "OBEC" & chr(34) & " tag not found !"
  WScript.Echo(err_msg)
end if

' At end release XMLDOM object from memory
set xmlDoc = nothing



The script above parses XML document of this form
obce.xml
Code:

<?xml version="1.0" encoding="windows-1250"?>
<OBCE>
  <OBEC>
    <NAZOV>Ábelová</NAZOV>
    <PSC>985 13</PSC>
    <POSTA>Ábelová</POSTA>
    <OKRES>Lučenec</OKRES>
  </OBEC>
  <OBEC>
    <NAZOV>Čáčov</NAZOV>
    <PSC>905 01</PSC>
    <POSTA>Senica 1</POSTA>
    <OKRES>Senica</OKRES>
    </OBEC>
  <OBEC>
    <NAZOV>Čápor</NAZOV>
    <PSC>951 17</PSC>
    <POSTA>Cabaj- Čápor</POSTA>
    <OKRES>Nitra</OKRES>
  </OBEC>
  ...

  ...
</OBCE>


and writes the output to a CSV-file of this form
obce.csv
Code:

Názov obce;PSČ;Dodacia pošta;Okres
Ábelová;985 13;Ábelová;Lučenec
Čáčov;905 01;Senica 1;Senica
Čápor;951 17;Cabaj- Čápor;Nitra
...

...

_________________
_____________________________________

Latest projects and rants at My Facebook Page
_____________________________________

Latest Project: FPx Template Engine


Top 
 Profile  
 
Display posts from previous:  Sort by  
 
Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next

Board index » Resources » FP Addons


Who is online

Users browsing this forum: No registered users and 8 guests

 
 

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to: