1 of 82

Access StarLogo Nova at www.slnova.org

Copyright © 2023 MIT Scheller Teacher Education Program

2 of 82

3 of 82

THE WORLD

2

Learn more about how to setup your project, and how “The World” works as an agent.

4 of 82

2

If you want your project to always start the same when clicking setup, you will need to go back to initial settings, which might include deleting all agents, resetting terrain heights, or setting world glow to a certain value.

“The World” doesn’t represent a breed of elements, but it is an agent of its own. For this reason, the traits of the World work a little bit different, and the world isn’t affected by code in the “Everyone” page. Additionally, the World is the only agent that exists before setup, so it is used as a starting point to create other agents and elements.

5 of 82

VERSIONS & REMIXING

3

Experiment in your project without the fear of losing your work. Remixing help you copy your all your code into a new project, while saving the initial version

6 of 82

3

If you want to make multiple versions of your project, without losing previous versions, click the REMIX of your initial project

The new project that will load will automatically have the structure original name + “REMIX”, you can update the title and description.

You can also choose to “Save Version” instead, and look in Project History for your previous projects.

The Project History Page also gives you information about remixes

7 of 82

COLLABORATORS

4

Invite your friends to make a common StarLogo Nova project by using the collaborators feature.

8 of 82

4

Add your project to a public gallery by going to “My Projects” -> click on the project -> “Galleries” -> update.

A pop-up page will appear where you can introduce their username.

Your collaborators will see your project on the “Shared with me” page.

Now you can take turns editing and working on your common project!

In your project, if you want other people to make direct changes, you can add them as collaborators.

9 of 82

AGENT TRAITS

Change the color, size, shape, location and direction of your agent. You can change any of these traits during your game, such as having a character grow in size or change color.

5

10 of 82

You choose from the default agent traits by using the pulldown menu in the SET MY block.

5

Once you choose a trait, you can either type in the TO area or drag in a trait value block, such as BUILT IN SHAPE, blocks from the math drawer such as RANDOM.

World built-in traits work a little bit differently: you can use a “Set my _” block for the World page only for custom traits (more on that in the Custom Traits skills card). For the World-specific built-in traits, there are special blocks to modify them.

11 of 82

COLORS

6

Learn more about how to color your agents or the terrain itself.

12 of 82

Set the color by picking from a list of standard colors, choosing

a random color, or selecting a specific color using an RGB code.

RGB allows you to add values of red, green and blue (the primary colors of light) together to produce any color. Refer to an RGB chart for specific colors.

You can also add “more color” to agents using a “+” block. But, because all values of the amount of red, green, blue have to be between 0 and 255, if you want to add more blue, for example, and the value goes over 255, it will add +1 to the green amount (similar to column addition). Be careful when adding colors so your project works as expected!�

6

13 of 82

BREEDS

Create a new breed when you need a new category of agents which can follow different rules than the other breeds.

7

14 of 82

Now you can create agents of that breed and there’s also a new page in the workspace with that breed’s name where you can program all of its behaviors.

7

Click Add Breed > down arrow to the right of “Breed” > Rename Breed

15 of 82

KEYBOARD CONTROLS

shift

Use keyboard controls to move an agent around the 3D world and to control other aspects of your game, such as picking up objects, managing inventory, opening doors, etc.

8

16 of 82

You can assign any keys on the keyboard to enable basic movement for an agent. Use the KEY HELD block for smooth movement, while KEY TYPED forces a player to keep clicking.

You can also use a modifier key, such as SHIFT or CONTROL with another key by using the AND block. This would be a good way to enable a player to both walk and run.

8

17 of 82

TYPEBLOCKING &

KEYBOARD SHORTCUTS

9

Learn how to make your StarLogo Nova experience easier by using more of your keyboard

18 of 82

9

Other useful keyboard shortcuts:

  • Press delete when holding a block to erase it

When editing Terrain with mouse/touchpad:

  • Esc to escape the current selection
  • Ctrl - R resetting the height level of a selection
  • Holding G shows the outline of the ground
  • If you’ve selected out of bounds grids as well, press T to reduce selection to only in-bounds cells.

