–1 vote

So I followed the 'tutorial' for the open simplex module that used to be third-party but then included in GODOT 3.1. So, I downloaded and installed the Alpha for 3.1. I was trying to generate a matrix of simplex noise for my project. I followed the docs here on the docs site. Using the following code:

# Instantiate var noise = OpenSimplexNoise.new(); # Configure noise.seed = randi(); noise.octaves = 4; noise.period = 20.0; noise.persistence = 0.8;

From this, I get a "Parse error of unexpected token: Identifier:noise".

Then when I thought to put it into a function like:

func _ready():
    var noise = OpenSimplexNoise.new()

    # Configure
    noise.seed = randi()
    noise.octaves = 4
    noise.period = 20.0
    noise.persistence = 0.8

    # Sample
    print(noise.get_noise_2d(1.0, 1.0))
    print(noise.get_noise_3d(0.5, 3.0, 15.0))
    print(noise.get_noise_4d(0.5, 1.9, 4.7, 0.0))

And with this I am left with the error: Parser Error: Identifier 'OpenSimplexNoise' is not declared in the current scope.

I thought that if it was included in the core I could reference it like that without having to import/include anything. I am a bit confused on what's going on, am I missing something from the documentation?

Also, here is proof I am on Alpha 3.1. I did migrate this program from a previous build, but the project only includes some tiles and this program file.
Screenshot of the About page in GODOT

in Engine by (11 points)

What does the rest of your code look like?
Because that code works for me

1 Answer

0 votes

Have you tried

var noise = SimplexNoise.new()

It might be that you're using an older alpha version in which SimplexNoise wasn't yet renamed to OpenSimplexNoise.

by (1,378 points)

I downloaded the most recent alpha release from the website, but I tried it out anyway since you suggested and it is the same error. Just saying that SimplexNoise is the issue instead of OpenSimplexNoise.

I just downloaded Godot 3.1 alpha2 from here and it features OpenSimplexNoise (I'm on Windows).

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.