This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2013-03-29 16:04:53

Hyperbola
Scratcher
Registered: 2013-03-15
Posts: 100+

Terrain generator


Tip of the whatever: Don't post in threads older than 2 weeks unless your post will actually be useful.
It's the last day of 1.4! *cries* (quote from NeilWest, rest by me) by the time you read this it probably will be 2.0  sad

Offline

 

#2 2013-03-29 23:04:15

mikebmac
Scratcher
Registered: 2013-03-17
Posts: 46

Re: Terrain generator

This is very ingenious! I really like how this uses up almost no space in the end file size.


http://i42.tinypic.com/21lo482.jpg HD Crash will restart production after 2.0
Related: (Concept Game) (Heroine Bio) (Sample Scroller /w Heroine Animation)

Offline

 

#3 2013-03-30 19:25:50

Hyperbola
Scratcher
Registered: 2013-03-15
Posts: 100+

Re: Terrain generator

mikebmac wrote:

This is very ingenious! I really like how this uses up almost no space in the end file size.

Yep  big_smile  In theory, it could go on forever. I just didn't add it on this program.


Tip of the whatever: Don't post in threads older than 2 weeks unless your post will actually be useful.
It's the last day of 1.4! *cries* (quote from NeilWest, rest by me) by the time you read this it probably will be 2.0  sad

Offline

 

#4 2013-03-30 21:52:49

mikebmac
Scratcher
Registered: 2013-03-17
Posts: 46

Re: Terrain generator

I was looking over it, I noticed there is a way to change the colour based on the "X" position (of the sprite), but not the "Y" position. I haven't gone too into detail in the website you supplied, but is it even possible to change the colour based on both the "X" and "Y" position of the sprite? If it were we could have colour independence for each pixel in Scratch with a 1x1 sprite.


http://i42.tinypic.com/21lo482.jpg HD Crash will restart production after 2.0
Related: (Concept Game) (Heroine Bio) (Sample Scroller /w Heroine Animation)

Offline

 

#5 2013-03-30 22:13:58

Hyperbola
Scratcher
Registered: 2013-03-15
Posts: 100+

Re: Terrain generator

mikebmac wrote:

I was looking over it, I noticed there is a way to change the colour based on the "X" position (of the sprite), but not the "Y" position. I haven't gone too into detail in the website you supplied, but is it even possible to change the colour based on both the "X" and "Y" position of the sprite? If it were we could have colour independence for each pixel in Scratch with a 1x1 sprite.

Yes, there is a way to made a 2D perlin noise generator. I know some people like Darthpickley have done it, but I didn't do it on mine. The pseudocode given on the website is quite a bit more complicated for the 2D noise than the 1D noise I have here, and uses a lot more variables, so I didn't want to implement it here. Too many variables on Scratch = confusion  tongue


Tip of the whatever: Don't post in threads older than 2 weeks unless your post will actually be useful.
It's the last day of 1.4! *cries* (quote from NeilWest, rest by me) by the time you read this it probably will be 2.0  sad

Offline

 

#6 2013-03-30 22:27:45

mikebmac
Scratcher
Registered: 2013-03-17
Posts: 46

Re: Terrain generator

Interesting,

