Jigsaw maps pieced together

Yeah, it is hard to explain this idea, I might need to reply a few more questions before I articulate well enough on what I am trying to do

So for rooms 1 to 20
And rooms b1 to b20
And rooms c1 to c20

They already have their existing npcs, enemies, possibly cities and even dungeons

But I want to reuse the same premade stuffs on different games,
or to perhaps randomize the game map layout on every new game

At the top of rooms 1 to 20, which is room15
when player enters room15, he triggers a hidden randomizer code that links this room (room15) to either roomb1 or roomc1

Then the game remembers roomb1 is already activated
So at the right hand side of rooms 1 to 20, which is room5
when player enters room5, he triggers a hidden randomizer code that links this room (room5) to either roomb1 or roomc1, but because roomb1 was already activated, it directly chooses roomc1

So, this is for a different game layout map on every new game

But what if I want something more complicated, map templates for a different game
Imagine I already predid 1000 different rooms split into perhaps 10 different quest apps or alphabets
When I make a new game or five new games, possibly rpg
I copy and paste the 1000 differents rooms in different order so that they are linked in the way I want,
making the game feel different on every game, but actually I am reusing my old map layouts but redesigning it a bit

How do I do this method in the easiest way, because I have tried copying codes

  1. rooms with same number will override other rooms with same number
    Solved: This is solved by using alphabets like roomb1, but maybe you have better ideas
  2. when a room is linked to another room, it create towards and backwards exit,
    this means you have to delete and modify the codes, you can't just copy and paste which is what I wanted
  3. creating an exit might possibly solve all my issues and make the code easy to admin/modify/upgrade, however when I create an exit, it actually gives me a literal object which I have to click on it to move to that destination
    Perhaps, I could just continue with this, 1 clicking object moving per 100 rooms is not that bad after all, but the map view is distorted, so generally, I hate this, I just want the default feel of moving up, down, left, right to explore the world, and not click any button to exit
  4. I possibly know how to randomize or set the npcs' shop items, or enemies' stats, or treasures already, I just need help with this room template thingy
  5. Infinite maze is the best and easiest game creator, but it feels the same everytime you play, a jigsaw maps pieced together can offer some randomization yet feel fresh, and even extendable to many different layout assets waiting to be combined in different ways to mass produce many games
  6. Map view can be huge issue, if jigsaw map templates are hit together on the same spot, the map might appear weirdly

This doesn't sound like it should be difficult; but a little hard to answer in an abstract situation like this. I'll do the best I can.

when a room is linked to another room, it create towards and backwards exit,

That sounds like desirable behaviour to me. Don't you want exits to be created in both directions?
I have in the past used scripts to create the reverse exits automatically (not using the core CreateBiExits function, because it has some minor issues which bug me)

My first thought, if room15 has an exit which can lead to either roomb1 or roomc1, would be to have something like this in the beforefirstenter script:

destinations = Split ("roomb1;roomc1")
rooms = NewObjectList()
foreach (roomname, destinations) {
  room = GetObject (roomname)
  if (not GetBoolean (room, "connected")) {
    list add (rooms, room)
  }
}
if (ListCount (rooms) > 0) {
  destination = PickOneObject (rooms)
  destination.connected = true
  create exit ("north", this, destination, "northdirection")
  create exit ("south", destination, this, "southdirection")
}

Is that something like what you're doing?

creating an exit might possibly solve all my issues and make the code easy to admin/modify/upgrade, however when I create an exit, it actually gives me a literal object which I have to click on it to move to that destination

I don't know why that would happen; unless you're giving the exit an alias which isn't on the standard list of directions. I've helped someone who had this problem before; turned out that she was giving a new exit the alias "North" instead of "north".

Map view can be huge issue, if jigsaw map templates are hit together on the same spot, the map might appear weirdly

It might be a bit more complex to assemble a random map if you need to avoid overlapping rooms. Am I correct in thinking that you have multi-room pieces of the dungeon which need to avoid overlapping? In this case, you would probably need to have some kind of internal map, keeping track of which spaces in the dungeon are used. Normally I would think of using a couple of dictionaries (or a linked list) to organise something like this; but because those data structures are a little weird in Quest, it might be easier to use alternatives; one thing I thought of is giving each cluster of rooms a kind of ASCII-art attribute showing what it looks like in the map; and have a function which loops over this string character by character, checking if two maps would collide.

However, if you have some room-groups which might not fit based on where others are placed, there could be situations where the last group to be connected to the map won't fit. For this reason, you would need to run some map generation at the start of the game; repeating until all necessary areas have been successfully placed.

Hope that makes sense; just some first thoughts off the top of my head.


It is night time, so I am keeping it short

Yes I like to have towards and backwards exit, but if I have to explain why I want it to be simpler or less coding
As foolish as I sound, I am imagining automatic via code or perhaps use quick GUI, scroll down connect exits

