Asset - Scripts [Jen_scripts] Procedural Terrain Generation

[Jen_scripts v2.0]
Asset for Procedural Terrain Generation


[Jen_scripts] Asset for Procedural Terrain Generation Created by Cloaked Games
Jen_scripts is a GameMaker Studio 2 library designed for rapid prototyping and development of procedurally generated levels. It contains over 60 iterative functions that can be combined with flexible parameters to create varied terrain. Jen_scripts supports geometric shapes, randomized distributions, and other algorithms to produce a limitless variety of patterns within a 2D grid. The grid can then be interpreted as object indices or tilemap data to convert into terrain in your room.

Want to create a lake? Try jen_ellipse and jen_near. Want to create a river? Try jen_wander_direction or jen_wander_line. Want to create a cave? Try jen_automata. Want to create a maze? Try jen_maze_prim or jen_maze_backtrack. Want to create a building? Try jen_grid_room. Want to create an island? Try jen_heightmap_sampling. Something more complicated? Combine the functions together to form terrain that fits your ideal design, using optional arguments for extra flexibility.

  • Create lines, shapes, and blobs.
  • Create a wandering path between two points or in a direction.
  • Maze generation with Prim’s Algorithm or Backtrack Algorithm.
  • Cave generation with Cellular Automata.
  • Heightmap generation with Average Sampling or Gradient Scattering.
  • Copy sections of your rooms to incorporate hand-crafted content.
  • Tilemap support and programmatic autotiling.
Documentation: [Jen_scripts Documentation]
There is full documentation for every [Jen_scripts] function, including example code. You can read the documentation here.

Introduction to Using [Jen_scripts]: [Jen_scripts Tutorial]
Confused or just want to know more? This includes step by step instructions for basic tutorial, and some complete terrain examples you can use as additional resources.

Active Support: If you have questions, suggestions, bug reports or any other feedback, this is the place to do it! I will be continually answering any questions people have and improving the asset over time. If you have a question concerning your purchase or something you wish to discuss only with me, please feel free to send me a PM on this forum.

Terraria Style.jpg Dungeon with Treasure.jpg Islands in Ocean.jpg Cave with Ore.jpg River through Chasm.jpg
Last edited:
Very interesting. I notice that the 'resolution' and overall detail is rather low. Is there facility to increase this? For example, I'd like to approach something similar to a height map from Google Earth.
Unfortunately, not really. [Jen_scripts] is designed for small pieces of terrain, like a rouge-like level or a survival island map. You could connect multiple ones together. But while it can handle a fairly large room, generating very large pieces of terrain (especially with the heightmap functions), is probably not going to work for you. It doesn't run asynchronously.

In addition there aren't very many options for heightmaps yet. Those will be added eventually, but at the moment, you just have the one.
Last edited:
I have finished the first update for [Jen_scripts]. There were a few things that I had wanted to do before, but I didn't really know exactly how to implement them. Turns out it was really easy and only took a few hours, but here we go, version 1.1.0, with five new functions:
  • jen_number: allows you to create a specific number of instances at random positions.
  • jen_scatter_offset, jen_number_offset: allows you to create instances offset from the original location. (Good for platformers. You can do things like add torches to the floor of a cave like in Terraria).
  • jen_scatter_apply, jen_number_apply: the same as the above, but you can actually apply entire grids, like pre-built structures or randomly generated trees at positions within the terrain. This I've found to be pretty powerful for more advanced terrain, and actually simplifies a lot of the code I used in the demo by significant amounts.
Thanks to everyone who's bought the asset so far, I appreciate the support. I hope it has been working out for you.

If you haven't bought it yet, there's several resources available so you can learn more.
Finally, an example of the non-terrain use of [Jen_scripts], in the GMC Jam #8 just recently, I and @Pere submitted this game, The Hoard. I used [Jen_scripts] to generate the randomized army formations you fight. It only took me 10-15 minutes to do the actual code work because jen_apply and jen_grid_room_array made things so easy.
GML 2.3 is now released. By the end of this week, I will be updating [Jen_scripts] to use the new syntax, and fix the conversion errors. (Currently, the asset will not compile on 2.3).

Additionally, over the next few months, I will be releasing updates with new features. I have a few things in mind:
  • More heightmap options, including Perlin noise.
  • Templates, which are sort of like advanced grids, for creating levels with variations.
  • Layered function calls, which replace chance functions and provide more flexibility.
Please stay tuned! I hope to make this an even more powerful set of scripts very soon.
I recognize that this asset was published two years ago, but I think I did not really have the skills to update it properly until now.
Version 2.0 Release (20% OFF)
Jen_scripts v2.0 is now released and can be purchased on the marketplace page.
Additionally, it will be 20% for a short time to celebrate this new major version.

This update is primarily designed to update Jen_scripts to support GML 2.3, as the 2.2 version of Jen_scripts does not convert flawlessly to GML 2.3. This new version will also not work on earlier versions of GML. The old 2.2 code will remain available, but it will remain on v1.1 and will receive no further updates.

Some features have been updated or expanded upon. There are new features and some improvements to existing functions. The main improvements include:
  • Wandering line feature now has two more powerful functions to use.
  • Heightmaps have been improved, and a second heightmap option has been added.
  • Programmatic autotiling is now supported with jen_instantiate_autotiles.
  • Scale a grid to be larger or smaller using jen_grid_scale.
  • All data structures have getters and setters for more fine control.
  • All data structures have their own create and destroy functions--please use them!
  • Most functions have been rewritten and optimized to be more efficient.
  • Custom function parameters are reworked and are now much more powerful.
There are full update notes here: v2.0 Update Notes. Please check this document before updating, as some old code is no longer supported.
Also, the documentation has been fully updated, you can see the v2.0 Documentation here: Jen_scripts v2.0 Documentation.

Overall, this update includes many new powerful features, and the asset in total has over 60 different functions! I hope you find it useful.
There will be more updates over time--next, I will be working on noise functions, among other things.
Itchio Release (Now Available for FREE!)
Hey folks! Jen_scripts has got a new release over on itchio, and I have transitions support away from the Yoyogames Marketplace, at least for the time being. So you can now download Jen_scripts v2.0 as a Local Asset Package on itchio here: Additionally, it is now available for FREE/pay-what-you-want. If you are financially able to support my game development, the recommended donation is $10.00.

For the time being, there are no changes for this release. Future updates will still probably come, either when there is enough interest expressed, or when I end up developing new features for my own use. Thanks for your support, and I hope that this new platform (and price-point) will get Jen_scripts into the hands of more developers!



I have a problem understanding the maze generator functions.

I use the following code based on your documentation

maze = jen_maze_prim(3, 3);
terrain = jen_maze_build(maze, obj_wall, 1, 1, 1, 1, 1, 1);
jen_grid_instantiate_layer(terrain, 0, 0, "Instances");
The displayed maze has a width of 7x7. If I do jen_maze_prim(19, 5) the maze displayed has a dimension of 39x11. Am I misinterpreting something? Can I only generate room based mazes, as in your examples?

@Hamrath The width/height of the jen_maze refers to the number of rooms in the maze. The parameters in your build function determine the size of the walls/rooms, and thus the jen_grid output will be larger. If you want to generate just a maze and use it for something else, you can use jen_maze_get to get the connections of the maze for each room in the maze.