# Snack Break Problem #23

## Last Challenge

The last snack break asked you to create an algorithm for solving Tic-Tac-Toe boards and puzzles. The advanced challenge was to create a perfect algorithm that could never lose a game of Tic-Tac-Toe.

# April Fools!

CodePal has been in closed development within the Scripting Helpers for a long time now, headed by our very own Game Jam winner, tkcmdr! We are happy to finally be able to unveil a testable version to the public.

## Install Now

CodePal has two ways to help program your game:

• Generate Mode - This advanced system uses machine learning algorithms to extract game information from images you give it, and it will generate all necessary scripts for the game.
• Passive Mode - CodePal will guide you while making your game, providing helpful hints and suggest better code snippets after it watches you code something quite terrible.

* Long development time evidenced by the use of the old Scripting Helpers logo

## Introducing the Scripting Helpers Hotline - 24/7 live chat and team create support for your place

Having trouble getting that one feature to work? Worry not. With our new live chat service, you can press our hotline button and be instantly connected with a certified development support agent, who will be able to guide you through the process. (Disclaimer: support agent may direct you to activate "generate" mode of CodePal and then disconnect the chat.)

# April Fools!

Posted in Uncategorized

# Terrain generation, what and how?

## What is terrain generation and how does it work?

The key to terrain generation is `math.noise`. The most important thing to note from the start, `math.noise` is not random. (From now on i'll reference `math.noise` as just "noise".)

## What is noise?

The function uses a Perlin noise algorithm to assign fixed values to coordinates. (Same input(s), same output.)

## How do we use it?

The noise function takes 3 arguments, but only one is required.

`math.noise (x [, y [, z]])` is how roblox describes it on their wiki, wich is what confuses most people. The correct way to get noise working for a terrain generator is `y = math.noise(x,z,seed)`.

## How can we use it to make terrain?

It's simple.

1. Set a seed (For this example, 42, as it is the answer to life, the universe and everything.)
2. Create a for loop for the X coordinate.
3. Create a for loop for the Z coordinate.
4. Create parts
5. Call `local Y = math.noise(X,Z,42)`
6. Set the part position to X,Y,Z.

And thats it!

Now hold up a seccond, this doesn't look smooth at all, thats just a flat base! - That is correct.

The reason why it looks like a flat base, is because all of the values are integers. If all values are integers, math noise will return 1. If we devide the X and Z coordinates by 20, you'll notice it starts to get nice and smooth like your roblox smooth terrain looks like, but the parts are still very close to eachother, we can make the terrain have a bit more depth by multiplying the Y value, lets say by 5. (`local Y = math.noise(X/20,Z/20,42) * 5`)

## Into the scripts

How would a script look like to run this? result

```local Seed = 42 -- The answer to life, the universe and everything.

for X = 0,50 do -- X Loop

for Z = 0,50 do -- Z Loop

-- Make the part
local p = Instance.new("Part",workspace)
p.Anchored = true
p.Size = Vector3.new(1,1,1)

--Just for style
p.TopSurface = "Smooth"
p.Material = Enum.Material.Grass
p.BrickColor = BrickColor.Green()

--The noise
local Y = math.noise(X/20,Z/20,Seed) * 5

--Set the position
p.CFrame = CFrame.new(X,Y,Z)
end
--Wait a bit so your toaster doesn't freeze.
wait()
end
--Tfw you write all of this and it works in one try.
```

Well, that's about all there is to it. Experiment around with it and comment what you've made with this.

Posted in Scripting Tips

# Introduction to Model-View-Controller

Hey there,

There's no contesting that ROBLOX programmers often fail to implement program architectures that make their games easily scalable and maintainable. Frequently our first compulsion when scripting is to slap a script into whatever we intend to program. Doing this seems convenient at first, but it has a few inherent disadvantages:

• The script lives in the workspace and is therefore vulnerable to accidental deletion.
• It can be difficult to find as the game grows.
• You will often end up with lots of copies, each of which you will have to update when you want to make even a single-line change.

The longer a project goes on, the more these sloppy practices tend to bite you in the butt. Youâ€™ve got hundreds, potentially thousands, of lines of duplicate code that are neither interconnected nor easily serviceable. Preferably, your code should be more like a framework than a hodge-podge of batch scripts if you plan to make that murder clone you have in mind.

### Allow me to introduce you to something called MVC.

MVC, or Model-View-Controller, was developed during the 1970s as a modular way to write graphical user interface software. It has three components that do distinct jobs; they are as follows:

• Model: The code that defines the behavior and data of an object

• View: The code that defines the user interface

• Controller: The code that communicates actions to the model when something happens in the view, and vice versa

In the case of ROBLOX, you don't have to write the code for the GUI, because it's already been made for you: it's known as the workspace. It may seem a bit strange, then, to use MVC for making games, but bear with me.

Since the View has already been done for you, you are left to write Model and Controller.

Posted in Scripting Tips

# Snack Break Problem #22

## Last Challenge

Last challenge was to re-create the game "SUPERHOT", and we had a total of 4 people submit their creations, in order of the first to submit to the last:

I had an extreme amount of trouble trying to decide who should win, therefor, everybody is a winner! All 4 winners shall get the snack break tag for a week. Good luck on the next snack break!

~ shayner32

# Snack Break Problem #21

There hasn't been a snack break in a little bit, so let's get it going with an "intermediate" task for those who would like to try! The challenge shall be to recreate the base (or more if you want extra points!) of the game SUPERHOT.

If you haven't heard of SUPERHOT, I will try to explain it as best I can, however it is advised for you to look up a video of it if you haven't heard of it before. In SUPERHOT, time only moves when you do. When standing still, and not looking around, time will move extremely slow. However, as soon as you start moving, the world around you will also begin moving. The objective of SUPERHOT is to use your ability to do things like line up shots, dodge bullets, and more.

## Rules

• You can create purely the slowing down dynamic, you don't need to create enemies/weapons if you do not want to. However, you must be actually able to showcase the dynamic.

• When you submit your game, make sure it's uncopylocked!

## Submissions

The person who I deem completed the challenge the best will get the snack break badge until the next snack break (badge can be seen here). Everyone who completes the challenge will be mentioned on the next snack break post.

You can submit your game by messaging me on ROBLOX. Good luck!

# New ROBLOX Security Measures

Recently ROBLOX introduced an update to increase the protection of each ROBLOX game. This update includes the following security measures:

• All games that do not have Filtering Enabled toggled shall have an age requirement of 13 to join.

• Any place where text may be inputted in your game will now be required to have Text Filtering applied to it. Any game that does not have this feature will be put under review until it is added, however, it will not be content deleted, and no moderation action will be taken against the place owner's account.

## What does this mean for us as developers?

As many of you know, a large portion of ROBLOX's community is under 13. In order to ensure your game is accessible by the entire community, you will have to make it within compliance of these two updates. While doing so, you may find these two articles helpful:

Posted in ROBLOX News

# Scripting Helpers Volunteer Application 2017

Scripting Helpers is looking to fill more volunteer positions in our team again this year.

We're looking for the following roles:

• Blog author
• Question moderator
• Events coordinator
• Forum moderator
• Website developer

...or, if you feel you have something new to bring to Scripting Helpers, feel free to apply too! Any and all exceptional applications will be considered for any role.

A Discord account is required to apply and fill a staff position.