Dax Phyz logo

 

2.5D Physics Simulator

Frequently Asked Questions

 

Q: How do I start the simulation?

A: Use the F5 function key to turn physics on.


Q: How do the draw modes work?

A: Press and hold the mouse button. Tap Ctrl to add a line; hold down to draw freely. Tap Alt to toggle between straight and curved lines. In curved-line mode, tap Tab to invert the curve; tap Enter to auto-scale; use Q and W to scale manually. Backspace deletes previous segments. Use Esc to cancel, or release the mouse button to draw/select.


Q: How do I zoom?

A: Use the scroll wheel, or PageUp, PageDown and Home.


Q: How do I pan?

A: Drag with the right (alternate) mouse button, or use the arrow keys with nothing selected.


Q: What's the number to the right of Draw?

A: Spacing: The number to the right of Draw specifies, in Phyz length units, how far apart new vertices will be placed when using the draw, rect, ellipse, line and bitmap import tools. The default value is 10, matching the snap size. Super-dense objects can be created by using values smaller than 8 (the diameter of a vertex).


Q: What's the number to the right of Rect?

A: Auto-connect: The number to the right of Rect specifies how Phyz connects vertices with rods when using the draw, rect, ellipse, line and bitmap import tools. The default value is 1, indicating a dense connect policy, yielding rigid objects with around 4 rods per vertex. A value of 2 indicates a less dense, but still rigid, connect policy, with around 2 rods per vertex. A value of 0 turns auto-connect off.


Q: What's the number to the right of Line?

A: Linewidth: The number to the right of Line specifies, in number of vertices, the width of the lines created by the line tool and the width of the draw tools pen. The default value is 1, making the line tool create non-rigid chains. This goes for the draw tools as well, unless you draw closed shapes. When importing bitmaps, this value is used as a scale factor.


Q: What is a model?

A: A Phyz model is text in a specific but simple format. Try opening a model file (.pzm) in Notepad to have a look.


Q: What is a scene?

A: A Phyz scene (.pzs) is a model with additional information such as camera position and zoom level prepended.


Q: What is a script?

A: A Phyz script (.lzp) is a text file interpreted by PhyzLizp, for instance by issuing the command (feval "scriptname.lzp") and hitting Control+Enter in the PhyzLizp console window. It's also possible to paste the text of the script directly to the console, and execute with Control+Enter.


Q: How do I turn off the "snap" function, so I can position my objects freely?

A: Toggle Caps Lock, or use Shift.


Q: How do I change colours?

A: Colour is a property of objects in Phyz; all vertices in an object have the same colour. In the Select (F1) mode, select an object by clicking one of its vertices. The current colour is displayed in the options/info section to the right; click to open a colour dialog.


Q: What does the Freeze operation do?

A: Edit/Freeze selected sets the velocity of all selected verts to zero.


Q: What does the Relax operation do?

A: Edit/Relax selected sets the nominal values of all selected constraints (rod/stick/spring lengths, slot positions etc) to their current (actual) values.


Q: What do Paste/merge and Insert/merge do?

A: The merge operation pastes (from the clipboard) or inserts (from a file) a model, merging it with the existing scene by replacing the existing items' parameter values (rod lengths, vertex positions, charge strengths etc) with the values from the pasted or inserted model.


Q: What kind of model can be merged?

A: The merge operation expects a standard model object (as saved in PZM files), with each id field specifying a registered index of an item previously registered in the existing scene. Items which are unregistered or deleted in the existing scene are skipped over.


Q: How do I save a model with registered indices?

A: Both File/Save selection and Edit/Copy yields models with registered indices, if all selected items are registered. Edit/Reg reset (Ctrl+H) registers every existing item with its current dynamic (internal) value.


Q: How do I make vertices form blobs?

A: Turn on Metaballics in the Simul menu.


Q: What does Metaballic mean?

A: To possess the qualities of a diabolic metaball. In Phyz, this attribute can be turned on with the Simul menu, and makes vertices form isocontours. This is merely an alternate graphical presentation, or interpretation, of the underlying simulated physical world. The rules governing Phyz' universe remain the same.


