2018-01-06 01:43:31 (edited by keithwipf1 2018-01-06 01:49:32)

I'm asking this because I can't figure out how you'd do something like entombed, where every time the game starts the floors are layed out differently.
Could someone tell me how you could do that in BGT? I'm curious.

2018-01-06 05:45:32

This is a process called 'procedural generation'. It's a method of creating data algorithmically as opposed to manually. In other words, its a way of generating data that's either random or systematic by using an algorithm instead of having to manually create everything. This could be done in quite a few different ways. In entombed, I believe that the floor sizes, internally at least, are always constant. What is not is the layout of those floors, the items they contain, the enemies they contain, the doors and passages, etc. The ways that you could do this are quite literally limitless. If you remove the floor size constant then that makes it even more limitless. One way is to do it like so:
1. Generate a list of "possibilities." These possibilities could include walls, rooms, items, enemies, etc.
2. Determine where that possibility is going to be. If your on a 2D axis, generate the X and Y coordinates, or something like it; if your on a 3D axis though, like entombed is, associate something to mean the floor. For example, while the overall dungeon could be a 3D grid, each Z being a floor, each floor could have it's own pare of X and Y coordinates (so a 2D grid inside a 3D grid, for instance).
3. Determine the items attributes and property values. For example, if this possibility is a passage, answer the questions: How long is this passage? Will this passage contain anything? If so, what will it contain? If the item is a room, answer the questions of: How big is the room? How many doors will this room have? Where will these doors go? Will the room have anything in it? If so, what is it? And so on and so forth.
And, finally:
4. Place the possibility.
This sounds way too complicated in an explanation like this, but it actually is quite easy. You would need to repeat that process for the entire dungeon (which could take some time, depending on the generated possibilities). You might also wish to add error checking to determine that nothing overlaps, nothing is placed at the same coordinates as something else is, etc. Otherwise your going to have one hell of a screwed up dungeon.
As for implementing this, I can't answer that. I'm not sure if anyone else can either. We could give you little tidbits, but a true implementation is one all your own, and you'll have to implement it yourself. Don't copy-paste them either -- you won't understand the tidbits then. We can advise you, but implementing this is an entirely different matter.
Just remember that procedural generation can extend to anything. You can generate small facts, random weather, planets, asteroids.... all the way up to entire universes. (And no, I'm not joking. The old game from the 80s, Elite, did just this -- generate an entire universe, with random planets, technological levels, economies, governments, populations, yields, radius', and names.) The possibilities of procedural generation are entirely limitless.
As a final warning, I wouldn't start with something as complex as an entire dungeon in a game. Procedural generation is a concept that you start as a foundation and build upon it. Start with something small -- simple useless programs that generate basic data everyone knows, such as random math problems, random facts from the internet, news media, blogs, etc. as possible possibilities. Then build up to something more complex as you go. But don't try with something supermassively huge. You will quickly get overwhelmed. I know that BGT may be able to handle procedural generation, but remember that your in a single-threaded environment, which means no multiprocessor advantages. Be careful on what you generate and stop immediately if you feel your confused about something. Do research, and look up samples in other programming languages and theories to try to help you out if you do get stuck. This will take a lot of time to do and will not be easy. But once you have a working implementation, have fun with it -- you'll absolutely love it when your done!

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github

2018-01-27 22:05:22

Thanks, this sounds interesting.

2018-01-28 22:16:53

This actually reminds me of an algorithm Philip has posted a long time ago on the blastbay forums, however, when I wanted to check it out today, I found out that the link doesn't work anymore.
Does anyone still have it?

2018-02-14 18:10:07 (edited by lemm 2018-02-14 18:11:50)

hi,

although I haven't ever written a procedurally generated map, I do have the BGT maze generator code that Phillip Benfold  wrote. I’m sure since the code used to be up for grabs on the BGT forum he wouldn't mind me sharing  it here, so I’ve put a drop box link below. when you load it should explain how to use it and to exit it just use the escape key once the maze has loaded and you've finished playing around with it. hopefully after you've seen it in action and taken a look at the code it will give a good example of how procedurally  generated maps work.

https://www.dropbox.com/s/o5p8zt81kgj12 … r.bgt?dl=1

Paul