I would think you would need a mind map or some other way of organizing that much information (I know my brain can't handle that much information). If Scratch was not switching to vector graphics I may have indulged in this a bit more.

I dumbed your project down to create a more bitmap version, maybe someone will find this type of thing practical.
http://scratch.mit.edu/projects/mikebmac/3222286


http://i42.tinypic.com/21lo482.jpg HD Crash will restart production after 2.0
Related: (Concept Game) (Heroine Bio) (Sample Scroller /w Heroine Animation)

Offline

 

#7 2013-03-31 10:36:43

Hyperbola
Scratcher
Registered: 2013-03-15
Posts: 100+

Re: Terrain generator

mikebmac wrote:

Interesting,

I would think you would need a mind map or some other way of organizing that much information (I know my brain can't handle that much information). If Scratch was not switching to vector graphics I may have indulged in this a bit more.

I dumbed your project down to create a more bitmap version, maybe someone will find this type of thing practical.
http://scratch.mit.edu/projects/mikebmac/3222286

But at that point, it's no longer a perlin noise generator  tongue

By the way, there is a shorter way to do the same thing:

when [space v] key pressed
set y to (170)
repeat (18)
 set x to (-230)
 repeat (24)
  switch to costume (pick random (1) to (3))
  stamp
  change x by (20)
 end
 change y by (-20)
end
Make sure the sprite is showing of course.


Tip of the whatever: Don't post in threads older than 2 weeks unless your post will actually be useful.
It's the last day of 1.4! *cries* (quote from NeilWest, rest by me) by the time you read this it probably will be 2.0  sad

Offline

 

#8 2013-03-31 11:48:08

mikebmac
Scratcher
Registered: 2013-03-17
Posts: 46

Re: Terrain generator

Yes,

You are right about the population setup, which is far more effective the way you put it. The variables are in there for future detection of the "Y" and "X" and changing the custom.

Yes, sadly it is not nearly as complex as a noise generator. I am still very confused as how they (or we) could control the pixels to create functional backgrounds though. Looking at the site they seemed to accomplish that.


http://i42.tinypic.com/21lo482.jpg HD Crash will restart production after 2.0
Related: (Concept Game) (Heroine Bio) (Sample Scroller /w Heroine Animation)

Offline

 

#9 2013-03-31 12:30:52

Hyperbola
Scratcher
Registered: 2013-03-15
Posts: 100+

Re: Terrain generator

mikebmac wrote:

Yes,

You are right about the population setup, which is far more effective the way you put it. The variables are in there for future detection of the "Y" and "X" and changing the custom.

Yes, sadly it is not nearly as complex as a noise generator. I am still very confused as how they (or we) could control the pixels to create functional backgrounds though. Looking at the site they seemed to accomplish that.

Well, the first step is to make a random number generator that outputs a different pseudorandom number for each number given. An easy (but not perfect) way is this:
X = input^3*[big number]+input*[big number]+[big number]
then X = ((X mod 65536)-32768)/32768.
Where each [big number] is around 1000000. Then for every input, the generator returns a random output between -1 and 1, but doesn't change when you use the same input.


Tip of the whatever: Don't post in threads older than 2 weeks unless your post will actually be useful.
It's the last day of 1.4! *cries* (quote from NeilWest, rest by me) by the time you read this it probably will be 2.0  sad

Offline

 

#10 2013-03-31 13:11:45

mikebmac
Scratcher
Registered: 2013-03-17
Posts: 46

Re: Terrain generator

Ah thanks, for some reason that clears it up a bit. I am going to have to look at this some more. Before I saw something stupid and facepalm it later, lol.


http://i42.tinypic.com/21lo482.jpg HD Crash will restart production after 2.0
Related: (Concept Game) (Heroine Bio) (Sample Scroller /w Heroine Animation)

Offline

 

#11 2013-04-01 17:40:56

Hyperbola
Scratcher
Registered: 2013-03-15
Posts: 100+

Re: Terrain generator

Bumр!


Tip of the whatever: Don't post in threads older than 2 weeks unless your post will actually be useful.
It's the last day of 1.4! *cries* (quote from NeilWest, rest by me) by the time you read this it probably will be 2.0  sad

Offline

 

#12 2013-04-01 22:30:31

ChadtheBuilder
Scratcher
Registered: 2013-02-27
Posts: 100+

Re: Terrain generator

This is really cool. Maybe this could be implemented into a platformer terrain where the levels are generated based on seeds.


http://dl.dropbox.com/u/107729333/1360160765356.jpg

Offline

 

#13 2013-04-02 08:13:09

kidomat43
Scratcher
Registered: 2009-08-17
Posts: 11

Re: Terrain generator

I am trying to get this implemented in to my project: http://scratch.mit.edu/projects/kidomat43/3223093 but it takes a lot to do it.

I want to be able to do
Where a is the x position in the map.

set NOISE_INPUT to (a)
broadcast [noise_gen v]
set MAPG_HEIGHT to (NOISE_OUTPUT)

Last edited by kidomat43 (2013-04-02 08:14:26)


KIDOMAT43 / Rubenwardy
My Website: www.multa.bugs3.com

Offline

 

#14 2013-04-02 08:56:28

kidomat43
Scratcher
Registered: 2009-08-17
Posts: 11

Re: Terrain generator

I have got it implemented, but it produces unrealistic maps, and is very slow.


KIDOMAT43 / Rubenwardy
My Website: www.multa.bugs3.com

Offline

 

Board footer