Instead of selecting from the menu, you can start typing the keyword of a block anywhere on the workspace, then choose from the proposed options, we call this typeblocking.

19 of 82

CAMERA VIEW

Change the camera perspective from 2D to 3D, or make it follow one of the agents to look like a more traditional 3D action or adventure game.

top view

10

20 of 82

Click “Reset Camera” to be able to change it from mouse/touchpad again.

10

For more precise camera control create a new breed called camera, put the TAKE CAMERA block on it and use keyboard controls to change the view in your game.

By default the camera starts from directly above the terrain. You can change the view by clicking on “Edit Camera”. With the mouse of touchpad you can: zoom in/out (pinch or scroll), moving (left click + drag), change perspective (right click + drag).

If you want your camera to follow an agent, place the TAKE CAMERA block inside the CREATE/DO block of the agent you want to follow at the beginning of the game. If you create more than one agent the camera will follow the last one created.

21 of 82

HEADING

Heading controls the direction the agent faces. You can also use the heading trait to establish north/south/east/west in your game world.

180°

90°

270°

315°

135°

45°

225°

11

22 of 82

Setting the heading during setup gives you control over which

direction to face when you create new breeds. If you create 1 agent, the agent automatically faces 0°. For 2 agents, they face 180 and 0°. For 3 agents: 120°, 240°, and 0°. See the pattern? Here is the code used to generate the image on the front of this card (see DRAW ON TERRAIN card for explanation).

Changing the heading during your game is more precise than using the RIGHT and LEFT movement blocks. Headings also give a way to compare the direction of two or more agents.

11

23 of 82

TELEPORT

Teleporting means that you want the agent to instantly move somewhere else. This is a handy way to skip across your game world or even move to a new level.

12

24 of 82

The simplest solution is to program a KEY TYPED block with SCATTER to transport you to a random random location.

Or shrink/expand the agent for a more slick effect.

To simulate a portal, you could have a COLLISION teleport you to a specific place by setting the X and Y traits. (X and Y can both range from -50 to +50. In the center X=0 and Y=0, which is where all agents are initially created during SETUP).

12

25 of 82

WAITING

Program your agents to wait in between moves. Use yield to simulate an epidemic, tracking uninfected, infected and

recovered people.

13

26 of 82

Because yield essentially pauses the execution of the blocks after

it, for one tick, you can use it repeatedly when you want agent to be waiting for something.

13

You can also use a while block, if the waiting process is conditional to another event happening in the project.

In an epidemic simulation, the agent waits a random time (in a certain range), until it recovers, turning to color blue. Using yield allows the agent to be infected for a time, instead of recovering right away.

27 of 82

DOING THINGS SIMULTANEOUSLY

14

Change your Catching Flies project to include fireflies. You can program them to both fly and change color at the same time

28 of 82

14

In some projects you might want your agent to do two or more things at the same time, without having to wait for an action to end before starting the next one.

For example you might want the flies to glow for a while, then stop glowing, repeating this action while continuously flying.

Do this by adding another “while _ toggled” block, in addition to the blocks where

flying is performed.

29 of 82

JUMP

Program your agents with the ability to jump. Control how high they go and how many times they jump.

15

30 of 82

When the spacebar is pressed the agent jumps into the air and then comes back down. The yield block separates the actions by slowing down the movements.

To make faster jumps, remove one or more yield block or increase the number of steps.

Alternatively, if you want to make jumping more realistic, see GRAVITY.

15

31 of 82

FLYING

Program your agents with the ability to fly above the terrain or even into outer space.

16

32 of 82

For easy flying just program one key to move up and another to move down.

Or you could simulate “flapping” which just requires tapping 1 key, such as the space bar, to keep flapping your wings, otherwise you will continue to fall.

16

33 of 82

KEEPING SCORE

You can use the default score box to award player progress in your game. You may also use widgets to display an additional score for an enemy or multiplayer.

17

34 of 82

While the way you update a score is always the same (using a SET DATABOX block), there are several ways to determine how score is kept in your game.

You may have the score increase when colliding with some form of treasure...

...or have the score increase continually as long as the player survives...

You can even create additional databoxes to keep track of an enemy or teammate’s score.

17

35 of 82

