Scripting Helpers Blog

Fall 2017 Volunteers!

Introducing the new Staff Members

Hello everyone, I'm the new blog writer!

To start off my new job, let me introduce myself and the other new members of the Scripting Helpers team:

  • adark (FuriousProgrammer#0842) - Blog Writer
  • Andorks (Andorks#3802) - Community Moderator
  • ImageLabel (Meechie#9943) - Community Moderator
  • jackctaylor (jackctaylor#7478) - Community Moderator
  • TeaSPoon273 (TinyPanda#5252) - Discord Moderator
  • GoldenPhysics (GoldenPhysics#7829) - Administrator

Congrats, guys!

Posted in Site Updates

Scripting Helpers Fall 2017 Volunteer Applications

Scripting Helpers is looking to fill some positions in our team. We are looking for dedicated individuals who are willing to go the extra mile to improve the community experience for our users.

Some positions we are looking to fill are...

  • Discord Moderation
  • Blog Authors
  • Event Coordinator
  • Community Moderation
  • General Administration

Or, if you have something new to bring to Scripting Helpers, try to apply for that too! All applications will be reviewed and outstanding applications will be considered for the roles.

Discord and Scripting Helpers account required to apply. Persons under the age of thirteen will be deemed ineligible. Applications open for limited time.

Applications closed.

Posted in Site Updates

Snack Break Problem #24

Last Challenge

A few people attempted the last challenge but no one did it correctly. I might have not done the best with explaining the problem. So these are the results of this snack break, whose solutions were never showcased.

Solutions

BlackJPI - Solution

turtletowerz - Lost Solution

wfvj014 - Solution

kingdom5 - Solution

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.

Solutions:

OldPalHappy - Solution

Kingdom5 - Solution

Advanced Solutions:

Spongocardo - Solution

superalp1111 - Solution

Scripting Helpers CodePal - Everything you need to make a successful game in one plugin!

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.

CodePal
* 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

Ad