Tuesday, May 09, 2006

Turtle Speed: Slide into high gear

We designed StarLogo TNG with the following goal in mind: Models should run at the same speed on all computers that meet the minimum system requirements.

In order to meet this goal, we defined two distinct measures of model speed called FPS and VMPS. FPS may be familiar to all the gamers out there. It measures the number of "Frames Per Second" that your computer draws in the Spaceland window. Computers with high-end graphics cards will achieve higher FPS, and the higher the FPS, the smoother the animation. It will still take an agent the same amount of time to walk forward one step, but it will look more fluid on a faster computer.

VMPS is the number of "Virtual Machine [cycles] Per Second," and it measures the number of times per second that your model gets run by every agent. So if your block program is "Forward 1," there are 100 agents in the model, and you put the program in a Forever button, then the VMPS is how many times every second that all 100 agents take one step forward as the program is repeated forever.

Tip: The "H" key toggles displaying the FPS and VMPS in Spaceland.

While it is true that a given model should run at the same speed on any computer, we realized that not all models need to run at the same speed, and sometimes it is useful to speed up or slow down a model while you are developing it. The Speed Slider makes this task easy! Just click the "Runtime" tab and drag the slider to adjust the speed. You can even pause the model entirely and run it one VM cycle at a time with the "Step" button.

So, if you want your model to run twice as fast, drag the slider to the tick mark labeled "2x," or just click on "2x." The FPS might stay the same, but the VMPS will double!

But what if you don't care about your model running at the same speed on any computer, and you just want your model to run as fast as your computer will let it? Games would not be as fun if they played this way, but sometimes it helps if you are running a simulation. The good news is that you can; just move the slider all the way to "Max" to get the maximum speed.
Now, if you press the "H" key to look at the FPS and VMPS for your model, you'll see that they are about the same. Instead of trying to get smooth animation, TNG will only draw one frame for every cycle of the VM. It may not look as nice, but it will be fast!

You may also notice that the numbers fluctuate-- a lot. That's because your computer may be trying to do other things while you are running the model. For example, if your computer is also playing music or connecting to a web site, it will have less free time to run your model, and the model will run more slowly. At max speed, the fewer other things your computer has to worry about, the faster your model will run.

Labels:

0 Comments:

Post a Comment

<< Home