Imagine a jigsaw puzzle, you have 3 room templates for different areas like kitchen, brewery, inn, stable, castle
So in a 100 room game, the player will walk and trigger random rooms to access permanently, so 100/3 = 33 manual hardwork to write in towards and backwards exit, and the manual hardwork will become more as your game becomes bigger

The reason why I am using 100 rooms templates to make 1000 rooms game is because of this, I can't do that many manual hardwork, it is also why I love reusing infinite maze over and over again, easy and no workload =D
But as you can see, eventually players can easily recognize the patterns of 100 rooms template and they will get bored, if it does not feel random, it is going to feel like the same game for them, ultimately this means 3 to 10 rooms template are best even though they can be incomprehensible to work with, at least for the now me


Yes, your awesome code is what I am looking, but as usual, it will take me some time to understand it


Example A game code:
Using your code, create exit ("south", destination, this, "southdirection")
Unfortunately, when the player moves, the map is screwed up, the map might be important for a rpg game

<!--Saved by Quest 5.8.6836.13983-->
<asl version="580">
  <include ref="English.aslx" />
  <include ref="Core.aslx" />
  <game name="test2 empty rooms">
    <gameid>2485958b-dbb4-403e-9158-42169e4faf57</gameid>
    <version>1.0</version>
    <firstpublished>2024</firstpublished>
    <gridmap />
  </game>
  <object name="room">
    <inherit name="editor_room" />
    <isroom />
    <object name="player">
      <inherit name="editor_object" />
      <inherit name="editor_player" />
    </object>
    <exit alias="north" to="room1">
      <inherit name="northdirection" />
    </exit>
  </object>
  <object name="room1">
    <inherit name="editor_room" />
    <exit alias="south" to="room">
      <inherit name="southdirection" />
    </exit>
    <exit alias="northwest" to="room2">
      <inherit name="northwestdirection" />
    </exit>
  </object>
  <object name="room2">
    <inherit name="editor_room" />
    <enter type="script">
      create exit ("north", this, roomb1, "northdirection")
    </enter>
    <exit alias="southeast" to="room1">
      <inherit name="southeastdirection" />
    </exit>
  </object>
  <object name="room3">
    <inherit name="editor_room" />
  </object>
  <object name="room4">
    <inherit name="editor_room" />
  </object>
  <object name="room5">
    <inherit name="editor_room" />
  </object>
  <object name="room6">
    <inherit name="editor_room" />
  </object>
  <object name="room7">
    <inherit name="editor_room" />
  </object>
  <object name="room8">
    <inherit name="editor_room" />
  </object>
  <object name="room9">
    <inherit name="editor_room" />
  </object>
  <object name="room10">
    <inherit name="editor_room" />
  </object>
  <object name="roomb1">
    <inherit name="editor_room" />
    <exit alias="north" to="roomb2">
      <inherit name="northdirection" />
    </exit>
  </object>
  <object name="roomb2">
    <inherit name="editor_room" />
    <exit alias="south" to="roomb1">
      <inherit name="southdirection" />
    </exit>
    <exit alias="northeast" to="roomb3">
      <inherit name="northeastdirection" />
    </exit>
  </object>
  <object name="roomb3">
    <inherit name="editor_room" />
    <exit alias="southwest" to="roomb2">
      <inherit name="southwestdirection" />
    </exit>
    <exit alias="east" to="roomb4">
      <inherit name="eastdirection" />
    </exit>
  </object>
  <object name="roomb4">
    <inherit name="editor_room" />
    <exit alias="west" to="roomb3">
      <inherit name="westdirection" />
    </exit>
  </object>
  <object name="roomb5">
    <inherit name="editor_room" />
  </object>
  <object name="roomb6">
    <inherit name="editor_room" />
  </object>
  <object name="roomb7">
    <inherit name="editor_room" />
  </object>
  <object name="roomb8">
    <inherit name="editor_room" />
  </object>
  <object name="roomb9">
    <inherit name="editor_room" />
  </object>
  <object name="roomb10">
    <inherit name="editor_room" />
  </object>
</asl>

And you have already solved a mystery!

I don't know why that would happen; unless you're giving the exit an alias which isn't on the standard list of directions. I've helped someone who had this problem before; turned out that she was giving a new exit the alias "North" instead of "north".

I wrote the exit name as "tunnel" instead of north


Lets not go into dictionaries and data structures, I haven't truly understand the fishy error's dictionaries yet =D
Generally, the map might work if rooms are overlapping in same xyz, but the players may feel out of place, once they were in this xyz and it was a stable but moving another pathway, this same xyz becomes a temple

I am looking more for theoretical answers rather than coding, so anyone giving ideas would be equally helpful
For example, for 3 room templates, use a grid of 3x3, this stops the templates from ever crossing each other, meaning if a stable have 4 rooms, there will be 5 emptiness to fill up the grid of 3x3
I am sure there are more ideas, I am just not artistic or understand dimensional things enough


Log in to post a reply.

Support

Forums