Icon

IslandGen2D

TearOfTheStar

You must be logged in to obtain assets

Description

Value Noise based procedural 2D island (and terrain) generator. Bitmask based autotiling example was added in v2 (see the changelog).

This modular script can generate islands, island shapes and terrain using Value Noise algorithm based on room, grid and tile size. Many variables to change the final output. Code is plentifully commented, to explain basic workings, and can be used to learn about noise generation in general.

Default output is built around drawing colored rectangles, but there is commented block of exemplary sprite usage (first screenshot). Technically final output can be used for sprites or instance placement with ease, so no limits there.

Basic knowledge of noises and math is still recommended for ease of understanding on how to change it to your needs. But generator itself can be used as it is and as a learning material.

Main generation is easily controllable from scr_gen_2dig(); in init script. Exemplar tiles and tilesets for autotiling are included. Templates for making your own tilesets for autotiling are included.

Tested in GMS 1.4.1657 and 1.99.466, with Windows and Windows YYC compilers. YYC compiler is much faster for obvious reasons.

Important notice: Value Noise is more random than Perlin Noise for example, so island shapes can sometimes be quite small with default settings. If you want more stable output for islands, you can change basic range of noise from (0, 1) to something like (0.3, 1).

Possible uses:

  • Learning how noise, interpolation, normalisation works.

  • Learning how to easily limit noise generation to island shape.

  • As a base building block for your game's world.

  • As a shape generator for use in your project.

  • As a smaller grid island generator for a full-scale world-building.

  • Code is split into main steps of generation, refining, autotiling and drawing, so you can easily change the output to your needs. Or even use parts of generator or autotiler in your projects.

End User Licence Agreement (EULA).

Age Rating: 4+

Version

GMS1 - Version 2.0.2. Published February 24, 2016

  • Made some variables local, to prevent script conflicts (scr_at_bm_2dig).

  • Added forgotten comment in draw script (scr_draw_2dig).

  • Reset default script values (scr_init_2dig).

Changes in v2.0:

  • Postfix "_2dig" added to every resource in extension, to prevent harm if loaded into your project.

  • Added bitmask based autotiling example, based on http://gamedevelopment.tutsplus.com/tutorials/how-to-use-tile-bitmasking-to-auto-tile-your-level-layouts--cms-25673 article.

  • My approach to bitmask autotiling is based on grid checks, not on collisions. And works for several terrain types. It's not fully protected from generation artefacts, but everything is commented and explained.

Loading, please wait

Package contents

Loading, please wait

What is the issue?

Loading, please wait