Q: Why is Metaballics greyed out?

A: If Metaballics in the Simul menu is greyed out, your display adapter lacks the necessary hardware capabilities required by the metaballics algorithms. The About item in the Help menu lists hardware related Phyz features and their current status (enabled or disabled). Read more about metaballics hardware requirements below ("Why does Metaballics make my frame rate drop?").


Q: Why does Metaballics make my frame rate drop?

A: The metaballic effect in Phyz requires a lot of number crunching. With the thousands of objects constituting a typical Phyz scene, it is in fact unfeasible for a typical CPU, especially if it's already busy simulating physics. Phyz uses the general-purpose capabilities of modern GPUs and stream processing to achieve the metaballic effect; consequently, metaballics exercises the GPU, as opposed to the physics simulation, which exercises the CPU (with its streaming SIMD extensions).


Q: What are the numbers in the status bar?

A: The status bar is divided into six fields. The first field shows the camera zoom and position in Phyz coordinates, or (at the end of a recording) frame conversion progress. The second field shows the cursor position. The third field shows the current mouse drag width, height and distance. The fourth field displays hover information. The fifth field shows the number of display frames rendered per second (fps); the number of physic frames calculated per second (pps); the number of constraint iterations per physics frame (cpp); the total integration bit rate in Mbit/s (tpc), part of which is due to collisions (cpc) and rods (rpc); the current physics frame (pf). The sixth field displays momentum (mv), as well as kinetic (Wkin), potential (Wpot) and total (Wtot) energy of the current scene.


Q: I don't hear any sound, why?

A: Check Sound on in the Options menu, un-mute, turn the volume up and make sure you have a DirectX 8-compliant audio adapter.


Q: How do I "drag with physics"?

A: Turn off Edit (F3); turn on Physics (F5). Drag one or more vertices (with the mouse or arrow keys) in the Sel vert (F2) mode, or entire objects in the Select (F1) mode. Also, read about "snap" above.


Q: How do I select connected constraints as well as vertices?

A: Double-click any part (vertex or constraint) of an object to select all parts of the object. Use Extend selection (Ctrl+E) to recursively extend the current selection iteratively.


Q: How do I import a bitmap?

A: Use File/Insert to import a 24-bit Windows BMP-file, or paste it from the clipboard (Edit/Paste). The bitmap is down-scaled by [spacing/linewidth] (the numbers to the right of Draw and Line). The most common edge colour is used as a transparency mask. Connected same-coloured regions form separate objects (unless spacing is less than 8); the remaining pixels are collected into a singles object.


Q: Why doesn't my bitmap get imported?

A: It may be too large, or spacing may be set too small, or linewidth too high. A scene is limited to 65536 vertices in total; if a bitmap import would produce too many vertices, the import is aborted. Also make sure the bitmap really is a 24-bit Windows bitmap.


Q: Why do my imported bitmap outlines look ugly?

A: The source bitmap is probably anti-aliased, which messes up the transparency colour mask. You can remove the artefacts in Phyz, but the proper way is to make a clean cut-out, so that the outline is sharply defined by a solid, non-changing background colour.


Q: Which command-line parameters are available?

A: Phyz optionally takes a file name parameter, specifying a scene or model to open.


Q: How large is Phyz' universe?

A: Phyz' universe is 16000 units wide, 16000 tall. A vertex travelling outside the universe either bounces or causes its object to disappear (see the Simul menu).


Q: What's the scale of Phyz?

A: There is no specified correlation between Phyz and reality. Supposing gravity works the same in Phyz as on planet Earth, and by dropping things with gravity on and friction off, one could use PhyzLizp (or a stopwatch) to measure Phyz distances, in which case one would come to the conclusion that a vertex's diameter (8 Phyz length units) corresponds to just short of one real world meter in Low speed, or one decimetre in High speed. To estimate the acceleration due to gravity in Phyz, one could use a spring (set k=1) as a force gauge; one vertex makes such a spring about 9.8 Phyz length units longer. To achieve the same elongation using a Phyz rocket, one would have to set the F parameter to 9.8 Phyz force units.


