Jump to content

Photo

Random Worlds by Randomizing DMaps

randomizer random world DMap

  • Please log in to reply
5 replies to this topic

#1 HeroOfFire

HeroOfFire

    Doyen(ne)

  • Members

Posted 09 June 2018 - 03:52 PM

This is an experimental idea I've had for a while. Rather than having a world generator design every screen, have a randomizer shuffle small DMaps that are designed like pieces of a jigsaw puzzle to "build" a random overworld.

 

So I made a script and a bunch of functions that fill a 16 x 16 screen world with 4 x 4 DMaps. There can be more DMaps to fill with than the 16 needed. In addition, the DMaps could be designed in such a way that every other row or column has an offset, basically allowing 6 "adjacent" DMaps to every DMap instead of 4.

 

I've actually made 4 variations of the scripts to account for different setups.

 

This Zip File contains the Example quests and related zScript files each uses.

 

Random World Example Quests

 

There are 4 Examples of the random overworld through randomized DMaps.

 

Example 1 is the most basic, it just fills a 16 x 16 area with 16 DMaps. There are 18 DMaps it can choose from. It allows offsets of rows or columns. It also has a few hardcoded features compared to other examples, to simplify what you would need to change to work with it.

 

Example 2 has an overworld and an underworld. Both are 16 x 16 and use a different set of 18 DMaps to fill each. It also is a little less hardcoded when it comes to locations of the warps or the array of 18 DMaps it places

 

Example 3 is based on Example 1, except it places DMaps based on a "difficulty group". You always start in a difficulty 0 DMap, and the difficulty increases the further away you go.

 

Example 4 is a combination of Examples 2 and 3, having two 16 x 16 areas and a difficulty system.

 

All current examples assume the 16 x 16 world wraps around on all sides. This simplifies how the DMaps must be designed to support the side warps. In addition, all offsets are exactly 2 screens shifted over, or half the length of a DMap.

 

It is suggested you look over the quests in zQuest to understand what needs to be set up for the shuffled DMaps. In addition, there are some screens that act as "visual aid" for what the scripts are doing, especially when it comes to difficulty. In these cases, the difficulty is color coded and goes Green, Yellow, Blue, then Red for 0 - 3.

 

As this concept is still under development, I expect some changes to the script will be made to fix bugs or improve efficiency. In addition, there can be more Examples developed for other scenarios that come up.

 

But I've been doing randomizers for a while. Why share these scripts first? Because I see a lot of potential use of them from a variety of developers who understand zScript. I personally plan to turn Example 4 into a quest sometime in the near future. Example 1 could work for a more open overworld quest like what Mirage Island or most of my other randomizers were built around. And I could see Example 3 for a Metroidvania style quest. I also see the potential of a collaboration project where multiple users submit DMaps designed to be shuffled this way.


  • Anthus likes this

#2 Anthus

Anthus

    Lord of Liquids

  • Members
  • Location:Ohio

Posted 09 June 2018 - 04:29 PM

 

I also see the potential of a collaboration project where multiple users submit DMaps designed to be shuffled this way.

 

Whoa. I'd love for something like that to happen.

 

That said, this looks really awesome! I wish I had more time to really dive into learning something like this, since Example 3 sounds really fun to mess around with. Really, they all do though.



#3 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 10 June 2018 - 08:16 AM

I have a somewhat different model, as I have mentioned that I plan to develop, that uses dmapdata, and mapdata in 2.54 to generate fully randomised maps for dungeons. I was going to use a generalised set of room layouts, where the randomiser selects a room style, then inserts it, configures doors, enemies, and room items as needed.

 

The two issues that I foresee, are key doors, and passageways.

 

I was thinking of starting this with a twist on 1st.qst, where each labyrinth is randomly generated at quest init.

 

If that works, I might make a sandbox style of game similar to Binding of Isaac.


  • Anthus likes this

#4 HeroOfFire

HeroOfFire

    Doyen(ne)

  • Members

Posted 10 June 2018 - 10:28 AM

It's funny, because either I was gonna do THIS, or work on a random dungeon generation script. I decided I am still tired of dungeons after working with so many in Omega, and this does not have to be used for dungeons.

 

That said, the examples use dungeon walls to demonstrate how you will need to line up screen transitions for going between adjacent DMaps. You don't technically need to line up tile warps on the same combos for the versions that have an Overworld and Underworld, just make sure the tile warps are on consistent screens so the screens line up properly.

 

It's also possible to scale this up. I might add some examples later where the world is 24 x 24, so there are 36 of these 4 x 4 DMaps. Or maybe the DMaps themselves are larger, like 6 x 6.

 

In any case, this is sort of the first step to a quest that uses this concept. From here, other scripts would need to read from the filled world array and determine things like item placement (and randomization). Those are... understandably more complicated, both to explain, and to have a good readable script for. I'm still figuring out how I'd want to do it. I actually need to design screens for a few of these Maps to see what kind of flow can form in a 4 x 4 area.



#5 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 11 June 2018 - 09:19 PM

My goal isn't that in-depth. It's mors of a demonstration on how to do it, and a proof of concept for new features.

 

Obviously, a game similar to Binding of Isaac should be easy-enough with the new stuff. It doesn't need passageways or other Z1 things. The prime consideration is: When should I generate the maps?

 

I'm thinking that generating them on completion of the prior map, would be best, in that conext; while a random Z1 quest would generate the map on entering any dungeon entrance, and it would persist only while that game is active.

 

Since readmaps() isn't called on death->continue (IIRC), they should persist through player death, but if not, then it becomes trickier.



#6 HeroOfFire

HeroOfFire

    Doyen(ne)

  • Members

Posted 11 June 2018 - 10:08 PM

When it comes to randomly generated content, part of the consideration is if you need to save it. I set a lot of screen registers to "save" what has been generated. If it is something that does not need to persist across saves, then you don't need to store the values of the random generator somewhere that gets saved.

 

Of course, you can always save the generated dungeon, and then clear the registers to re-generate it if the situation comes up.

 

As for when to do generation (and how much), I tend to do anything that needs to be saved all at the beginning. It allows use of in-scope variables that don't need to be saved for later world generation calls, and it ensures everything is constant past that point regardless of how the player plays.

 

In the rare case I have something generated that does not need to be saved, such as a random order of bosses for a Boss Arena, then I only make the function call right before the player accesses the area generated.

 

So for your Binding of Issac example, if the player can only access the generated content "once", and leaving it or quitting ZC is a point of no return, then generating it right before the player can access it makes sense. But if the player can leave the dungeon, and come back later, possibly after saving, it might make more sense to generate it during the quest init. Either that, or make the generator function a one time call by setting a screen state or register on the screen that makes the function call. Maybe have the function only generate if a variable is not set, and clear said variable when the player completes the randomly generated dungeon.





Also tagged with one or more of these keywords: randomizer, random, world, DMap

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users