TEXT MESSAGES

Sometimes it’s helpful to give the player a message in text – such as if you win or lose, directions on how to reset the game, or to enable character dialogue.

18

36 of 82

Click EDIT WIDGETS then NEW WIDGET,

type a name such as “Message” and select the “Label” option.

Once you click ADD WIDGET It should appear among the other widgets--while in Edit Widget mode you can move your widgets by clicking and dragging. For dialogue, you may want to run SETUP first so you can position the text near your character. Once it’s in the right place click EDIT WIDGETS again.

A collision is often used to trigger a message.

18

You might want to hide your first message until later in the game.

37 of 82

BUTTONS

A push button is only activated once, such as the Setup button. Toggle buttons can be turned on or off, like a light switch and are used to keep something repeating, like the default PLAY button.

19

38 of 82

The WHEN PUSHED

block tells to the agent to run the blocks inside of it when the given button (in this case setup) is pushed.

The blocks inside WHILE TOGGLED will keep running in a loop as long as the given toggle button is still on.

Click Edit Interface then click on a button to rename or drag it to change its position. Click Create Widget to create a new Push or Toggle button.

19

39 of 82

LINE GRAPHS

Track how values in your project change by using Line Graphs.

Use count to record the number of uninfected, infected and recovered people in an epidemic simulation.

20

40 of 82

Create a new graph by clicking “Edit Interface” > “Create Widget” > Line Graph.

Click on the Line Graph widget to edit it. For tracking multiple things, add more Series.

In this example, we made 3 series: uninfected, infected, and recovered. Use code like the example below on The World page to make the graph update as the simulation runs.

20

41 of 82

CHANGING GLOW DYNAMICALLY

21

Use Sliders to control values in formulas, graphs or set agent traits.

42 of 82

21

Slider values can be used to change some of your project settings, while it’s still running.�Make a new slider by clicking Edit Interface, then choose from the Create Widget options.

Click on the slider to change

name, min and max values.

For glow intensity, set min to 0 and max to 2. This value will be used to change the glow of the fishes.

Because the glow will always change, move the set glow block in a toggle instead of a click button, and use the slider value of glow intensity.

43 of 82

LEVELS/DIFFICULTY

Some games allow players to choose difficulty before they start. Others offer multiple levels to enhance game play. You can give players these choices by using custom buttons.

22

44 of 82

One way to vary difficulty is to create more enemies depending on which push button the player selects (see BUTTONS).

For levels, design a large gameworld and have your player start in a different location depending on their selection (see TELEPORT).

Or make your game harder by making the enemies faster (see CUSTOMTRAITS).

22

45 of 82

CUSTOM SHAPES

Program an agent to look like an object from a library of custom 3D models.

23

46 of 82

The shape of an agent can be set to either a built-in shape...

...or a 3D model from the online library. *