Q: What kind of creature is a vertex, is it like a billiard ball?

A: A billiard ball is elastic, unlike a vertex. Think of a vertex as the smallest mass- and area entity, and combine it in clever ways with other verts to simulate the phenomena you're researching.


Q: How do I make a bomb?

A: Draw a circle (ellipse tool); replace the rods with sticks (Edit menu); make the sticks explosive. The bomb goes off as soon as one of the sticks breaks; you may want to adjust the s (strength) parameter of the sticks.


Q: How do I make a more powerful bomb?

A: Use a spacing less than 8 (the diameter of a vertex). This boosts the bomb's power since Phyz immediately adjusts the positions of the overlapping vertices. It also makes the bomb go off as soon as physics is turned on.


Q: How do I make the Mother of All Bombs?

A: If you're like Dax, you're still not satisfied. You want a MOAB. So you superimpose several bombs on top of each other, preferably with each bomb a little larger than the previous one, as in this example.


Q: How do I make the Father of All Bombs?

A: Explosions are all about energy. So far we've used explosive sticks and overlapping vertices as energy sources. Only fear would stop you from combining these with same-signed charges, rockets and PhyzLizp to produce a Phyz FOAB, the most powerful conventional weapon in the world.


Q: How do I simulate magnets?

A: The force between two magnetic poles is proportional to the electrostatic force between corresponding electric charges, which can be simulated with the charge constraint. Two rod-connected vertices with charges of opposite signs yields an electric dipole with an electric field proportional to the magnetic field of a magnetic dipole.


Q: Why does a charge with c=0 behave like a charge with c=1?

A: A charge with c=0 behaves like c=1 when it interacts with another, negative charge. It behaves like c=-1 when it interacts with another, positive charge. That is, the resulting force is always attractive.


Q: Do all charges interact?

A: No, charges with rods don't interact if they belong to the same object.


Q: My spring/pin/anchor etc disappeared with a snapping sound, why?

A: If Breakable constraints (found in the Simul menu) is enabled, constraints break under heavy load in Phyz. Note: sticks are always breakable.


Q: Help! Someone's peeling a banana on my screen!

A: That would be the animated wait cursor, a rare sight in Phyz. In fact, Dax would consider any banana older than one second overripe. All edit operations in Phyz should have a time complexity equal to or better than O[n log(n)], where n is strictly bounded by the number of allowed items (65536 per item type).


Q: What are the s and x stick parameters?

A: A stick is like a breakable rod which optionally explodes when breaking. The s parameter (range 0..1) is the strength of the stick; the x parameter is the explosiveness. If x>0 the stick will explode during a time interval proportional the the stick's length. Typical values for x ranges from 2 thru 50.


Q: What are the V1 and V2 hslot parameters?

A: If V1=-1, the slot is horizontal, positioned at y=V2. If V1=-2, the slot is vertical, positioned at x=V2. Otherwise, the slot allows movement along the line going through the vertices V1 and V2.


Q: How large can the k spring constant be?

A: Springs in Phyz obey Hooke's law: F = -kx, where k should be 0 or positive in Phyz. In principle, this means k can be infinitely large. In practice, since Phyz models reality in discrete time steps, setting k = 1560 amounts to simulating an infinitely stiff spring. Values larger than this can yield completely unrealistic (but sometimes desirable) results.


Q: What is the mass of an object?

A: In Phyz, the mass of an object is equal to the number of vertices in the object.


Q: Where is the centre of mass of an object?

A: In Phyz, the centre of mass of an object is equal to the arithmetic average of the positions of the vertices in the object, which is equal to the object's position.


Q: What is the position of an object?

A: In Phyz, the position of an object is equal to the arithmetic average of the positions of the vertices in the object, which is equal to the object's centre of mass.


Q: What is the velocity of an object?

