Saturday, May 27, 2006

Agency Insider: Where's that block?

Welcome to the first installment of Agency Insider, where we give you a sneak preview of features slated for upcoming releases! Today's feature will be available in the next release, Preview 3, which is due out this summer.

Block languages make it easier for us to program because we don't have to remember the names of the commands or what types of arguments they take. All we have to do is find the command we want in the block factory, drag it out, and connect it in the right spot. The problem is that sometimes we can't remember which category the block we want is in. Another tricky problem is when we've been working on a really large project for a while with dozens and dozens of blocks, and we can't remember where we put parts of our program. Sure, the Minimap helps us find our way around, but we often wished that we could just search for the block we're looking for, the same way we use Google to find a web site quickly instead of hunting through our bookmarks.

Well, now we can search for blocks, and when Preview 3 is ready to be released, then you can too! We added a handy search bar to the corner of the Blocks view:


As you type into the search bar, StarLogoBlocks begins to light up, highlighting every block bright yellow that contains what you typed in its name. Below, I typed "set." Both the "setx" and the "set height" blocks contain the letters "set," so they light up, both in the workspace and in the factory. You'll also notice yellow splotches on the Minimap that show where other "..set.." blocks are that we can't see. For example, the tall one in the middle is a "Setup" block.


Also, notice that some of the categories lit up yellow as well: Interface, Movement, Colors, Control, and Traits. That's because those are all of the categories that contain blocks that have "set" in their name. So, now, if you ever forget where the "setx" block is, just search for it, and the Movement category will glow yellow!


To make it even easier to use search, we added a few extra menu items and keyboard shortcuts:
"Find Blocks" is nothing special; it just moves your cursor to the search bar so you can start typing your search term. After you type your search term, and a bunch of blocks on the workspace turn yellow, you can use "Find Again" or "Find Previous" to jump to the next or previous block in the search results. Actually, "jumping" is not the right word; it's more like you fly to the next block. The workspace glides from wherever you were looking over to the next block so it becomes the center of your view.

Finally, "Find Related Blocks" is for those times when you're looking at a procedure and want to find all the places where it gets called, or you are using a variable and wish you could find the variable declaration block so you can rename it. "Find Related Blocks" searches the workspace for blocks with the same name as the last block you clicked on. Since procedure call and definition blocks have the same name, and since variable declaration, getter, and setter blocks all have the same root name, Find Related Blocks helps you find all those similar blocks instantly.

We are really excited about the new search feature, and we can't wait to share it with you in Preview 3!

Labels: ,

Monday, May 22, 2006

The Agency: Video tutorials now available

Kevin Wang, one of our curriculum developers for StarLogo TNG, produced some excellent video tutorials, which you can download from the StarLogo TNG web site. If you have trouble viewing the videos, you may need to download the free Apple QuickTime player, which is available for both Mac OS and Windows.

The video tutorial series begins with an introduction to StarLogo TNG and continues with guides to making simple procedures, controlling agent movement with the keyboard, editing the terrain, utilizing different camera perspectives, and handling agent collisions.

We'll let you know here when more videos become available.

Labels:

Tuesday, May 16, 2006

Turtle Speed: Focus on Spaceland

In a recent post, I explained the difference between FPS and VMPS in StarLogo as well as how to monitor them by pressing the "H" key. I also showed you how to control the VMPS using the Speed Slider.

Unfortunately, there is no way to control the FPS directly. The number of frames per second that StarLogo can show you depends a lot on your computer's hardware, especially its graphics card and processor. Nevertheless, today's tip explains one way to boost Spaceland's FPS substantially.

Many 3D games take up the whole screen while they are running. They can run as fast as possible without worrying about whether it will slow down your ability to surf the web or compose an e-mail message, whereas StarLogo does not have that luxury. One of our design goals is that running a model in Spaceland, even at max speed, should not interfere with your ability to modify the blocks code or work with other pieces of software. Spaceland cannot greedily hog your computer's processor if you want to multitask.

