• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Route generator (Work In Progress)

20
Posts
15
Years
    • Seen Nov 18, 2023
    Hey everyone!

    After seeing the map generators Unbayleefable has made, I could not help but feel inspired to see if I could also make some sort of route generator. My programming skills are near to none but I know of this handy little program called Netlogo (I used version 6.1) which probably has the easiest coding language there is, so I gave it a try. The program currently outputs 3 text files, each corresponding to a different map mask, with a number corresponding to the sprite for each cell. I then have another program translate this into a map (in again probably the most inefficient way possible =p).

    One of the challenges I wanted to tackle was getting the map working with elevation, as well as having routes that are more than a straight line.
    Of course this is still a work in progress (and I am still pretty ashamed of my programming skills), so I do wish to wait with sharing the tool(s) (If you also count the visualisation aspect). What I do want to show is my current progress to see what others think of it:
    https://imgur.com/a/KYSQuWT

    And to show a bit of the variation, here is one with larger lakes and requiring surf to reach places:
    https://imgur.com/a/PMhse0L

    I have a distinct liking for the HG SS tileset so my tool works with those: I know most pokemon tools work with the ruby/sapphire tilesets. I also have the route currently running between a starting point at the bottom left and end at the top right (not entirely in the corners, which is why it does not exit the map).
     
    Last edited:
    83
    Posts
    3
    Years
  • Hey everyone!

    After seeing the map generators Unbayleefable has made, I could not help but feel inspired to see if I could also make some sort of route generator. My programming skills are near to none but I know of this handy little program called Netlogo (I used version 6.1) which probably has the easiest coding language there is, so I gave it a try. The program currently outputs 3 text files, each corresponding to a different map mask, with a number corresponding to the sprite for each cell. I then have another program translate this into a map (in again probably the most inefficient way possible =p).

    One of the challenges I wanted to tackle was getting the map working with elevation, as well as having routes that are more than a straight line.
    Of course this is still a work in progress (and I am still pretty ashamed of my programming skills), so I do wish to wait with sharing the tool(s) (If you also count the visualisation aspect). What I do want to show is my current progress to see what others think of it:
    https://imgur.com/a/KYSQuWT

    And to show a bit of the variation, here is one with larger lakes and requiring surf to reach places:
    https://imgur.com/a/PMhse0L

    I have a distinct liking for the HG SS tileset so my tool works with those: I know most pokemon tools work with the ruby/sapphire tilesets. I also have the route currently running between a starting point at the bottom left and end at the top right (not entirely in the corners, which is why it does not exit the map).

    This looks amazing. These maps gave me a Pokémon Open World vibe, which is great. The HGSS tiles were a great choice. I think most of people prefer the RSE - FRLG style (me included), cause is more easier the handle than the later DS tiles, but when compared to each other, the Gen IV - V tiles are certain more plesant to the eyes

    Honestly, anyone that could program something like this should be very proud, I know I certainly coudn't do it.

    Anyway, I'm looking foward to se more updates on your tool, or even more work that you have hidding under your sleeve
     
    139
    Posts
    8
    Years
  • Hey this looks great so far! I'm glad you felt inspired by my generator :)

    For someone with limited programing knowledge this looks pretty great tbh. Handling elevation can be tricky if you want the maps to be guaranteed to have all the areas accessible (as stairs generally can't be placed on "corners" of the ridges, etc). But if you plan on editing the maps by hand a bit after generation then it's no big deal since minor problems like that can be fixed manually if they do occur.

    Now I have to work on my tool more lmao. I've been slacking on it cause I got a little bogged down by more "technical" problems that are less enjoyable to work on, but maybe I should just power through it and get back to the fun part. 😅 If you ever want to share ideas just let me know! I have a lot of ideas just floating around that I haven't gotten to yet.
     
    20
    Posts
    15
    Years
    • Seen Nov 18, 2023
    Thank you all for the nice replies! Getting a compliment from the person who was my inspiration for making this in the first place makes it all the better!

    I learned that HGSS tiles are indeed quite a bit more difficult to use than the RSE – FRLG tileset, given how many masking tiles there are. The grass tiles also have 15 variants...
    But the end result (and the fact that the map auto generates) makes it all worth the extra effort. That being said, I would need to change some things to make this map work with RSE – FRLG tilesets if people really want that.

    The stairs problem I solved by making routes only go over edges that are not corners. The tool uses a turtle that tries to find a route from point a to point b while being only allowed to walk on certain tiles, while occasionally going in a random direction for a period of time (he walks quite derpy, but it is impressive to see how it always managed to navigate the maps so far ).

    I hope this gives you a bit inspiration as well Unbayleefable. There are still loads of ideas I have that I wish to include such as:
    - having steeper terrain
    - having the mountain terrain starting at a certain elevation.
    - include the option of having a beach and an ocean
    - Adding rivers
    - include HM obstacles like rocks (for rock smash), trees (for cut) and perhaps the tiles for rock climb
    - include more variety in the tilesets like different trees and snow tiles (not difficult, just laborious as unbayleefable can probably agree with =p)
    - include a chance of caves being generated (the turtle walks in one mountain and out of the other, requires steeper terrain though)
    - and perhaps in the loooong term: a way to have maps connect on the begin and end point of the paths that are made (to create a region)
    - find a way to make to tool actually easily usable. The Netlogo file, though a programming mess, is probably easy for people to play around with. The way of visualizing the maps is messy though: I used the statistics program R for this with package magick (Like I said, I am not a programmer =p). Any help with this would be appreciated.

    While all the above ideas seem doable, this has been a bit of a Holiday project: it all depends on how much time I have.
    The map currently counts as one route, and it outputs one in mere seconds. It is easy for me to change the dimensions (make it larger or smaller), but it lacks an easy interface to do this with. There are also a few things I hardcoded in just to see if it works (for instance now the starting and end point are fixed coordinates). It is easy to make this more randomized but other things have priority.

    Also, here's another generated route, this time without altitude and a few smaller lakes:
    https://imgur.com/a/BdF4FKQ
     
    Last edited:
    139
    Posts
    8
    Years
  • Yeah, my project actually started out as it's own engine - I even had most of the menus and the basics of the battle system and overworld interactions done. But it was getting to be too tedious reinventing the wheel, especially since I'm sure my implementation of a lot of aspects was far from ideal. So I just switched over to just generating the map data and exporting it to RMXP. In order to do that you have to be able to create the files RMXP uses (.rxdata), which are really just serialized Ruby objects that aren't really that easy to create manually. But, I found a 3rd party tool called "rvpacker" which can convert back and forth between .rxdata files and a format called YAML, which is much easier to produce. So my code produces the YAML files for the maps, and then I use rvpacker to convert them back into .rxdata files. There was a little bit of reverse-engineering involved to figure out what values I needed to use for specific tiles and for other things such as creating Events on the maps, but it works well overall, if a bit clunky.

    I don't know much about Netlogo or the other tools you're using, but I can further explain my own methods if you plan to go that direction. It really does become a time sink the more stuff you add, as every time you add something you have to ensure it doesn't break everything else you've added so far. That said, I have an "ideas" document of stuff I'd like to do that's like 4 pages long lol. I think the big thing at the moment is that I'm not super satisfied with how the routes actually look and are structured - sometimes they are acceptable, but there are a lot of quirks and oddities due to the algorithm that make plenty of "ugly" routes. Honestly your "turtle" method looks better in a lot of ways despite it's simplicity. I probably will try to create several different approaches and vary which method is used on each route, that way it reduces the "sameness" factor.

    Here's just a sample of stuff I want to eventually add or look into:

    -Add more options for the shape of the region instead of just an island (e.g. peninsula or land-locked)
    -Add more "biomes" and tile types. I recently added some snow tiles, but it's still pretty rough.
    -Update item placement to be less random and have what items can be placed determined by the area's level. Add invisible items.
    -Randomly generated names for the region itself, or for cities - possibly using a list of prefixes/suffixes (low priority)
    -Improve the borders between different biomes to be more gradual instead of an abrupt change along a straight line
    -Add more features to ocean routes, such as sandbars or ocean currents
    -Add side areas such as forests, caves, and abandoned areas
    -Add weather to the maps where appropriate (e.g. sandstorms or sunshine in deserts, rain in jungles, hail in snowy areas)
    -Rework or add new way of creating towns/cities. The current way looks really terrible for large city areas.
    -Add more variety of buildings to towns/cities, including more special buildings such as a Department Store
    -Add interiors to buildings, including some standard events such as Nurse Joy
    -Add obstacles to block progression until badges are earned or some other criteria, such as HM obstacles or NPCs
    -Fix a bunch of bugs and tile issues

    All these things are totally possible, but it's a lot of work and my motivation waxes and wanes, lol. Plus I get distracted by video games and drawing. But at least it's fun to work on!
     
    20
    Posts
    15
    Years
    • Seen Nov 18, 2023
    Yeah the steps required to get a map generator to work with RMXP seem quite extensive and time consuming. I am not that well known with RMXP, but from what I can see making maps in it also involves placing elements down in several masks, which is the same I do but on a tile by tile basis. Basically every output file (I have now increased this to 4) is a mask with every number corresponding to the tile type that needs to be placed on that specific cell. Probably there is a way to make it work with RMXP eventually if I also introduce my tileset to it, but for now I just want to see what the limits of map generation are.

    I have added a slider above which the terrain becomes mountainous (with no trees spawning). That immediatly also highlighted some issues I was too lazy to solve yet involving ridges, so I spend some good time on those.

    Here is an image of the tool by the way (forgive the horrible layout of the buttons):
    https://imgur.com/a/Hs6rf4L

    Hitting go will immediatly generate a map (in mere seconds) and print-sprite will make it an ouput than can be read (to actually get the graphics in). The image on the right is a general 1 layer map to see how it looks (handy for debugging and seeing what the turtle takes as path). I also have a set of buttons that perform the actions step by step. In doing so, you can also paint some things in yourself during certain steps (for now it is mountains and trees). Then there are sliders and choosers for the mountain height and such.

    And here is the same image output read as an actual pokemon map:
    https://imgur.com/a/kG3QaGh

    For now I will test the limits of randomized map generation and not worry about subsequent steps ;)

    edit: here is a map with steeper slopes and higher mountains
    https://imgur.com/a/pnntKQu
     
    Last edited:

    AskipLudo

    The Masked Guy
    159
    Posts
    7
    Years
  • That's interesting, I can't wait to see final result since it's sometimes hard to think about a route to make or other maps ^^
     

    #Not Important

    All hail the wishmaker
    910
    Posts
    4
    Years
  • Is there a beta download link?
    This looks really good and I want to test it out. I have some minor experience with NetLogo and I might be able to help :).
     
    20
    Posts
    15
    Years
    • Seen Nov 18, 2023
    Is there a beta download link?
    This looks really good and I want to test it out. I have some minor experience with NetLogo and I might be able to help :).

    I just added a download link as an attachment to this post. Note that the Netlogo file, while generating the entire map, only outputs 4 txt files, that then have to be run through an R script to get the actual map with sprites.

    It is rather addicting to let it just render maps on end, So here's another:
    https://imgur.com/a/3iVefJy

    I consider the steeper terrain and mountain sprites dealt with. So far I left the generation of 1 tile sprites (think boulders, rocks, trees that can be cut and bushes) out since that will be the easiest to include.

    Edit: I did my best to comment the tool and cleaned the code up a bit. Let's see if I can share it this way. Given that I don't know how much time I have the next coming weeks, it will be interesting to see what others can do with it.

    View attachment route maker.zip
     
    Last edited:
    125
    Posts
    4
    Years
    • Seen Nov 20, 2023
    It seems user have to create locationsoverlay1.txt locationsoverlay2.txt location.txt and base.txt before using,or will get error when code "delete" run
    By the way,is it possible to transform the map into rmxp map file?
     
    Last edited:
    20
    Posts
    15
    Years
    • Seen Nov 18, 2023
    It seems user have to create locationsoverlay1.txt locationsoverlay2.txt location.txt and base.txt before using,or will get error when code "delete" run
    By the way,is it possible to transform the map into rmxp map file?

    Ah thank you! I thought I had a solution for this but apparantly it did not work yet. I have updated the .nlogo file so it is not nessesary to create these folders yourself.

    View attachment route maker.zip

    In the future I am thinking about transforming this into an rmxp map. One thing I want to actually deal with immediatly is reduce the output to 3 layers instead of 4, since rmxp can only deal with 3 layers.

    Edit:
    I have reduced the layers to 3 while not changing the sprites (specifically, the tree width). The drawback is that the trees now have less freedom in placement (but to be honest, this was also the case for the Hearth Gold Soul Silver games). Here is an example, let me know whether this is an acceptable compromise.

    https://imgur.com/a/9cJRYta

    Edit2:
    I went a bit overboard on the greenery. Probably way too much, but did it because I can =p
    https://imgur.com/a/oAhpHSM
     
    Last edited:
    20
    Posts
    15
    Years
    • Seen Nov 18, 2023
    Just a quick update:

    I have been making some slight changes to the model, including randomized start and end positions, as well as some changes to the topography generation. Finally, I have been testing the idea of adding caves to the map, which seems to work quite decently (had to adjust the HG SS sprites a bit so they would fit in with the topography).

    https://imgur.com/a/RMDg8Wp
    https://imgur.com/a/YhhR89G

    I know of some specific situations I need to fix (yet I have these situations not come up in my generated maps yet). Every step adds a lot of variables that can be adjusted as well. On one hand it is great for a lot of diverse maps, but at the same time there are just a lot (you can adjust the max altitude, number of ridges, length of ridges, number of mountain peaks, number of lakes, lake size, number of caves etc...).

    I also should get at optimising the code at one point: the model runs fine, but I just know a lot of my coding is unnessesary lengthy. Finally, while I would like to make this work with RMXP, it seems really difficult to find any information on how to make these .rxdata files. I would not have guessed making the bare minimum file compatable with RMXP with just the tiles of every layer filled in would be this difficult..
     
    20
    Posts
    15
    Years
    • Seen Nov 18, 2023
    Basically each txt contains numbers for each tile of the map which correspond to one of the sprites out of the tileset. The R-script is basically running through every line in the txt and assigning the corresponding sprites to make an image.Each txt makes an image of one layer, which are then overlayed for the final image. Probably overcomplicating things but it works.

    The r-script works in R, a statistics program. I recommend getting RStudio as well for the superior interface. It uses the package "magick". Again there are probably way better ways of translating the output in images, but this is what I came up with with my limited coding knowledge. I would prefer making the output changeable into a file compatable with RMXP, but this is where I lack the skill.
     
    Last edited:
    Back
    Top