Tutorial Physics/XML "XML" Arguments and Explanations

Paolo

No Bam no Play
Chat Moderator
Site Supporters
Joined
Mar 16, 2013
Messages
1,383
Solutions
3
Reaction score
646
Points
131
Favorite Pinball Machine
Batman(Data East)
Hi....everyone!!!
I probably won't be the man for this task, but I can be the man to start this one.

Lately I am busy solving "what I call" sudden feeling of slowness in the gameplay of my tables, so to try to solve this problem, I have to play with the XML file,and improve physics.

Now .... and here comes my need to know more,so.... what is, the XML file? what's inside? what values to put to improve that particular context?
Inside this file there are things that I do not fully understand, some lines are incomprehensible to me, of what they are or can do.
It must also be said that many of these parameters or commands are configurable in the Bam menu, but as we all know, many things that found in Bam, it is difficult to understand what they can be, and in the doubt of touching something that can cause other problems, we do not touch them, or simply do not have a manual to better understand what we are looking at

Then we analyze each line of the file, and we try to give an explanation understandable for everyone, so I invite you to do some intervention if you wish, to help better understand what characterizes the XML file.

Then, this is the "XML" (standard FP) file generated in Bam, like this:
go to "Dev options" and then to "Physics tweaks" and press CTRL + SHIFT + C then, on the script CTRL + V .

'=============================== PHYSICS XML ===========================
'<?xml version="1.0" encoding="utf-8"?>
'<document>
' <physics slope="6" fps="256" threaded="0"></physics>
' <ball newtonDamping="0" mass="18" gravity="4000" damping="0.25"></ball>
' <flipper rotationSpeedChart="{0.0,100.0}[0.0,100.0]" newtonDamping="1" releaseOmega="18" mass="20000" omega="33" moeMethod="0"
' leftXoff="0" leftYoff="0" leftZoff="0"
' rightXoff="0" rightYoff="0" rightZoff="0"></flipper>
' <bumper impulse="85.0" impulseRandomness="10" vectorRandomness="6"></bumper>
' <autoplunger mass="20000.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="800.0" vukImpulse="1300.0" impulseRandomness="4" vectorRandomness="1"></kicker>
' <plunger mass="20000.0" force="30000.0"></plunger>
' <slingshot impulse="480.0" impulseRandomness="15" vectorRandomness="10"></slingshot>
' <spindisk mass="10000.0" angularDamp="0.33" linearDamp="0.25"></spindisk>
' <spinner mass="45.0" gravity="100.0" angularDamp="0.5" angularAccel="5.0"
' spinDampLoose="0.325" spinBackLoose="2.850"
' spinDampNorm="0.575" spinBackNorm="3.250"
' spinDampTight="0.750" spinBackTight="3.500"></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>
' <nudge impulse="100.0" impulseRandomness="25.0" warningLevel="160" leftAngle="65" upAngle="0.0" rightAngle="295"
' vectorRandomness="4" visualDistance="2" waitPeriod="300" maxBallVelocity="1000.0"></nudge>
' <defaultMat softnessCoef="0.02" elasticCoef="0.1" staticFriction="0.01" kineticFriction="0.02"></defaultMat>
' <playfieldMat softnessCoef="0.03" elasticCoef="0.2" staticFriction="0.01" kineticFriction="0.02"></playfieldMat>
' <metalMat softnessCoef="0.01" elasticCoef="0.05" staticFriction="0.01" kineticFriction="0.02"></metalMat>
' <woodMat softnessCoef="0.03" elasticCoef="0.2" staticFriction="0.01" kineticFriction="0.02"></woodMat>
' <plasticMat softnessCoef="0.02" elasticCoef="0.25" staticFriction="0.01" kineticFriction="0.02"></plasticMat>
' <rubberHardMat softnessCoef="0.04" elasticCoef="0.4" staticFriction="0.01" kineticFriction="0.02"></rubberHardMat>
' <rubberIntMat softnessCoef="0.05" elasticCoef="0.5" staticFriction="0.01" kineticFriction="0.02"></rubberIntMat>
' <rubberSoftMat softnessCoef="0.06" elasticCoef="0.6" staticFriction="0.01" kineticFriction="0.02"></rubberSoftMat>
' <gateMat softnessCoef="0.05" elasticCoef="0.66" staticFriction="0" kineticFriction="0"></gateMat>
' <kickerMat softnessCoef="0.01" elasticCoef="0.05" staticFriction="0.8" kineticFriction="0.8"></kickerMat>
' <rampMat softnessCoef="0.01" elasticCoef="0.05" staticFriction="0.01" kineticFriction="0.02"></rampMat>
' <plungerMat softnessCoef="0.04" elasticCoef="0.4" staticFriction="0.01" kineticFriction="0.02"></plungerMat>
' <spindiskMat softnessCoef="0.05" elasticCoef="0.5" staticFriction="2" kineticFriction="2"></spindiskMat>
'</document>
'=============================== PHYSICS XML ===========================

 
Last edited:
So first step we analyze the first line.......

