Disable Perimeter

Using Disable Perimeter
The Disable Perimeter is one of the lesser known features of Project Spark with a lot of power behind it. So I thought I would walk you through its role, how to implement it and how to refine it among objects.

WHAT IS DISABLE PERIMETER?
Consider this situation. You are making an epic game with 300 goblins strewn about your map, each with their own unique brain and traits. You've put hours of koding into their brains to make sure they are complex and smart. Then you test your level and the framerate can't even make it to 10 frames per second.

You probably already realized the problem. You have too much stuff running on your map at a time. If only there was a system to keep all of the brains from running at the same time. Oh wait, that's Disable Perimeter.

Picture Disable Perimeter as an invisible sphere around the player. You can set how large or small that sphere is. Any brains that live outside of this invisible sphere don't work. But as soon as a brain falls within the sphere's confines, it activates.

If the diameter of your world is 500 and you set your Disable Perimeter radius to 50, that means only 1/10th (I'm assuming equal distribution here) of your world's brains are running at a time. 1/10th of 300 goblins is only 30. Now Project Spark only has to worry about running the kode for 30 brains at a time.

You can see how going down from 300 brains to 30 would increase performance of your game.

HOW DO YOU IMPLEMENT DISABLE PERIMETER?
Go to the World Settings of your game and click on "Brain". You will then see an option to turn Disable Perimeter on/off and an option to set its radius. Here it is in the world menu.

http://puu.sh/7Dlrr.jpg (image of the World Settings)

Once you turn it on, like that Disable Perimeter is now activated in your game.

HOW DO YOU MAKE DISABLE PERIMETER OBJECT-SPECIFIC?
Note: All logic cubes as a default will NOT be affected by Disable Perimeter.

Say in your map you have a final giant goblin general to lord over his 299 minions. You want to make him as tall as a mountain and you want the player to be able to see him rumbling around in the distance. With the default Disable Perimeter, you're out of luck. He would be brainless, like all of his other minions outside the bubble.

Thankfully, Project Spark has a way to exclude your goblin general from the effects of Disable Perimeter.

Once Disable Perimeter is activated, if you go into any object's properties and then brain properties, you will see a new option Respect Disable Perimeter for that object. This is illustrated below. Turn it to OFF to have the object not affected by Disable Perimeter.

http://puu.sh/7DmIq.jpg

To my knowledge, the only item that default has "Disable Perimeter" turned off is the Logic Cube. This means that for any other objects you want to run outside of the radius of Disable Perimeter (e.g. paths, effects, characters), you will have to toggle it to off in properties.

And just like that, you probably bumped your framerate up at least a few points!