Sunday, September 03, 2006

Model Depth: Paintballers Anonymous

Welcome to the first installment of Model Depth, where we take an in-depth look at StarLogo projects.

This post is about Paintball (paintball.sltng, found in the projects folder where you installed StarLogo TNG on your computer). Paintball is one of the first and most addictive sample projects we created to showcase some of the new features in StarLogo TNG, and you can read all about it in the Paintball Tutorial at our web site.

Here is a quick overview of the highlights of the model:

Premise
The user, or player, controls a single agent who can move across the Spaceland terrain and fire paintball agents at the turtle agents scattered throughout Spaceland. When a paintball collides with a turtle, the paint splatters and changes the color of the turtle it collided with.

Breeds
  • Mario
    • Mario is the player's avatar.
    • The Move procedure detects the player's keystrokes and moves Mario accordingly.
    • The Launch procedure creates new paintball agents when Mario fires.
  • Paint
    • The Paint breed represents the vibrant paintballs that Mario can fire at the turtles.
    • The projectile procedure causes the paintballs to move throughout Spaceland.
  • Turtles
    • The turtles are the targets for Mario's paintballs.
    • The breed uses the OBJ turtle so they can change color when hit by a paintball.
In addition to defining the three breeds, the model also has setup code to create Mario and a batch of turtles, and there is a collision block that handles collisions between paintballs and turtles.

Now, all you have to do is click the Runtime tab to view the Runtime Workspace, click the Setup button to setup the game, and Run to start the game. You can move Mario with the arrow keys and fire paintballs with the 'a' key.

Okay, so I know what you're thinking. Sure, it's fun, but it's not all that challenging, and it doesn't feel like a game.

But that's okay, because one of the best ways to learn how to use StarLogo is to build on top of exisiting models and experiment with your own modifications. How could you modify Paintball to make it more fun, more game-like? Below, I've provided a few ideas to get you started, but if anyone has more ideas to share, please post a comment below.

Goals
A goal in a game gives a player something to work towards and often includes some measure of the player's success. You can use the score blocks to keep track how many turtles the player hits, or you could use the clock blocks to give the player a limited amount of time to hit as many turtles as possible.

Challenges
No matter how you choose to keep score, the game is still very easy. The turtles are like sitting ducks waiting for a paintball to turn them pink or blue, and nothing stands in Mario's way. So give the turtles some procedures to make them smarter. Have them run around Spaceland, maybe randomly, to create moving targets for Mario. Give Mario a limited number of paintballs so the player is forced to aim more carefully to improve his or her score.

And if you want to get really complex, give Mario a limited number of "lives" and let the Turtles fire paintballs back. How do you make your non-player characters artificially intelligent enough to provide a challenge to the player without making the game totally impossible?

Immersion
One of the ways to keep players engrossed in your game is make the environment more appealing. Depending on the game, you might strive to make it more realistic or more fantastic. You can create more visually appealing scenery using the terrain editor, or you can use stamp, dig, build, stomp, and yank to allow the agents to modify the terrain during the game. For example, if an orange paintball travels fifty patches without hitting a turtle, then it falls to the ground and splatters orange paint on the terrain. You can create mountains, valleys, walls, and even entire mazes to make it harder for Mario to find and fire at turtles.

Another technique for creating an immersive experience is by giving the player more control over the avatar. Modify the Move procedure to detect more keystrokes. Maybe give Mario the ability to jump over obstacles and turtles, or allow him to fly around Spaceland using the up and down blocks. There are so many possibilities!


Finally, if you would like to share your enhanced version of Paintball with us, feel free to attach your project in an e-mail to starlogo-request@education.mit.edu. Happy paintballing!

Labels: