[PLUGIN] noisejs

  • Wow cool plugin. Thanks for making an alternative. I still prefer to use shaders though.

  • Hi PixelRebirth Sorry for asking this after so much time but, I've saw your example about how to use it in a platform game like terraria and I didn't understand (I'm new to this concept)

    noisejs.simplex2(loopindex("x"), loopindex("y")) < 0.25

    While 0.25? What does this expression means?That this noise value will take place in that specific x and y coordinates?

    while temp = -1?

    etc

    Basically i didn't understand any of the values you put, what impact it does at the map generation and the conditions to destroy the blocks.

    Thanks!

  • Hi PixelRebirth Sorry for asking this after so much time but, I've saw your example about how to use it in a platform game like terraria and I didn't understand (I'm new to this concept)

    noisejs.simplex2(loopindex("x"), loopindex("y")) < 0.25

    While 0.25? What does this expression means?That this noise value will take place in that specific x and y coordinates?

    while temp = -1?

    etc

    Basically i didn't understand any of the values you put, what impact it does at the map generation and the conditions to destroy the blocks.

    Thanks!

    Well, i don't think he wants non-math geniuses to use this. He also did some things like 50+50 rather than just typing 100. Seems like he is trying to trip up non-math people.

    This is a really common thing people do on StackOverflow.com to make so people dont just copy and paste code.

    You can do the same thing to any expression, Eg: X=100-100+50-50+90-90. You can do this rather than say just say X=0.

    PixelRebirth Great plugin!

    added 3 blocks and a water effect:

    http://voxi3d.comule.com/simlexgenerate/

    Just hit space to re-generate.

    That was just 10 minutes of work, I cant wait until I have an entire afternoon to make a full fledged generator.

    Excellent plugin! Very fast!

  • > Hi PixelRebirth Sorry for asking this after so much time but, I've saw your example about how to use it in a platform game like terraria and I didn't understand (I'm new to this concept)

    >

    > noisejs.simplex2(loopindex("x"), loopindex("y")) < 0.25

    > While 0.25? What does this expression means?That this noise value will take place in that specific x and y coordinates?

    >

    > while temp = -1?

    >

    > etc

    >

    > Basically i didn't understand any of the values you put, what impact it does at the map generation and the conditions to destroy the blocks.

    >

    > Thanks!

    >

    Well, i don't think he wants non-math geniuses to use this. He also did some things like 50+50 rather than just typing 100. Seems like he is trying to trip up non-math people.

    This is a really common thing people do on StackOverflow.com to make so people dont just copy and paste code.

    You can do the same thing to any expression, Eg: X=100-100+50-50+90-90. You can do this rather than say just say X=0.

    If you look at the original example, you can see that the second number of 50 is being multiplied with a noise expression. So simply putting 100 there doesn't do the same at all. I did it to get the complete range of 0-100% opacity, since the plugin returns values from -1 to 1.

    Certainly not trying to trip anyone up, I'm not "math people" either. <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy">

    kossglobal I probably should have put more comments in the second example. It was really just a quick and dirty one. I simply decided on a range that won't be drawing any tiles. That's the < -0.25 part. It's all pretty abitrary, therefore feel free to play around with the values to see how it affects things.

    PixelRebirth Great plugin!

    added 3 blocks and a water effect:

    http://voxi3d.comule.com/simlexgenerate/

    Just hit space to re-generate.

    That was just 10 minutes of work, I cant wait until I have an entire afternoon to make a full fledged generator.

    Excellent plugin! Very fast!

    Thanks and nice work! This noise stuff sure is fun to play around with. The real credit belongs to the creators of the library though! <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

  • Nice plugin!

    Here is a demo of using this plugin to generate a "random" curve, each point is created by a sprite. This curve might be used in platformer game.

  • PixelRebirth

    It might have a bug while using multiple noisejs objects.

    Here is a test case. There are 2 noisejs objects, the seed of each noisejs object are different. But the generating results looks the same.

    It seems that there is only 1 seed object in this plugin, so that all noisejs will use the same seed.

  • PixelRebirth

    It might have a bug while using multiple noisejs objects.

    Here is a test case. There are 2 noisejs objects, the seed of each noisejs object are different. But the generating results looks the same.

    It seems that there is only 1 seed object in this plugin, so that all noisejs will use the same seed.

    Oh, thanks for catching that. Haven't looked in here for a while. Very cool example you posted earlier by the way!

    The problem seems to be with how dependencies work, which I didn't really consider.

    I think even I can fix it quite easily by handling the runtime a tiny bit differently. Expect a small update very soon!

  • I had made another behavior of simplex noise. It looks like an irregular sine wave.

  • Hello,

    Love this plugin. Still trying to figure out exactly how to implement it, however, there may be a bug (or just that I do not know how to use it). I tried creating two different random perlin seeds, but they both ended up showing the exact same pattern in the exact same place even though I called randomize seed for both perlin noise.

    Second question:

    I am trying to figure out how to use the "z" portion of simplex3. Currently i have implemented a "for X from 0 to MapX/32" and "for y from 0 to MapY/32" (32 being the size of my tiles I need to spawn). I wanted to try and use the "z" to create various groups...looping through x,y and z on each chunk can be very slow and freezes the screen when spawning objects on the fly so I am not really sure if this is the best way to implement this perlin noise plugin. Ultimately I have 5 different types of resources I want to spawn on a map based on perlin noise. The map is infinite, whenever a person gets close to the border it generates a new section (which usually freezes the screen for half a second). I need these clusters of resources to be side by side without much or any scattering.

    I have managed to do this for 1 set of resources, however, creating multiple groups has been a challenge without having any kind of overlap and at a sparse enough distance where the game will be fun.

    Hopefully this makes sense. If anyone has any input of how my generation method could be improved or how I could correctly accomplish the above I would appreciate it.

    I have also done a lot of reading on perlin noise, must of which goes over top of my head...

    Cheers!

  • Maydie

    I had fixed bug1 in this plugin.

    About second question, yes, it will hold the c2 engine if calculate a lot of noise values. One possible solution is - create them in ticks. You might try my eventbalancer.

    The other solution is creating another plugin which generate noise values by webworker.

  • Thanks for the quick reply! Quite a few great plugs and behaviors, thanks for pointing me at this. I am going to have to modify my code with the new noise plugin before I can ask anymore questions. I will take a look at your eventbalancer as well. Appreciate it.

    Cheers!

  • rexrainbow

    Ok so I tweaked the code to use the new plugin. Works great.

    My only problem now is that I seem to have limited control over the shape of each group of nodes.

    Is there another plugin I could use to create a pattern of nodes at x,y location with a max width and max height from the original location? My plan is to use the perlin noise plugin to determine a node location, but then use something else to create a random filled pattern (i.e. no space between sprites which are 32 x 32 px). Currently the best I can get with the noise plugin is an oval of say +-30 spawned sprites in a 3200 x 3200 pixel area (or 100 x 100 grid) due to the scale I have to change the perlin noise to in order to get small groups of sprites. It doesn't lend to an interesting shape and very difficult to control how far about each group of nodes spawn. I am hoping by using a combination of perlin and something else I can create something more interesting to look at (ultimately using three inputs 1. Number of nodes to spawn, 2. Max width from original x,y, 3. Max height from original x,y. I was thinking about using an array to loop through a grid of random width and random height perhaps using "0" for no fill "1" to spawn sprite. The problem I am having is how to ensure everything is filled in the middle.

    The end result would be something like (below). Maybe it is not possible to generate something natural looking on the fly without perlin as shown below. Let me know your thoughts. Much appreciated. I realize this may be asking too much, if I can be pointed in the right direction I will do my best to do most of the leg work.

    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

    0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0

    0 0 0 0 0 0 0 0 1 0 0 1 1 1 0 0 0 0 0 0 0 0

    0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0

    0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0

    0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0

    0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0

    0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0

    0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0

    0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0

    0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0

    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

    Update 1: I found someone talking about using a mask over perlin noise to create a border of "water" or in my case, nothing, around the edge of the perlin noise. Maybe this is the way to go to create patterns of sprites within a specific region.

  • Maydie

    Here is a demo of random (noise) tiles. source

    • arrow key left/right/up to move.

    It uses logic mask plugin to display tile sprites in a small area.

  • rexrainbow

    Thanks for the reply!

    This actually seems like a really good way to create the nodes I need without a ton of extra scripting and collision checks. I will check it out.

    Cheers!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • thanks so much, exactly what I needed to randomize my world map with seeds...

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)