Map Generation System

One concept in games is that they generate maps right? While also being given a set of restrictions to make sure that the game isn’t set impossible, like an entrance that’s blocked, or a gap that’s too wide to cross. I thought it’d be interesting to try to imitate a restriction, height.


Obviously, we will be using platformer for this system. Now let’s get into it.
:stop_sign: means that there is an explanation for block code.

Make sure all triggers are invisible and not able to be activated by stepping, you can activate it by buttons, life-cycles, however you wish.


Barrier Placement

This is very important, grab some barriers and place them around the map, and make sure they are not active, since this is platformer, make sure that some of the barriers can be crossed, but others…not so much.
image
Now, obviously, the lines don’t go over each barrier, obviously because they are too far to clear. But what about the other ones that are right next to each other but not connected? Like the first two? I’ll explain soon enough.


Setup: Devices

This is where we bring in the devices.

Grab the same number of properties as there are props. In the picture, there are 8 props (ignoring the barriers on 5 barriers that are sticking out on the right side of the photo), so we will have 8 properties. Name them 1prop, 2prop and so on until you reach 8prop.

Each number represents the prop, 1 represents the first barrier, or the one that has the least height, all the way to 8, which has the highest height. Since we ‘ID’d’ each barrier, we will have them activate on their number, the first prop will activate on 1, and the highest prop will activate on 8. And the same for the rest between. To deactivate them, name them 1anything, 2anything, 3anything and so on. [1]

Now, those 8 properties we made? Make them number properties, and the value they are holding: heights. For this, look up a height tracker and jump on all the barriers to see their height, then enter the values into the properties.

Make 4 more properties, and name them chosen1prop, chosen2prop, chosen3prop, and chosen4prop. Make them number properties and have them set to 0.


Setup: Block Code

Grab a trigger, this will be our ‘starter’ trigger. Add this block code.
image
image

:stop_sign: Hehe, mistake here, for the set property of chosen1prop, it should be a random integer from 1 to 2, not 1 to 1. Basically, we are grouping the barriers together. Barriers 1 and 2 are in chosen1prop, 3 and 4 are in chosen2prop, you get the point. We are randomizing a number between these barriers, and then broadcasting them, this is what activates the barriers.

Since we have a number, and not a text, we have to convert the number into text, hence the use of the convert numbers to text (with commas)

Now, make another trigger and wire the first trigger to it. Add this block code.
image
image

:stop_sign: Wow! What a doozy! This is gonna take a while to explain.
The if statement is to check the height difference between the two props, we grab the height value between the chosen1prop and chosen2prop and subtract them, if the value is greater than 6 [2] than the props cannot go together, so we concatenate the prop number and that ‘anything’ channel to deactivate it. We do this for both properties. Then we randomize the barriers again in hopes of getting two that are near enough, and we broadcast them again to activate them, and we send out a channel pick2-1.

That pick2-1 is what activated the trigger, not the first one mind you, that one is only activated once at the beginning. The pick2-1 activates the second trigger again and checks to see if this time the barriers are close enough. If they are, the ‘do’ part of the statement is not activated and the next trigger is activated.

Now, what is the next trigger I speak of? Well, here’s a simple diagram.

Beginning Trigger -> 2-1 Trigger -> 3-2 Trigger -> 4-3 Trigger

Hopefully by now, you understand that the other triggers run the same purpose as that 2-1 trigger, except it is checking the next group. Just to help you understand a bit more, here is a picture of the 3-2 trigger.
image
image

See? The two are exactly the same, except this one is checking the height difference between chosen2prop and chosen3prop. Same for the 4-3 trigger. However, when the ‘do’ is run, they should always broadcast pick2-1. This is because when we change the barriers, we might leave the first trigger null, meaning that the barriers now are too far apart. That’s why we always broadcast on pick2-1 for every trigger, to make sure the system double checks that everything is proper.


Advantages and Disadvantages

Now, this system does hold some good concepts compared to just using a simple
randomizer.

Advantages

  • Flexibility:
    Using this system, you can create more advanced map generation, this is because for randomizers, you have to make sure that every prop has the ability to be cleared. This eliminates the possibility of branching out and making a wider scope of generation, since if a barrier is too far, we have no way of countering it. Using this system helps with that.

Disadvantages

  • Tedious:
    Now, the block code isn’t the hardest thing, that’s what this guide is for, it’s actually the props themselves. The united of height take up some space, so your heights aren’t always accurate. To explain, I was able to clear a jump from a prop with a height of 13, to a barrier with a height of 20. Seemed like I was able to jump at a height of 7, not quite. At the same time, I wasn’t able to reach a barrier with a height of 7, from ground level.
    Props will probably be one of your biggest challenges here, as you will meet these problems and you can’t just change a barrier, you have to look at all the connected barriers and make sure the one you’re changing doesn’t render it null in the system.

Neutral
I don’t really consider this an advantage, but more of a customization feature.

  • Customization:
    You don’t have to stick with what I gave you, you can change the number of chosen props there are, you can change the number of props in each of them. It’s yours to make your own.

Overall, this was fun to make, and I hope you enjoyed reading this. I don’t really expect someone to go through the trouble of creating this system, since map generation itself isn’t that common in discovery games.

Difficulty
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11?
0 voters

  1. I don’t know why I added anything as the name of the broadcast, you can change this to maybe 1deactivate or something like that. Also, when I say activate or deactivate, I mean the broadcast channel. ↩︎

  2. Which I’ve deemed the highest you can jump. For this I used the height coordinates to find how high I can jump. ↩︎

9 Likes

by height you mean you cant go up

Good premise but I don’t think people will like this because, you know, AI. Not many people are a big fan of it.

Yes?
You can only jump so high, height basically means if the two barriers are close enough so you can jump them.

Systems are AI, anything with block code that runs diagnostics and tests to make the game run is AI, I just said AI because AI has restrictions with generating terrain and stuff, so I wanted to keep it close.

But, I did heed some of what you said, now the name of the guide is Map Generation System

2 Likes

so wait this would be already preset generation but randomised?

This is good, Minecraft in GimKit.

Sadly, I won’t be able to vote.
image

1 Like

Bump.

1 Like

It appears that the maximum number of votes goes to difficulty 11. But I don’t think this is as difficult as ClicClac’s ___land. So…vote 11 unless you are absolutely sure. Don’t vote it for fun.

1 Like

At least I got to read it. :sob:
But yeah, I agree. Stop trolling, everyone.

1 Like

BUMP!

This is pretty cool!

3 Likes

bump.

4 Likes