The Open World
Introduction
Over the past weeks, I've been thinking through how the open-world system would work in Deadwind. I'm happy to say it's finally come to fruition and is pretty much ready to be populated with content.
Converting PNGs
Back in August, I utilized an asset to make a tool that parses over a PNG, reads the colour value of each pixel, and writes data to a file containing information denoting what each tile of overworld map should be. (This map is 400x300 with green areas being grassland, brown being forests, grey being mountains, etc. It is still a work in progress) Once the file is created, we have all the information needed to generate tiles in the world.
Parsing the Save File
At this point, we can convert the save data to tiles in the world. Simply by assigning each value(1 = grassland, 2 = forest, etc) to a tile from a tile set. We then parse the whole room and place the tiles at their corresponding positions.
Area Generation
The overall random generation is achieved through a tool I purchased called jen_scripts(I'm in no way affiliated with the dev, i just genuinely think this asset is awesome). I use it to generate roads, rivers, and various ground clutter like grass tiles, flowers, and rocks.
For each area, I needed a way to generate the room with set parameters based on the area's surroundings. For example, If the area entered is the centre of a 3 way crossroads going north, east, and south-west, with grasslands surrounding it, The random generation should change to fulfill those requirements. (Forgive the upcoming paint.net art)
To do this we check the surrounding tiles of the area we want to enter and designate points in the room corresponding to said surrounding tiles. (Ex. Grass points in the corners, rivers top and bottom, and paths left and right)
From here we iterate from those points to the centre of the room; placing tiles, and creating deviance from a straight line to add more randomness and fill the area. We also perform some random scattering of ground objects based on the surrounding biomes(ie. more rocks in areas surrounded by mountains). Using this method we can generate nice forks in roads, and have nice gradients between different areas
Cantor Pairing
To make sure the area generates the same every time, I'm using a function called Cantor Pairing. Basically, this function takes two numbers as inputs, and outputs a single unique number.
Using the map coordinates of the chosen area as inputs to this function, we can generate a unique seed to use. This means that every time we enter this area, it will generate exactly the same; giving the illusion of a static open world.
The Size
Using this method we can generate very big overworlds with very small file sizes. I'm sure I could get the file size smaller but at the current moment the 400x300 map generates a file that is 118kb large. Also each individual area is 170x96 tiles large. This means if every tile on the map was land, and you consider 1 tile to be 1 square meter, there is effectively 1958 square kilometres to explore at ONLY 118kb.
Conclusion
I'm super happy with how this system is turning out. Its not 100% fool proof as of yet, as there are still some problems getting certain areas to line up with its surrounding areas, but it really does give the sense of a massive open world to explore.
Future plans for this include quests (including radiant quests) being tied to map coordinates, random encounters as seen in the demo, and unique locations to discover.
Stay tuned!
Jason Accardo
Get Deadwind
Deadwind
An Open-World CRPG Roguelike Adventure
Status | In development |
Author | Jason Accardo |
Genre | Role Playing |
Tags | Lo-fi, Open World, Roguelike, Turn-based |
More posts
- Alpha 2.5 ChangelogJan 13, 2023
- Alpha 2.4 ChangelogDec 09, 2022
- Alpha-2.3 ChangelogNov 25, 2022
- Alpha 2.2 ChangelogOct 26, 2022
- Alpha-2.1 ChangelogSep 28, 2022
- Alpha-2 Released!Sep 23, 2022
- Alpha-2 Changelog/Life UpdateSep 21, 2022
- Future FeaturesJul 31, 2022
- Alpha 1 Released!Jul 29, 2022
Comments
Log in with itch.io to leave a comment.
Love the game so far, can't wait to see more!