* If you are linking to a model from the online library, make sure to link to the file that ends in “.obj” [http://slnova.org/shapes/space/moon.obj]

You can change an agent’s shape and any time and can even create a simple animated object effect by creating a sequence of rapid shape changes.

23

47 of 82

CUSTOM TRAITS

You can create and use a custom traits for any breed. Custom traits are things like health, lives and energy that StarLogo Nova doesn’t include automatically but that you might use in your project.

24

48 of 82

You can give the World custom traits too, and access either through a “my [trait]” block on the world page, or by the agent, using the “world trait:” block.

Go to the Breed you want to add a trait to, click Show Traits,

then Add Custom Trait, with a name and (optionally) an initial value.

24

Use custom traits just like any other traits (size/heading/etc.), increasing or decreasing over time. If you want a trait such as Health to be displayed in a message box see KEEPING SCORE.

49 of 82

SOUND

Recording sound can be a bit tricky the first time, but it’s worth it for the added joy sound effects bring to game play. You will need both sound blocks to record and play. Click record, then scroll up to WebLand to find the record box.

The first time your record you may need to enable your microphone. Click the Allow button then ther may be a 2nd allow button you need to click at the top of the webpage.

Say (or sing) something short, type in the name, then click to save the recording

25

50 of 82

Say (or sing) something

short, type a name, then click SAVE. Once you have finished recorded the sound, you may drag the start and end sliders to trim the sound.

Now you can select the new sound under the dropdown menu of the sound block. Place the 2 sound blocks wherever you wish to trigger your sound.

You also have the option of importing sounds. You will find the IMPORT SOUND button near the top right of your web page. You can only import sound from your own projects.

25

51 of 82

COLLISION

Being able to detect when objects collide is essential for most games. You can use collision to simulate eating, to trigger a trap or to collect objects in your game.

26

52 of 82

Use the collision block to detect when one agent has collided with another agent. You will generally want to change the score (here adding a point) and delete the “collidee,” which is the thing you collided with. See FOLLOW/AVOID to find out about detecting nearby agents.

26

53 of 82

FOLLOW/AVOID

You will often want to make one agent follow/avoid another agent. We refer to this as AI or artificial intelligence. As your programming skills increase, so will the AI of your agents!

27

54 of 82

To have one agent follow another, face toward the agent, then move forward. Use the NEAREST block to find the agent you want.

To avoid, face toward the agent, turn around 180 degrees, then move forward. You may need to adjust the number of steps in NEAREST for best results.

27

55 of 82

CHANCE/RANDOMNESS

A good game should surprise the player. You can set a random chance of something happening, like making obstacles appear 10% of the time or springing a trap just 1% - any chance you’d like.

28

56 of 82

One way to implement chance is to generate a random number between 1 and 100 and use that value to represent percentage. This code will only create a Turtle 5% of the time because approximately 95% of the time the random number between 1 and 100 will be greater than 5 so the CREATE block will not run.

While this code will create 10 enemies with approximately 10 percent being red and the rest white.

28

As you design your game or simulation, look for places where chance could make your game more fun to play. Chance makes players want to keep coming back, because each time they play the game is a little different.

57 of 82

GRAVITY

Enable real gravity for all of the agents in your game by making them fall faster and faster over time for everything from falling debris to snowfall.

29

58 of 82

Since you want gravity to affect all agents the same way,

putting your code on the Everyone page saves you the trouble of creating code for each breed. Add a breed trait called “fall speed” (see CUSTOM TRAITS) and if an agent is above the ground (z > 0), add to the falling speed (otherwise set both z and falling speed to 0). Then make the agent drop according to its falling speed.

29

59 of 82

PROCEDURES

Use the large PROCEDURE block to combine your group of code blocks--be sure to name it, too. It does not matter which tab you put the procedure on. Then use a CALL block wherever you want to pull in the code.

30

Wouldn’t it be great if you could group several programming blocks together, label them, and reduce the clutter in your programming workspace? You can do all that, and more, by using PROCEDURES.

60 of 82

If you add parameters you can further customize how the procedure works. Here we create a parameter called size so you can choose which size circle to draw each place where you use the Draw Circle procedure.

30

61 of 82

CLOCK

Keep track of time to impose limits on your player, change aspects of the game over time, and more!

31

62 of 82

The clock advances by 1 tick every StarLogo loop.

Combining this with the “Remainder” block can cyclic behaviors.

You can create a world trait to simulate a daily cycle. Now you can base the behavior of any agent on what time it is!

Recall that the remainder of 0/5 is 0, remainder of 1/5 is 1, remainder of 2/5 is 2 and so

on. However, the remainder of 5/5 is 0, remainder of 6/5 is 1, and so on.

In the code to the right, the agent will move forward by 1 unit and turn left by 15 degrees only when the clock/5 has a remainder of 0.

31

63 of 82

LOGIC

Logic blocks can be both very confusing and very helpful in StarLogo Nova and coding in general.

32

64 of 82

The if block takes a

condition and runs the code inside only if that condition is true. The

if/else block has code that runs when the condition is not true.

The while block is similar, but the code inside keeps running in a loop as long as the condition is still true.

All of these blocks can be used to create conditions. You can even combine these three to add more!

Special symbols:

!= not equal

>= greater than or equal to

<= less than or equal to

Conditions don’t have to use numbers! You can check for colors, shapes, terrain, custom traits, etc!

32

65 of 82

COORDINATES

Anytime you want to move/draw in StarLogo Nova, keep Spaceland’s coordinate system in mind.

33

66 of 82

Spaceland has 3 axes.

As seen from the default camera view, the X axis is horizontal to the SpaceLand, and the Y axis is vertical. The Z axis measures how high an agent is off the surface of the terrain. An agent below the terrain has a negative Z value.

50 -

50

-50

Y

X

33

Y

Z

X

-50 -

67 of 82

DRAW ON TERRAIN

The pen feature allows you to draw shapes and patterns on the terrain, with varying line thickness and color. You can even

have several agents drawing at the same time to create

patterns.

34

68 of 82

Here we create 25 turtles and scatter them to draw a bunch of stars in random locations.

34

Any agent can draw on the terrain

with the PEN DOWN block. You can change the line color by changing the color of the agent and the line thickness by changing the agent’s size. Use PEN UP once the drawing is complete.

A few changes to your code can make a more complicated shape, such as a five-point star.

69 of 82

TERRAIN COLOR

You can apply a set color to a portion of the terrain (to represent water/fire/etc.) or change the entire terrain color by using the STAMP block.

35

70 of 82

You can use the TERRAIN COLOR block to check the color under an agent (handy for setting traps).

The STAMP GRID block will just create a 1x1 colored square at the center of the agent regardless of agent size.

You can apply a circle of color by choosing the appropriate agent size and using a STAMP and COLOR block. To change the entire terrain color create a giant turtle, stamp the color you want, then delete it. You will usually want to use the CLEAR TERRAIN block during setup to erase any previous colors applied with STAMP or PEN (see DRAW ON TERRAIN).

35

71 of 82

TERRAIN EDITING

36

Construct buildings, hills and all kinds of shapes on your terrain, using mouse/touchpad or blocks

72 of 82

36

Click on Edit Terrain to make changes

Then, select a portion of your terrain where you want to make changes. This portion will be highlighted by a purple color.

Choose from these terrain editing options to customize your SpaceLand

Another way to edit your terrain is by using blocks. This code makes agents edit the terrain, and produces a random configuration. You can change yank to stomp, dig or build for

different modifications.

73 of 82

GLOWING AGENTS

37

Create another version of Paintball with balls of light. Learn how to make your agents and SpaceLand glow/dim.

74 of 82

37

In order to see agents glow properly you’ll want to dim the spaceland by setting the world glow and directional light to 0.

Then, you can create agents with a certain glow intensity.

When shooting balls of light, set their intensity to 2 as well. Upon collision with a paintball, the turtle agent will be taking the color of the ball and either start or keep glowing.

75 of 82

LIGHTNING & SHADOWS

38

Use world glow and directional lighting to create lights and shadows on your agents.

76 of 82

Same ball with heading: 0, angle: 0 and light intensity 1, from two views:

<<< directly above

seen from a side >>>

You can change the heading and angle with values numbers 0 to 359 (inclusively). The light & shadow on the ball will move as if there’s a directional light according to the two images above.

38

If you want a more realistic model, you can choose for the directional light to cast shadows (however note that casting shadows requires a lot of computation power, so use them sparingly).

77 of 82

CUSTOM BLOCKS

39

Blocks made from a collection of existing commands are called Custom Blocks. Custom Blocks make coding easier, help with repetition, or commands that are similar in structure

78 of 82

39

Click on the (top block) selection of blocks you want included in a custom block. Right click, and choose Create Custom Block.

Welcome to your Custom Drawer! All the custom blocks created in this project can be found here.

The pop-up that will appear will allow you to edit what the block says, as well as what setting or parameters you want to be visible and therefore changed. You can make modifications by dragging numbered sockets from the left column to the right.

79 of 82

END OF GAME

Set your game to run for a certain amount of time, until a certain score is met, or if the player dies.

40

80 of 82

You can add game over messages (see TEXT MESSAGE) or extra lives

You could also stop the game if the clock reaches a certain value (see CLOCK), if you get a certain score, or if some other condition is met.

When the Player collides with a Hazard agent, the collision toggles the PLAY GAME widget off for everyone, which stops the game.

40

Use a toggle button to start your game.

(See CUSTOM BUTTONS for more).

81 of 82

82 of 82