A: In Phyz, the velocity of an object is equal to the arithmetic average of the velocities of the vertices in the object.


Q: How can I nudge selected items?

A: Use the arrow keys to move the selection in steps of 1 unit.


Q: How do I rotate objects?

A: Use Ctrl+Left, Ctrl+Right to rotate in single degrees; use Ctrl+Up, Ctrl+Down to rotate in steps of 15 degrees.


Q: I want elastic collisions, is there a "elasticity" property I can change?

A: A single vertex is as inelastic as it gets. There are several combinations of verts and rods which make elastic objects, and of course you can use springs and change the spring constant.


Q: I made a rectangle, 100 by 10 vertices, and it isn't rigid, why?

A: Because it's 10 times wider than it's tall. In real life, no compound object is perfectly rigid, and the more oblong it is, the more elastic it gets. In Phyz, the effect is exaggerated since there's no 3rd dimension (objects are very, very thin).


Q: What's with the "2.5D"?

A: Phyz is a 2D simulator with layers. The layers make it possible to construct machines with moving parts that don't collide, as if they were moving "over" or "under" each other in the 3rd dimension.


Q: Is Phyz really fastest in the world?

A: Dax Phyz is the world's fastest 2.5D physics engine with built-in, real-time editor and DirectX graphics and sound.


Q: How are frame rate and simulation speed related?

A: The frame rate (number of screen frames displayed per second, FPS) is independent of the simulation speed (number of physics frames calculated per second, PPS), unless synchronization is enforced by enabling Frame rate lockstep. If a lockstep mode isn't already enabled, Phyz automatically enables 5x frame rate lockstep and Frame rate 30 fps when recording starts.


Q: What is Frame rate lockstep?

A: Normally, the physics simulation is independent of the graphical display rendering, see above. By enabling Frame rate lockstep (in the Simul menu), Phyz synchronizes physics and graphics, so that exactly x number of physics steps are calculated for every screen frame rendered, where x is 5, 2 or 1. If graphics rendering is delayed, the physics calculations are slowed down, and vice versa. Performance is sub-optimal in lockstep mode.


Q: How do I capture high quality videos of Phyz?

A: In the Simul menu, enable 5x frame rate lockstep. In the Window menu, check Frame rate 25 fps (or 30 if you want a little speed-up). Start and stop (toggle) recording with File/Record frames (F11). This way, exactly one frame will be captured for every five physics steps, yielding 25 fps playback of a full speed (125 pps) simulation. The frames are saved as individual JPG-files in a sub-folder to Phyz' current folder; use a program like VirtualDub to produce a video file (e.g. avi-file).


Q: Do I need a fast computer to capture high quality video?

A: No, only patience; with Frame rate lockstep enabled, the resulting video is optimal, regardless of how much wall-time it takes to produce. If a lockstep mode isn't already enabled, Phyz automatically enables 5x frame rate lockstep and Frame rate 30 fps when recording starts.


Q: Who changed my simulation speed and frame rate?

A: If a lockstep mode isn't already enabled, Phyz automatically enables 5x frame rate lockstep and Frame rate 30 fps when recording starts. Both are restored when recording ends, unless either was manually altered during the recording.


Q: How do I capture the workspace only, not the whole window?

A: Check Record workspace only in the Options menu.


Q: I don't want the cursor to be captured, how?

A: Uncheck Record cursor in the Options menu. This also disables the software cursor visual cues when recording.


Q: Can I record to BMP-files instead of JPG?

A: Yes, check Record to BMP in the Options menu. The frames will be saved as uncompressed BMP-files; keep in mind that this will take a lot of disk space (several megabytes per frame in full-screen mode).


Q: Why does Phyz start to work when I stop recording?

A: At the end of each recording, Phyz converts each recorded frame from an internal format to JPG or BMP. This is postponed until the end of the recording to minimize the impact during the recording session itself. The conversion process can be halted with the F11 key, in which case all unconverted frames are deleted.


Q: What are the LZO-files that Phyz creates while recording?

