Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8435009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:48:52+00:00 2026-06-10T06:48:52+00:00

I’m trying to make a map generator for a 2d tilemap game (similar to

  • 0

I’m trying to make a map generator for a 2d tilemap game (similar to games like Civilization – I’d like the ability to create small islands, or large continents, etc). I found an article that does pretty much what I’d like, but it’s written in flash. Looks like there’s a convenient function to generate a bitmap from perlin noise:

class BitmapData
function perlinNoise(
    baseX:Number, 
    baseY:Number, 
    numOctaves:uint, 
    randomSeed:int, 
    stitch:Boolean, 
    fractalNoise:Boolean, 
    channelOptions:uint = 7, 
    grayScale:Boolean = false, 
    offsets:Array = null):

This is being used in the article (but I’m using java). So now I’m stuck at trying to implement perlin noise myself (basically finding a pure java implementation and copy/pasting it).

I’m just trying to understand the basic principle behind using perlin noise – my basic understanding:

  1. Define the size of map you want (in my case about 100 x 50 tiles).
  2. Initialize a perlin noise object (setting params like frequency etc – not quite sure how these params affect things like island size etc, but putting aside for the moment).
  3. Iterate over each tile in my map, and ask the perlin noise object for a value. The returned value can be interpreted as a height value I’m guessing.
  4. Now assign a tile type based on the height value.

The iteration code might look something like:

for (int x = 0; x < 100; x++) {
    for (int y = 0; y < 50; y++) {
        int height = perlin.getValue(x, y);
        if (height < 5); // this tile is water
        else if (height < 20); // this tile is shore
        else if (height < 40); // this tile is hill
        else // this tile is mountain
    }
}

Is that generally correct? That would at least be a starting point.

The article (written in flash) that does what I’m looking for:
http://www.nolithius.com/game-development/world-generation-breakdown

Flash BitmapData class which conveniently has a perlin noise function built in:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/BitmapData.html#perlinNoise()

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T06:48:53+00:00Added an answer on June 10, 2026 at 6:48 am

    Given appropriate initialization, your iteration code should work as far as I can see. That is: if you want to threshold 2D Perlin noise to water, shore, hill and mountain.

    This page has some useful explanation of Perlin noise and pseudocode examples. Essentially, the algorithm adds together noise functions with increasing frequency and decreasing amplitude.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I'm trying to create an if statement in PHP that prevents a single post
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small
I've got a string that has curly quotes in it. I'd like to replace

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.