' <physics slope="6" fps="256" threaded="0"></physics>

Cattura0.JPG

I think we all know what it is, but lately with George we have discovered that in the editor he has priority over the file.


Ok...first parameters incompressible for me, if anyone knows what they are and what they do, please give an explanation

fps="256" threaded="0"
 

Attachments

  • Cattura0.JPG
    Cattura0.JPG
    66.5 KB · Views: 74
FPS="256": your CPU can compute for a maximum of 256 FPS (frame per second) so, each 1/256 s (about 3ms), it computes ball position, collision, ...
From the original .xml:
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

256 is a good value.

Threaded: for multicore CPU, force FP to use a single processor. Let 0.
 
Not really. FP was created a long time ago (for computing), so there was a lot of mono processor.
The value are 0 or 1.
1 is for the (multi core) computer to use a single core, 0 to use more than one core.
 
Not really. FP was created a long time ago (for computing), so there was a lot of mono processor.
The value are 0 or 1.
1 is for the (multi core) computer to use a single core, 0 to use more than one core.
So the best choice is to leave it at 0.

Ok,second step.....this line is about the ball, and refers to 4 characteristics,with standard values,but first I want to talk about mass and gravity.

' <ball newtonDamping="0" mass="18" gravity="4000" damping="0.25"></ball>

In these days,I trying to improve the gameplay of DK, and have a ball that descends faster towards the fins,so that there is not much left on the playfield, when it hits nothing, it might be boring to wait for the ball ,so I changed the "slope" putting it higher between 8/10, and increasing the mass and gravity.

increasing mass and gravity makes the ball heavier, and descends more rapidly towards the fins, but here there is also another factor to consider, namely the dynamic fins....in fact, making the ball heavier, it may be necessary to increase the omega (in script), and the strength (in editor) of the fins.