In order to meet this goal, we designed Spaceland to automatically throttle the FPS when it is not the focused window. For example, when you push a Forever button in the Runtime workspace, Spaceland will not have focus, as shown for Mac OS X in the screenshot below, where you'll notice that the title and the three buttons on the left are grayed out:


Even at max speed, when Spaceland is not in focus, this Mac only gets about 34 frames per second and 33 virtual machine cycles per second. Now, if you click on the Spaceland window, the buttons light up red and green, and the title becomes bold:


Wow! The FPS shot up to 110 frames per second on this Mac, and all we had to do was click on the window. By giving focus to the window, we are literally telling StarLogo that we intend to give Spaceland our attention, and Spaceland speeds ahead. Then, when we want to control the model with blocks, as soon as we click on a block, Spaceland loses focus and slams on the brakes, giving the blocks a chance to move.

Labels: ,

Friday, May 12, 2006

Change Agent: Save early, save often

Losing data is one of our biggest fears when it comes to working with technology. A web site goes down, and we lose that e-mail message we spent an hour composing. A program crashes, and the document or presentation we were working on vanishes. Ever had a mobile phone stolen or run over by a truck? Then you might know how hard it is to recover all of your friends' phone numbers.

As much as we wish StarLogo TNG could be the most reliable piece of software you have ever used, it isn't. Preview 2 is still a beta release, and while it is good enough to use and play with, sometimes it breaks when you least expect it. For that reason, I'll give you the same advice about StarLogo that I would give you about any piece of software: save your project early and save it frequently. That way, if and when StarLogo crashes, you will be able to load your project without having to redo too much yourself.

One caveat is that even the saving and loading mechanism of StarLogo may not always work either. Some users have reported that some of their blocks disappear or show up disconnected when they load their projects. The "Save Next Version" feature can help you avoid extreme data loss from corrupted save files.

After you save a new project for the first time, you can choose File... Save Project to update the existing save file with the current project, or you can choose File... Save Next Version, which preserves your original file and creates a new one with the next available version number appended to it. So if you're working on pacman.sltng, Save Next Version will put a new file called pacman01.sltng in the same folder. Save Next Version again, and you'll be working on pacman02.sltng.

That way, when you try to load the most recent version, you can easily go back to an earlier version if there is a problem. If your project loads without any trouble, then you can safely delete earlier versions of the project.

One last warning: In Preview 2, there is a bug that prevents Save Next Version from warning you if it will overwrite an existing file. So if you are editing pacman.sltng, and you already have a file called pacman01.sltng in the same folder, Save Next Version will overwrite pacman01.sltng without giving you a chance to change your mind first. We'll fix that for the next release.

Labels:

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:

Saturday, May 06, 2006

Change Agent: Disable keyboard camera controls

We think that one of the coolest features of StarLogo TNG is that you can fly around SpaceLand while your model is running. In aerial mode (the airplane button), you can use your mouse or the keyboard to pan the scene, rotate for the right angle, and zoom in for a better view.

Unfortunately, controlling the camera with the keyboard conflicts with another cool feature-- namely, controlling agents with the keyboard. To see what I mean, let's build a model that does just that (or download it).

First, we'll make a procedure called Move that checks whether a key is down, and, if it is, moves the agent forward one step in that compass heading. Note that since we're using if blocks instead of if-else blocks, the procedure can detect when we press more than one arrow key at the same time to make the agent move on a diagonal.

Next, drag out a Forever block and call the Move procedure we just created.

Finally, let's setup the model to create a single turtle agent in the center of SpaceLand.

Great! Now click the Runtime tab, where you'll see two buttons called Setup and Forever. Click the Setup button to create our single turtle in the center of the screen, then click Forever to start the model. Now, use the arrow keys to move the agent around.

Uh-oh. While you may be able to tell that the agent is moving in response to your key presses, you were probably more distracted by the camera moving around too. Sure, you could switch camera modes to the 2D top-down view, or perhaps use the the over-the-shoulder perspective, but what if you really want to keep the model running in aerial mode?

Fortunately, there's a menu item tucked away under Options called "Keyboard moves camera." If you look at it, you'll see a checkmark next to it, which indicates that, yes, in fact, the keyboard is controlling the camera (but we already knew that).