A: LZO-files produced by Phyz are bitmaps compressed with an LZO-based algorithm. Normally, these files are automatically converted by Phyz at the end of each recording, to JPG or BMP files. If Phyz is terminated while recording or converting, some LZO-files may remain; these are safe to delete.


Q: Why doesn't Phyz record to JPG or BMP directly?

A: JPG is too CPU-demanding, BMP is too disk demanding; both formats would normally lower the frame-rate significantly. The LZO-based compression performed by Phyz is lightning fast (about 5 times slower than memcpy) and compresses Phyz frames good enough (about 1:4) for modern hard disks to cope.


Q: How do I import the recorded frames with VirtualDub?

A: Start VirtualDub. With File/Open video file, open the first Phyz frame (JPG-file); this loads this and all subsequent frames in the folder as a video. Use Video/Framerate to set the frame rate (e.g. 25). Create the video with File/Save as AVI.


Q: How do I import the recorded frames with AviSynth?

A: Many video processing applications, such as MeGUI, use AviSynth as front-end. To import Phyz frames 1 thru n, use a script like this:

  ImageSource("frame_%06d.jpg", start=1, end=n")


Q: How and when do vertices collide?

A: Vertices collide (if their positions overlap) if they are on the same layer and they don't belong to objects which are pinned together (with the pin constraint). Vertices in the same object don't collide if they have one or more rods connected to them.


Q: How do I change friction between objects?

A: Friction between objects is a macroscopic effect in Phyz. Objects with several vertices glide more or less easily, depending on the position and rigidity of the verts defining the objects' edges.


Q: How do I use the extra spring parameters?

A: Apart from the rest length (l), the spring constant (k) and the damping constant (d), you can turn a spring into an actuator by changing the S parameter from -1 to the number of another spring. The rest length of the spring will then be a function of the other spring's actual length: restlen = a * otherlen + b (the value of l is disregarded).

Changing the S parameter to -2 yields a rest length equal to l + l/2*sin(a*t - b), where t is the current time in physics frames.


Q: How do I use the Vr rocket parameter?

A: A rocket applies a force in the angle specified by the a parameter.  If Vr is -1, the angle is measured from the X axis; otherwise Vr should be the number of a vertex, in which case the angle is measured from a hypothetical line connecting the rocket's vertex and Vr. If these vertices are rigidly connected to each other (forming part of a body), the effect is that the rocket rotates with the body.


Q: Which physics engine is Phyz using?

A: Phyz uses a proprietary, vectorized, second order integrator with stochastic algorithms, hand-coded SIMD (SSE2) assembly and the Mersenne Twister RNG to enhance speed and realism.


Q: Does Phyz support OpenMP?

A: Yes, core components are task and data parallelized and take advantage of multiple cores and processors through the OpenMP 2.0 API.


Q: Why doesn't Phyz use SSE3 or higher?

A: Nemea's computer doesn't support SSE3. The Phyz integrator is already fully vectorized for SSE2 streams, rendering the new instructions superfluous. For other code segments, Phyz will use SSE4.2 instructions if available.


Q: Who is Nemea?

A: Nemea Stache is Dax Stache's little sister.


Q: Why don't I get exactly the same result when I run the same simulation twice?

A: Phyz uses stochastic algorithms, which are initialized with a pseudo-random, time-dependent seed, to enhance realism and discourage Dax from building fluke-dependent contraptions. By ticking Deterministic on the Simul menu, the algorithms are reset with a constant seed each time physics is turned on, yielding completely deterministic behaviour (even across hosts, allowing for low-bandwidth network protocols).


Q: Phyz runs slowly (PPS is below 125), why?

A: Phyz should run very quickly; that is, it should be able to handle complex models in real time. Nevertheless, it's possible to construct too complex models. Phyz limits the number of vertices to 65536, which can be combined in ways which stalls the processor. If you feel that your model runs slower than it should, make sure you have at least 1 GB of free RAM; Phyz sacrifices memory for speed, but if memory is exhausted, speed suffers dramatically. Also make sure you have the latest display drivers and the latest DirectX distribution.


Q: How do I choose which of several nearby items to select?

A: Hover over them, and use Tab to cycle through the objects under the cursor. The status line at the bottom of the window displays the current "hover" item.


Q: How can I construct my own constraints, measure quantities and events or create a game in Phyz?

A: By using PhyzLizp, or any other programming language capable of sending and receiving Windows messages.


Q: Can I extend Phyz with my own external application?

A: Yes. You communicate with Phyz using Windows messages to read and set vertex and constraint properties. See the Phyz specific PhyzLizp source code for details. Also, the Clipboard can be used to transfer model definitions.


Q: How do I package my Phyz application, to avoid having to manually start Phyz and PhyzLizp, then load scene and script?

A: Let the scene and the script have the same base filename, e.g. "ShootEmUp.pzs" and "ShootEmUp.lzp". Then from the PhyzLizp console type:

(embed '(PzStartApp "ShootEmUp") "ShootEmUp.exe" nil)

Use Control+Enter to execute. This will create ShootEmUp.exe which is used to start the application, which is comprised of the files ShootEmUp.exe, ShootEmUp.pzs, ShootEmUp.lzp and Phyz.exe; all four should reside in the same directory. See this example.


Q: Why do vertex and constraint indices change?

A: For performance reasons, the internal indices (id numbers) are always kept strictly sequential (without "holes"), and vertices belonging to the same object are grouped together. When items are added or deleted, or when vertices change objects, existing items' indices may change. Note that this applies to explosions, broken constraints and blackholing (when vertices travel outside the universe) as well as GUI (and PhyzLizp) editing.


Q: How do I keep track of items in PhyzLizp even though their indices change?

A: In PhyzLizp, items are referred to by their registered indices, which are static between calls to PzRegReset. The PzRegReset function (equivalent to the Edit/Reg reset menu item) clears all old registrations and registers every existing item with its current dynamic (internal) value. Note that the PzFindPhyz function calls PzRegReset. Items created with PhyzLizp are automatically registered. Use the PzReg* functions to manually register items, and the PzReg*Get functions to get the current static (internal) index of a registered item.


Q: Why do I get a message "This application has failed to start because d3dx9_xx.dll was not found." when I start Phyz?

A: You need to upgrade your system's DirectX run-time; download DirectX from Microsoft Download Center free of charge.


Q: Why do I get a message "Insufficient DirectX 9 hardware resources detected." when I start Phyz?

A: Your display adapter (GPU) isn't powerful enough. Phyz is a high-end application which requires a certain level of GPU hardware support, and there is no way around it.


Q: Why do I get a message "Insufficient CPU hardware resources - SSE2 capabilities required." when I start Phyz?

A: Your CPU isn't powerful enough. At its core, Phyz contains hand-coded SSE2 assembly, which older processors such as AMD Athlon are unable to handle.


Q: Why do I get a "system exception" when I start Phyz?

A: This may be due to a number of reasons, such as a bug in Phyz or a corrupt DirectX installation. If you get Exception C000001D, however, it's likely that your CPU doesn't support SSE2. At its core, Phyz contains hand-coded SSE2 assembly, which older processors such as AMD Athlon are unable to handle.


Q: How can I determine whether my CPU supports SSE2?

A: Start PhyzLizp and look for the line starting with Processor caps; this line will contain "SSE2" if and only if SSE2 support is detected. Or get all the gory details with the CPU-Z utility from cpuid.com.


Q: Vertices and/or constraints don't look right, why?

A: Some display adapters and drivers, especially older ones, don't implement the DirectX features used by Phyz correctly. This can lead to visual artefacts such as skewed vertices, dots instead of spheres or invisible rods. Phyz uses DirectX 9 point sprites which must be supported in hardware by the GPU, or properly emulated by the driver. You can test your system's point sprite capabilities with this simple demo application from CodeSampler.com.


Q: I found a bug, or have a suggestion which might improve Phyz, how can I share it?

A: Please use the e-mail address on the Contact page.