but by doing this, it can happen that the ball gains too much strength and speed, and if you hit an object near the fins, you get a ball splashing all over the place very quickly ..... have you ever noticed this?
and here come into play (at least for me, and for the tests I've done,) the other two characteristics newtonDamping and damping.

for now I'll stop here ..... I'd like and wait, your opinion ...
 
OK, I think @ravarcade doesn't mind if I share a bit of information regarding FPS:

You don't want FPS for physics engine to be close to display value, because it never will be perfect match and small difference will make look all look very bad. Like one lost frame every second.

You should do own tests. If you display is 60Hz try to set 300 and you will see problem:
For most time you will get 5 physics steps per every drawed frame, but from time to time it will be 4 for one frame and 6 for next frame. You will see that odd irregularity.
With value like 296, you will end with 5 steps per frame and sometimes it will be 4 steps. Difference is smaller.

Number of steps per second have great impact on physics simulation results. So, if you try to change FPS you will create completely different physics.
Small values create bigger problem.
Some math:
ball diameter is 27 mm.
If ball is moving fast, lets say 1.5 m/s it is 1500 mm / s.
So, if you set FPS = 60 in one frame ball can travel: 1500 / 60 = 25 mm.
Now add to this for example flipper move in opposite direction. There is big chance that ball will fly thru flipper without hit detected.
... and 1.5m/s is not realy fast ball.

So, we want realy high number of steps per second for physics engine. But FP engine is not effective. It is using still only one thread. Also you have users with slow computers.

and also

Look at physics engine docs:
http://www.newtondynamics.com/wiki/index.php/NewtonUpdate (NewtonUpdate - Newton Wiki)
In short engine clamp fps value to range 20 < fpx < 600. So, if you say "720" it is still 600.
Second thing: some params in xml file are values applied to object in single physics engine step.
For example if you set strength of kicker is (F) 100 and fps is set to (fps)296, so ball will get among of energy passed : E = F / FPS = 100 * 1/296.
If you change fps to 600, amount of energy will be 2 time smaller (ball will move slower).
That rule apply only to some params.
Sorry, but i will not dig thru all params and try to give you all math behind it. Even if you adjust all params for change of FPS you will end with different behave for different fps.

To put things into context I asked because I bought a new 144Hz monitor and felt that going higher in the fps was beneficial (for me).

I tried directly fps720 (because 5x144) and then fps=900 (saw no difference) so I reverted to 720 unware of the 600 limit but explained why jumping from 296 to 600 was noticeable and 900 wasn't :)

The problem was all that was associated with it, and the main reason I contacted Rav, namely, the "slowness" because of some objects strength calculation...

Point is, unless you want to dig into this ( i'm temped but it's probably way too much for me ) it's better to leave it at fps=296. Is this optimal today?

@Popotte
Regarding the threaded=1 or =0 I recall testing this before (months) and I recall having a lot of jerkiness with it at 0 so I'm asking if you're sure 0 really is multithreaded or If I have misread what you wrote.

I have to test again but I have a stronger CPU now so...

/edit
I think i've misread and to be honest I'd leave threaded=1 anyone for todays standards
 
0 really is multithreaded or If I have misread what you wrote.
1 is for the (multi core) computer to use a single core, 0 to use more than one core.
in fact it is not very clear....seems to say the same thing

1 is for the (multi core)
computer to use a single core??

0 to use more than one core.


I tried to put 1 on my table, but I didn't notice any changes
 
Last edited:
...
Point is, unless you want to dig into this ( i'm temped but it's probably way too much for me ) it's better to leave it at fps=296. Is this optimal today?
...
It's good today as all the other parameters have been tested for that value.
Optimal, I don't know as everyone have different preferences.
Regarding the threaded=1 or =0 I recall testing this before (months) and I recall having a lot of jerkiness with it at 0 so I'm asking if you're sure 0 really is multithreaded or If I have misread what you wrote.
FP.jpg

0 = no -> set threading to single processor
1 = yes
 
Now that i'm thinking, MT can be a problem because windows might make a process jump from core to core.

Like I said I have to test because i'm on a much better CPU now. It is really ambiguous naming though (from XML to GUI option)

Thanks poppote.
 
mmmm, there is some relationship, between the options in fp, and in xml?

I've always had that option enabled.....so in xml it must be 1,I presume?
 
It is really ambiguous naming though (from XML to GUI option)
Don't forget that nobody can't access to the .xml at the beginning...
From original .xml:
<?xml version="1.0" encoding="utf-8"?>
<document>

<!-- Physics 1.0 (or original 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="256" threaded="0"></physics>
 
OK so I've done a quick test and it doesn't matter if I use 1 or 0 in various combinations:

GUI - unticked / XML = 0
GUI - ticked / XML = 0
GUI - unticked / XML = 1
GUI - ticked / XML = 1

No difference whatsoever in my current PC. it's always CPU core 0 doing the whole work (using task manager to check). So... whatever :)
 
I would like to join in here but I make changes using my intuition. I learned physics by experimenting. I changed values in the XML and observed the results. I experiment until I get the results I want. Ultimately, I think everyone ends up doing it that way even if you know how everything is defined. I know a very few technical things but this is all:

Mass = Weight

Omega usually translates into strength using the slider in the FP editor.

Impulse is basically strength and sort of like omega (an engineer would probably call it differently). Vukimpulse is the impulse of a vertical up kicker which needs to be higher than normal kickers because it has to kick the ball up quite a distance.

Force is pretty much the same as strength.

FPS - I use 298. I tried posting a table once using 512 once but folks with lower end PCs complained about stuttering even though it worked perfectly on my PC. The higher the number, the better your PC has to be to run it.

Randomness - The values for a parameter are changed very slightly in game play to make it play more like real life instead of being exactly the same like what can occur on computers.

elasticCoef/softnessCoef - Elasticity, Rubber is soft, Metal is hard. There is a subtle difference between the 2 parameters that I can't describe.

Rubber - The options in the FP editor for hard, Intermediate and soft rubber use the 3 material codes for rubber in the XML.

Edit: leftXoff, leftYoff, leftZoff, rightXoff, rightYoff, rightZoff - I asked Rafal what these are and he said he didn't know but to set them all to 0 or the ball will sink through the flippers when it is cradled.
 
Last edited:
I would like to join in here but I make changes using my intuition. I learned physics by experimenting. I changed values in the XML and observed the results. I experiment until I get the results I want. Ultimately, I think everyone ends up doing it that way even if you know how everything is defined. I know a very few technical things but this is all:
Yes, I agree with you,and thank you for your participation... in fact I am acting like this for DK, but since many things are difficult to guess, and in any case to make, that's why I opened this thread, for give myself, and give anyone an explanation, on every line that we see on the xml, step by step.

in fact what do you think of my explanation on mass and gravity?

EDIT:
I was hoping for your participation, because you know a lot about physics, and how the xml could be modified, in the best way.
in fact I am counting on the fact that you can give some more detailed explanations, to each line which we will talk about step by step

if we talk about everything it is all in one moment, the questions will be more than the answers
 
Last edited:
Just a fun fact: mass = weight at Earth's surface and for a static object. weight is actually mass x gravity

The not so fun fact is that we know the pinball usually weights around 80 grams so mass should be 80 but because I have no ideia how to setup gravity parameter to be like earth's own gravity (9.8 m/s2) i'm back to defining this as dark magic :D
 
Just a fun fact: mass = weight at Earth's surface and for a static object. weight is actually mass x gravity

The not so fun fact is that we know the pinball usually weights around 80 grams so mass should be 80 but because I have no ideia how to setup gravity parameter to be like earth's own gravity (9.8 m/s2) i'm back to defining this as dark magic :D
I figured I probably got something wrong.

Paolo, I really don't know how to describe anything beyond what I have already. I have an intuition for it but words don't work to describe it. It is why I have never created a tutorial for it. Everyone knows what gravity is but the parameter in the XML is impossible to describe (at least for me anyway). All I can say is mass and gravity affect each other but they are different. The closest thing to a tutorial is Step 28 of my guide here (which I think fails):


You just have to experiment with it. JP appears to know more than I do about the definitions of everything. So I would encourage him to continue and maybe I will learn something.

All I can say is for you to start with the XML I use and work on learning the 3 parameters for the ball first. Then move on to other things. (see attached, The XML I gave JP for EM tables is different).

So I will let JP continue.
 

Attachments

  • George's XML.zip
    1 KB · Views: 72
Paolo, I really don't know how to describe anything beyond what I have already. I have an intuition for it but words don't work to describe it. It is why I have never created a tutorial for it. Everyone knows what gravity is but the parameter in the XML is impossible to describe (at least for me anyway). All I can say is mass and gravity affect each other but they are different. The closest thing to a tutorial is Step 28 of my guide here (which I think fails):
in fact I have always asked myself how no one has ever described what the xml lines were ..... but I think it is not as difficult as you think .... if you think of making a description according to your configuration vision of the table you are building , then yes it is hard to find the words, I'm just asking you to help explain what that word is ... for example the mass

that anontet, does not take offense, but to explain the mass comparing it to the mass of the earth, and make a mathematical calculation from "einstein", I think it confuses more than it already is.

i am just asking you to explain what mass is (mass which is an example) in simple words like i did above i also hinted that gravity and mass are both related...and I asked for an opinion

it is not difficult to say that the mass at value 18 i.e. standard of fp, is equivalent to the weight of the ball, and if you increase the value the more the weight increases, the more the ball does not move ... that's all ....Is it difficult for you to say that?

now another example if I asked you to explain gravity, what would you answer me?

you must not tell me that it is the force that regulates the universe, and that it is the force of attraction towards the center of the formation disk, to create a planet, or it is the force that holds the oceans on the earth, or that makes us walk on the earth, and without gravity we would all be sent to space, to meet armstrong walking the moon?
 
As I said before, words don't work.
 
I disagree. A physics engine aiming for realism must use proper mathematical formulas otherwise it is not a physics engine. You can't simply make up things out of thin air, right? This is why it is not comparing to mass on Earth. An object has the same mass on Earth, Moon or Pluto. Gravity is what will give the object weight.

This is why in a physics engine, mass is appropriate instead of weight. With mass and gravity you can have weigh and simulate different cases which is the whole point of a physics engine :)

Me not being a native english speaker, nor particularly good at math or physics i'm not sure of the best way to explain it. Much like asking me to translate a document from portuguese to english just because I can read and write in both languages. I won't do it.

But going against GeorgeH post above, challenge accepted. I think this a way for me to learn to. In the words of Albert Einsten (how appropriate :D ) "If you can't explain it simply, you don't understand it well enough.". This is exactly what will make me look like a fool however, but again, I think of it as a learning process and there's no shame in that.

So the simplest way I can explain it is that gravity gives weight to the ball by pushing it steadily in the direction the ball travels in relation to the strength it was hit.

I tried to think how I would've like to be told this when I was at school :)

Wait until you get to elasticCoef parameter... If it is what I think it is that will be a fun one :D
 
Good definition. I agree with it. Maybe instead of saying "words don't work", I should have said I have no understanding of the terms. I guess there must be some sort of definition of the terms somewhere but I have understanding of them or the mathematics involved.
 
ok, I understand that we are on different waves.

if you want to explain "things" with mathematics or use mathematical terms .... or simply say that words don't work .... then I(wild), according to your logic, could never have, and I say never, learn to make tables .... because I don't know the math, and I don't speak English .... think about doing a translation to understand how I had to, other that say, words don't work..... I don't understand them own .... yet I learned to make tables

ok, you want to help using math to explain "things", well then it's better not to, because I don't understand them,and like me there are many peopple ... it is useless to explain things in incomprehensible terms .. .it helps no one. .

if i had to explain how to create a 3d model, in mathematical terms, well the result is obvious, that gives up before starting.

ok, since it is not possible without math, or words that work ... I give up learning how to create decent physics for a table, and I leave the standard fp physics in my tables.

i think of popotte's words when he told me that the author of fp, who created all the help manual file ..... so 1000 years to create all those explanations, would have thought that in english it wouldn't work, nobody could now create tables.
 
Last edited:
but I say, is it so difficult to say what happens to a table if I put the mass 50, and the gravity at 100(an example) ? must it be said in mathematical terms? there are no words that work? to explain this?

but if I fall down the stairs and I do nothing, do I have to explain it in mathematical terms? or there are no words that work to explain this fact.....

or just say simply .... well I fell down the stairs, yes .. but I landed on the water.
 
Last edited:
I think you are taking "words don't work" too literally wild. Of course words work. It's just too hard to translate a language to another and math is a language too. Also, translation is not for everyone. Like I said, just because you can read/speak 2 languages it doesn't mean your good at translation.

I for one, i'm terrible at that. I do try though and I hope you don't give up either. Your tables are awesome because you took the time. This is no different.
 
I think you are taking "words don't work" too literally wild
you are wrong!!!!

I opened this thread, to try to explain if it was possible of course, and in simple terms possible, the lines that make up the "xml" ...... it is also true that no one has done it before, so it is thought that it is difficult, or can't find the right words to explain....ok.... I know this, it is not easy, but it is certainly not impossible.

if I had thought that the mini-playfield was an impossible thing, now you would not see certain tables developed with this function..

now back to the thread ..... I asked my first question, and @Popotte answered beautifully.

I made my second proposal
' <ball newtonDamping="0" mass="18" gravity="4000" damping="0.25"></ball>

I explained my little theory,here,how and why, mass and gravity could be changed
In these days,I trying to improve the gameplay of DK, and have a ball that descends faster towards the fins,so that there is not much left on the playfield, when it hits nothing, it might be boring to wait for the ball ,so I changed the "slope" putting it higher between 8/10, and increasing the mass and gravity.

increasing mass and gravity makes the ball heavier, and descends more rapidly towards the fins, but here there is also another factor to consider, namely the dynamic fins....in fact, making the ball heavier, it may be necessary to increase the omega (in script), and the strength (in editor) of the fins.

but by doing this, it can happen that the ball gains too much strength and speed, and if you hit an object near the fins, you get a ball splashing all over the place very quickly ..... have you ever noticed this?

and you answer me like this? as if we were at the university? we are talking about pinball machines and the game, I did not find it useful to answer in mathematical terms, as you did.
Just a fun fact: mass = weight at Earth's surface and for a static object. weight is actually mass x gravity

The not so fun fact is that we know the pinball usually weights around 80 grams so mass should be 80 but because I have no ideia how to setup gravity parameter to be like earth's own gravity (9.8 m/s2) i'm back to defining this as dark magic

then, it must be clear that not everyone can understand certain terms .... and in my opinion we need to answer or propose things that are simple to understand, which are connected to the construction of the table


I would like to join in here but I make changes using my intuition. I learned physics by experimenting. I changed values in the XML and observed the results. I experiment until I get the results I want. Ultimately, I think everyone ends up doing it that way even if you know how everything is defined. I know a very few technical things but this is all:

Mass = Weight

Omega usually translates into strength using the slider in the FP editor.

Impulse is basically strength and sort of like omega (an engineer would probably call it differently). Vukimpulse is the impulse of a vertical up kicker which needs to be higher than normal kickers because it has to kick the ball up quite a distance.

Force is pretty much the same as strength.

FPS - I use 298. I tried posting a table once using 512 once but folks with lower end PCs complained about stuttering even though it worked perfectly on my PC. The higher the number, the better your PC has to be to run it.

Randomness - The values for a parameter are changed very slightly in game play to make it play more like real life instead of being exactly the same like what can occur on computers.

elasticCoef/softnessCoef - Elasticity, Rubber is soft, Metal is hard. There is a subtle difference between the 2 parameters that I can't describe.

Rubber - The options in the FP editor for hard, Intermediate and soft rubber use the 3 material codes for rubber in the XML.

Edit: leftXoff, leftYoff, leftZoff, rightXoff, rightYoff, rightZoff - I asked Rafal what these are and he said he didn't know but to set them all to 0 or the ball will sink through the flippers when it is cradled.

G,I repeat it for the last time, then if it works fine, if it doesn't work I will ask a staff member to delete this thread.

I don't ask you to necessarily participate, but only to give some simple explanation if you can, if you can't then that's okay ... since I think you were almost the only guy, to deepen the fact of physics and xml, so I honestly expect something special from you ...... but you tell me that you don't find the right words, and then you explained many things (see for yourself what you entered above) that I had not yet mentioned ... .. for now we were talking only about mass and gravity, for other things in due course
 
General chit-chat
Help Users
You can interact with the ChatGPT Bot in any Chat Room and there is a dedicated room. The command is /ai followed by a space and then your ? or inquiry.
ie: /ai What is a EM Pinball Machine?
  • No one is chatting at the moment.
      Chat Bot Mibs Chat Bot Mibs: dizzeee has left the room.
      Back
      Top