Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Brewtal_Legend

Load maps randomly in a pwad?

Recommended Posts

I was wondering if there was a way to make maps load randomly? Specifically using zdoom.

I found this thread in the zdoom forum and was wondering if it could be tailored to handle levels?

http://forum.zdoom.org/viewtopic.php?f=3&t=25248

I'm not sure exactly how to make it refer to levels though. Seems like exactly what I want. All levels played in a random order with no level repeating. Also seems like you could place a specific map that you want to be the last map so it always comes up last. Then maybe add some ending text. Not sure if it will load secret levels correctly though.

Anyone have any suggestions?

Thanks.

Share this post


Link to post

You could have a hub map with separately tagged 'map things' that'd be randomly spawned and that you could pick up that'd cut to a map, and each 'map thing' would be spawned randomly. The number could be swapped out for the last one in the array like that thread you linked mentions as the elimination method. Then when the player enters the map again, the 'map things' are respawned again with one less in the array, and so on until there are no more maps.

'Map things' is a general term, I have a basic understanding of ACS, but I think it could be both things and linedefs, if you can reassign linedef tags? If so, linedef teleports might be the way to go with this, with unused ones' entrances closed off when the hub level is entered. Otherwise just randomly spawn the 'map things', with maybe some thing thrust to shuffle em up. Or make a big bingo-ball scrambler or something that the player jumps into, heh. Would be interesting in a jokewad.

And uhh, I don't know if this'd work because I've never really done anything in ACS and am basing it off logic and one C++ class -.-

Share this post


Link to post
ArmouredBlood said:

You could have a hub map with separately tagged 'map things' that'd be randomly spawned and that you could pick up that'd cut to a map, and each 'map thing' would be spawned randomly. The number could be swapped out for the last one in the array like that thread you linked mentions as the elimination method. Then when the player enters the map again, the 'map things' are respawned again with one less in the array, and so on until there are no more maps.

'Map things' is a general term, I have a basic understanding of ACS, but I think it could be both things and linedefs, if you can reassign linedef tags? If so, linedef teleports might be the way to go with this, with unused ones' entrances closed off when the hub level is entered. Otherwise just randomly spawn the 'map things', with maybe some thing thrust to shuffle em up. Or make a big bingo-ball scrambler or something that the player jumps into, heh. Would be interesting in a jokewad.

And uhh, I don't know if this'd work because I've never really done anything in ACS and am basing it off logic and one C++ class -.-


Unfortunately, I'm not a mapper and have no idea how to make a hub level. I am just now starting to play around with mapinfo and acs just to customize doom for myself. I was hoping to find a way to load a map randomly from the start and then have each level afterwards also be picked at random.

Share this post


Link to post

Hmm. well, you could skip map01 by putting the player start in a 0 brightness box and have an immediate script fill the table with random map numbers, then warp in a descending number at the exit of each map. This would only require the initial RNG. In fact I'm not sure why I didn't think of this first. Guess I'm just a map-solutions person with my preference for boom mapping ;P

You could also make map01 a boss map and have it hardcoded at the beginning (or end, really) of the list, heh.

Share this post


Link to post

I don't think there is a way to do this outside of the actual maps themselves. I would do like ArmouredBlood suggested, and have the first map contain a black dummy sector to place the player start, and have that map fill up a global array containing the map order and immediately skip to the first map (without displaying the intermission via MAPINFO). Then each map after that could have an exit script which determines what map is next in the list.

Share this post


Link to post
ArmouredBlood said:

Hmm. well, you could skip map01 by putting the player start in a 0 brightness box and have an immediate script fill the table with random map numbers, then warp in a descending number at the exit of each map. This would only require the initial RNG. In fact I'm not sure why I didn't think of this first. Guess I'm just a map-solutions person with my preference for boom mapping ;P

You could also make map01 a boss map and have it hardcoded at the beginning (or end, really) of the list, heh.


Thank you very much, but I'm sorry. I'm still not sure what you mean. What's rng? Or a 0 brightness box?

Like I said, I have no mapping experience and just starting to scrape the foundation of editing mapinfo.

Got any good links to describe some of the things you mentioned? Especially how to put the levels into an array?

Share this post


Link to post

RNG = random number generator.

Arrays - basically you can use array[x] to make a string of x array variables, called by using array[0], array[1], etc. More here.

You use an RNG function similar to the one mentioned in the first thread you linked to fill the array with 32* values that are all different, and then at the beginning of each level a script** changes an end-level script*** to exit to the next number in the array instead of the normal level progression, until there are no more entries/levels left in the array and the script just leads to the ending picture and credits.

*31 if you don't want to use map01 again
**either a linedef script you HAVE to go over, or something like a global script that is called at the beginning of each level. Not sure what type exactly
***most likely only an exit-calling-linedef could work

A 0 brightness box is exactly what it sounds like, a sector, say 64x64, that the player starts in with 0 brightness. This allows whatever scripts that are running to work without the player having to do anything for a second or two before he/she is teleported to the first map in the array.

Honestly though it sounds like you want to do this without using any map-specific scripts so you can just insert it into a pwad and get random levels going. That's a bit beyond me, and possibly not possible without making a new .exe, but eh, like I said I just have ideas based on limited knowledge, not experience.

Share this post


Link to post

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×