Beginner's Guide to Superior Construction
Posted: Fri Nov 06, 2009 6:05 pm
Here, I'm assuming you just downloaded the program a few days ago, and you've learned how to make some simple stuff like a car or a single-shot gun, but you haven't really built anything impressive. This tutorial will not tell you exactly how to make anything in particular, but instead will teach you some techniques and explain some features that you can use to make stuff more skillfully. I was thinking of calling the tutorial How to Not Suck at Phun, but that might put some people off. It's a long one, so don't hesitate to read in chunks.
Well, first things first...
Advanced Mode Rules
Advanced Mode rules! Before you bother doing anything, make sure you have the interface set to Advanced Mode in the Options menu. This opens up loads of cool tools and options you can use to build more precisely and make more complicated devices. There are a lot of them, as you will see as soon as you check the box. All of the menus will bulge with new options. A few of the complicated ones will be highlighted here, but don't forget to play around with all of them.
Scale Tool
There is a tool on the toolbar that seems to get noticed less than the others, and that's the Scale tool, nestled between the Rotate tool and the Cut tool. Don't forget about it, and it will be your friend. It will stretch objects from the opposite corner or side, if it's a polygon or a box or a machine with multiple parts. One object with one hinge or fixjoint on it will be scaled from the hinge or fixjoint. You can use that to your advantage by placing a hinge at the point you want to scale from and deleting it afterward. Except for circles. Single circles will always be scaled from the center, hinge or no.
If you scale a box or a circle in a way that makes it no longer a perfect rectangle or circle, it will be transformed into a polygon with the desired shape, such as an oval or a parallelogram. Polygon collisions are not handled as well as box and circle collisions are, so be careful with wheels and really skinny boxes.
To do perfect scaling, two options are available to you. Holding SHIFT while scaling will scale it the exact same proportion vertically and horizontally. This will mean your circles will always stay circles and your boxes will always stay boxes and all your perfectly-fitting stuff will fit just the same after scaling. The other option is to hold CTRL while scaling. This will make it scale in perfect increments such as 2X or 1/3X. The axes are independent, so you can make it exactly twice as tall without changing its width.
SHIFT is a useful key throughout many options. It generally makes whatever you're doing "perfect".
Cut Tool
The Cut Tool is pretty straightforward. You draw a line through an object, and it cuts that object along the line. Hold SHIFT to make a straight line. Take note that cut lines have more vertices than the normal for polygon surfaces. It can be more precise sometimes than the initial drawing. Zoom in for very precise carving. Anything you cut will be turned into two polygons, whatever it was before and no matter how precisely you made the cut. i.e. slicing a box perfectly in half will make two rectangular polygons instead of two boxes.
Take note that cutting can make some very tiny scraps. Also, the border between two cut parts resting on each other can have a lot of collisions at once (especially in Phun; Algodoo has an algorithm to reduce it but it isn't perfect), which can be laggy for big things cut into many pieces. If you want a breakable wall, it's usually a good idea to hinge most of the parts together and make the hinges breakable. A wall held together by breakable hinges can also have the No Self-Collision option checked, allowing it to collapse to almost nothing when destroyed.
Cloning with CTRL
There's a little button that says clone, but you're better off just holding CTRL and dragging. It clones all the selected objects and puts them under the control of your cursor, so you can put them wherever you want immediately. Hold SHIFT too to lock the movement to only one axis. That trick works for more than cloning, but it's very useful for making repeating patterns that follow a perfect grid. Hold CTRL and the mouse button down for a second or two without moving the mouse, and you have created a clone precisely on top of the original.
CSG Rocks my Socks
CSG stands for Constructive Solid Geometry. USE IT. It is the most powerful shape-building tool in Phun/Algodoo. It is used with two or more overlapping shapes. When you have a shape that's overlapping with another, you get four things you can do under the CSG menu, which is in the object's menu.
CUT: This will cut a line in the other shape where the border of the selected shape crosses it.
SUBTRACT: This deletes any portion of the other shape that is overlapping with the shape you have selected.
INTERSECT: This deletes any portion of the other shape that ISN'T overlapping with the selected shape.
ADD: This adds the outline of your shape to the other shape.
These tools are GREAT for making car bodies and other complex shapes into one polygon.
Gridlines
If you have Algodoo, there is a Grid tab in the Options menu. "Show Grid" will display a grid with the given number of axes, in which the largest lines designate the ones crossing the origin. When Snap to Grid is checked, everything you do will follow the grid lines and points exactly. Good for making a perfect piston, and you can also use the grid lines to make things with precise dimensions, like exactly 12 meters tall. Every line you draw in this mode will be straight or made of straight segments, but if you want to make a straight between distant and misaligned grid points, hold SHIFT.
Console
Open up and close the console by pressing F11 in-game. It will display in text what the program has been doing, and show errors when they happen. It's a decent debugging tool for when you're trying to script something, and can be used to modify your config file by entering your own code.
EXTRA TOOLS
These are some debugging and convenience items that you can add to your program without much difficulty, and most of them were included by default in earlier versions of Phun. They are small extensions to your config file, the file that remembers all of your settings while the program isn't running. Take note that if you know a thing or two about Thyme, you can do a lot to customize your config file and put loads of special options in it, from custom functions to spawn commands or more. To add these extra tools, open up the console and paste the following lines into it and press ENTER.
Makes F5 toggle a visualization of the forces used when the cable algorithm is activated. The cable algorithm makes chains way stronger and is only activated when they're stretched beyond a certain point. It can also apply to inter-hinged groups that aren't chains, for better or for worse.
Makes F6 toggle little green dots showing the centers of gravity for single geometries and bodies. Objects glued or fixated together are in the same body. The lines coming off the dots indicate the velocity of the bodies.
Makes F7 toggle little green dots showing where the vertices of a polygon are.
Makes F8 toggle red dots and lines showing the position and strength of forces from collisions. Green dots and lines show where and how far one object is embedded inside another. I have this one on most of the time. VERY useful for finding out what's wrong with a very complicated machine that isn't working.
Makes F9 toggle the grid. It's just easier and faster than going into the options menu.
That's it for the more complicated tools. Expect a guide on reducing lag soon!
Well, first things first...
Advanced Mode Rules
Advanced Mode rules! Before you bother doing anything, make sure you have the interface set to Advanced Mode in the Options menu. This opens up loads of cool tools and options you can use to build more precisely and make more complicated devices. There are a lot of them, as you will see as soon as you check the box. All of the menus will bulge with new options. A few of the complicated ones will be highlighted here, but don't forget to play around with all of them.
Scale Tool
There is a tool on the toolbar that seems to get noticed less than the others, and that's the Scale tool, nestled between the Rotate tool and the Cut tool. Don't forget about it, and it will be your friend. It will stretch objects from the opposite corner or side, if it's a polygon or a box or a machine with multiple parts. One object with one hinge or fixjoint on it will be scaled from the hinge or fixjoint. You can use that to your advantage by placing a hinge at the point you want to scale from and deleting it afterward. Except for circles. Single circles will always be scaled from the center, hinge or no.
If you scale a box or a circle in a way that makes it no longer a perfect rectangle or circle, it will be transformed into a polygon with the desired shape, such as an oval or a parallelogram. Polygon collisions are not handled as well as box and circle collisions are, so be careful with wheels and really skinny boxes.
To do perfect scaling, two options are available to you. Holding SHIFT while scaling will scale it the exact same proportion vertically and horizontally. This will mean your circles will always stay circles and your boxes will always stay boxes and all your perfectly-fitting stuff will fit just the same after scaling. The other option is to hold CTRL while scaling. This will make it scale in perfect increments such as 2X or 1/3X. The axes are independent, so you can make it exactly twice as tall without changing its width.
SHIFT is a useful key throughout many options. It generally makes whatever you're doing "perfect".
Cut Tool
The Cut Tool is pretty straightforward. You draw a line through an object, and it cuts that object along the line. Hold SHIFT to make a straight line. Take note that cut lines have more vertices than the normal for polygon surfaces. It can be more precise sometimes than the initial drawing. Zoom in for very precise carving. Anything you cut will be turned into two polygons, whatever it was before and no matter how precisely you made the cut. i.e. slicing a box perfectly in half will make two rectangular polygons instead of two boxes.
Take note that cutting can make some very tiny scraps. Also, the border between two cut parts resting on each other can have a lot of collisions at once (especially in Phun; Algodoo has an algorithm to reduce it but it isn't perfect), which can be laggy for big things cut into many pieces. If you want a breakable wall, it's usually a good idea to hinge most of the parts together and make the hinges breakable. A wall held together by breakable hinges can also have the No Self-Collision option checked, allowing it to collapse to almost nothing when destroyed.
Cloning with CTRL
There's a little button that says clone, but you're better off just holding CTRL and dragging. It clones all the selected objects and puts them under the control of your cursor, so you can put them wherever you want immediately. Hold SHIFT too to lock the movement to only one axis. That trick works for more than cloning, but it's very useful for making repeating patterns that follow a perfect grid. Hold CTRL and the mouse button down for a second or two without moving the mouse, and you have created a clone precisely on top of the original.
CSG Rocks my Socks
CSG stands for Constructive Solid Geometry. USE IT. It is the most powerful shape-building tool in Phun/Algodoo. It is used with two or more overlapping shapes. When you have a shape that's overlapping with another, you get four things you can do under the CSG menu, which is in the object's menu.
CUT: This will cut a line in the other shape where the border of the selected shape crosses it.
SUBTRACT: This deletes any portion of the other shape that is overlapping with the shape you have selected.
INTERSECT: This deletes any portion of the other shape that ISN'T overlapping with the selected shape.
ADD: This adds the outline of your shape to the other shape.
These tools are GREAT for making car bodies and other complex shapes into one polygon.
Gridlines
If you have Algodoo, there is a Grid tab in the Options menu. "Show Grid" will display a grid with the given number of axes, in which the largest lines designate the ones crossing the origin. When Snap to Grid is checked, everything you do will follow the grid lines and points exactly. Good for making a perfect piston, and you can also use the grid lines to make things with precise dimensions, like exactly 12 meters tall. Every line you draw in this mode will be straight or made of straight segments, but if you want to make a straight between distant and misaligned grid points, hold SHIFT.
Console
Open up and close the console by pressing F11 in-game. It will display in text what the program has been doing, and show errors when they happen. It's a decent debugging tool for when you're trying to script something, and can be used to modify your config file by entering your own code.
EXTRA TOOLS
These are some debugging and convenience items that you can add to your program without much difficulty, and most of them were included by default in earlier versions of Phun. They are small extensions to your config file, the file that remembers all of your settings while the program isn't running. Take note that if you know a thing or two about Thyme, you can do a lot to customize your config file and put loads of special options in it, from custom functions to spawn commands or more. To add these extra tools, open up the console and paste the following lines into it and press ENTER.
- Code: Select all
Keys.bind("f5", {App.drawCables = ! App.drawCables});
Makes F5 toggle a visualization of the forces used when the cable algorithm is activated. The cable algorithm makes chains way stronger and is only activated when they're stretched beyond a certain point. It can also apply to inter-hinged groups that aren't chains, for better or for worse.
- Code: Select all
Keys.bind("f6", {App.drawBodyCenters = ! App.drawBodyCenters});
Makes F6 toggle little green dots showing the centers of gravity for single geometries and bodies. Objects glued or fixated together are in the same body. The lines coming off the dots indicate the velocity of the bodies.
- Code: Select all
Keys.bind("f7", {App.drawVertices = ! App.drawVertices});
Makes F7 toggle little green dots showing where the vertices of a polygon are.
- Code: Select all
Keys.bind("f8", {App.drawCollisions = ! App.drawCollisions});
Makes F8 toggle red dots and lines showing the position and strength of forces from collisions. Green dots and lines show where and how far one object is embedded inside another. I have this one on most of the time. VERY useful for finding out what's wrong with a very complicated machine that isn't working.
- Code: Select all
Keys.bind("f9", {App.grid.grid = ! App.grid.grid});
Makes F9 toggle the grid. It's just easier and faster than going into the options menu.
That's it for the more complicated tools. Expect a guide on reducing lag soon!