In the next release we intend to make this option more visible, but for now, all we have is the menu item. So choose Options... Keyboard moves camera, and the next time you look at the Options menu, you'll see that the checkmark is gone. The keyboard no longer controls the camera, and you are free to use all those keys in your model to control agents. Go ahead, try it!

Labels: ,

Friday, May 05, 2006

The Agency: Some USB devices may cause hang on startup

The StarLogo Team posted a new FAQ item yesterday:
StarLogo starts loading and then stops. Why won't it load?

The problem may have to do with USB devices connected to your computer. The libraries that search for USB game pads and joysticks may be hanging when it finds other devices. Try disconnecting additional USB devices and send us a bug report (bug-starlogo@education.mit.edu) to let us know about the problem device.
So far we have received reports about this problem for a Sun mouse, a Sun keyboard, or an IBM mouse connected to a Mac Mini, as well as for the remote control connected to a Windows Media Edition PC.

This bug affects StarLogo TNG Preview 2 for some configurations of Mac OS and Windows.

Update: This problem was fixed in the Mac distribution on May 7. If you downloaded before then and are experiencing this problem, please update.

Labels:

Tuesday, May 02, 2006

The Agency: This blog's for you

Welcome to StarLogo TNG - Free Agent, the official blog for The Next Generation of StarLogo. Here you will find news, features, guides, and more about the 3D graphical programming environment for game development and modeling decentralized systems. Here's a preview of what you'll find here:

The Agency
Official news from the StarLogo Team about releases and resources

Agency Insider
Sneak previews of upcoming features in future releases of StarLogo

Turtle Speed
Performance tips for giving your simulations a real speed boost

Block Talk
Guides to getting the most out of StarLogoBlocks, the language of TNG

Change Agent
Tips for getting the best experience from the evolving StarLogo TNG

Model Depth
In-depth looks at sample and user projects with ideas for curriculum

Free Agent
Features on the StarLogo Team, the people behind the software

Labels: ,

The Agency: Preview 2 Released for Mac & Windows

We are happy to announce the release of StarLogo TNG Preview 2, which is now available for download.

Preview 2 is the first release available for both Mac OS X and Windows. The delay of the Mac release has allowed us to release it as a Universal Binary, which runs natively on both Intel and PowerPC Macs. The performance on the Intel Macs is phenomenal.

Among the noted features of this release are drastically improved performance (averaging about 5x faster on many machines) and many bug fixes. But there are a number of new features as well, including patch variables, tool tips for blocks, more functionality for setup and collision blocks, up/down blocks, ask-agent block, and many new shapes and sample projects.

One subtle new feature, relating to speed, is the "Max" speed on the speed slider. For simulations, try cranking it all the way up. Projects that don't stamp patches (which is still slow and will be improved in Preview 3) run very quickly, easily besting StarLogo 2. Finally, be sure to press the H key for help, which tells you all of the ways you can navigate Spaceland.

For the Windows users out there, a full list of changes from Preview 1 to Preview 2 is available.

Enjoy!

StarLogo Team

Labels:

The Agency: Intro to StarLogo TNG

StarLogo TNG is The Next Generation of StarLogo modeling and simulation software. While this version holds true to the premise of StarLogo as a tool to create and understand simulations of complex systems, it also brings with it several advances. Through TNG we hope to

  1. Lower the barrier to entry for programming by making programming easier.
  2. Entice more young people into programming through tools that facilitates making games.
  3. Create compelling 3D worlds that encompass rich games and simulations.

We released the first "preview" edition in January 2006, and the second preview in May 2006, with a final version expected in summer 2006. It is Java based and is available on Windows and Mac OS X (as a universal binary) with a Linux versions coming soon. Some features include:

  • 3D models in MD3 (Quake 3) and OBJ formats
  • Terrain editor for designing levels
  • Joystick and keyboard inputs
  • 1st and 3rd person views
  • "Say" bubbles to communicate text
  • Easy yet powerful and innovative visual programming language

You can now download StarLogo TNG for Mac and Windows from the official StarLogo TNG web site.

Labels: ,