Sarge
Register | User Profile | Member List | F.A.Q | Privacy Policy | New Blog | Search Forums | Forums Home
Doomworld Forums : Powered by vBulletin version 2.2.5 Doomworld Forums > Classic Doom > WADs & Mods > terrible doom terrain generator of terribleness
 
Author
All times are GMT. The time now is 08:14. Post New Thread    Post A Reply
Ribbiks
Senior Member


Posts: 1316
Registered: 02-11


Ever want to plot your favorite R^2 --> R function in doom? Well you're in luck.

In another fit of boredom I wrote a small python script that implements an idea based on this thread, that is, take a giant grid of squares, and apply some function to modify floor heights.

For example, here's 128*sin((x+y)/256) plotted over the domain ([-448,448],[-448,448]), using 8x8 tiles:

http://i.imgur.com/KwFnhvxl.jpg

wad download

completely useless? probably. terrible framerates? if you go overboard with grid resolution, then definitely. Though the above wad runs pretty smoothly for me in glboom+.

here's a link to the code. You can use your own function by simply changing the function at the beginning of the .py file, though if you want to change the domain you'll have to alter the input grid wad. At the moment the process is extremely ghetto and will likely break at the slightest perturbance in input wad format, etc. So on the off chance anyone actually cares enough to try it themselves feel free to PM me and I can explain the nitty gritty :)

Old Post 03-30-13 21:43 #
Ribbiks is online now Profile || Blog || PM || Search || Add Buddy IP || Edit || Quote
gggmork
If you can make any sense of this post, congratulations


Posts: 2814
Registered: 06-07


That looks quite cool.
I think mediafire is down right now maybe (and filesmelt has been off and on.. maybe the feds are going after them right now like megaupload).
"We apologize, but we are having difficulties processing your download request. Please be patient while we try to repair your download request."
Will try again later, but the pic is cool.

I've only very briefly fiddled with a "seed" grid of randomly shaded pixels, then try some sort of cellular automata rule (in multiple steps, feeding the output back to the input grid) to more smoothly "hillify" it for a landscape. But haven't figured out some sort of rule that makes hills yet (tried making each pixel the average of all its neighbors, but that mostly results in just everything fading to grey. Using pygame.

Edit: actually an idea for yours: maybe do your algorithm w/ random settings in multiple steps, each time "interfering"/adding to the previous pattern (output back into input).. might produce complex hills, not sure.
Like instead of height = bla(x, y) it'd be height = height + bla(x, y) for each step I guess (add to previously generated pattern)

You could also make your floor animated/wavy by changing one of the equation numbers over time, but might have to use acs for that since your operating on the wad in a separate program.

edit again: toomanypuppies.wad is a large file size so maybe it accidentally has doom 2 data in it (happened to me once when making doom 4x larger I think)

Downloaded both. That .py will come in quite handy if I fiddle with editing wads directly some time.

Last edited by gggmork on 03-31-13 at 08:43

Old Post 03-31-13 01:16 #
gggmork is offline Profile || Blog || PM || Homepage || Search || Add Buddy IP || Edit || Quote
ducon
Régulier du Forum


Posts: 1346
Registered: 12-03


I tried these height fubctions but none work:

code:
value = 128.*np.sin((x+y)/256.) #value = min(128.*np.sin(x/(np.abs(y+10.))),200) #value = 128.*np.exp(-((x+y)/256.)**2) #value = 128+128.*np.sin(x/128.)*np.sin(y/128.)


Yours does not work too.
PrBoom complains:

code:
P_GetNodesVersion: using normal BSP nodes P_CheckForZDoomNodes: ZDoom nodes not supported yet


And ZDoom:

code:
No player 1 start

__________________
A shell, an imp.

Old Post 04-01-13 16:06 #
ducon is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit || Quote
zzzornbringer
Mini-Member


Posts: 89
Registered: 03-13


looks awsome. can you animate it and make it looks like waves? :)

Old Post 04-01-13 16:40 #
zzzornbringer is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit || Quote
Ribbiks
Senior Member


Posts: 1316
Registered: 02-11


@ducon,

the problems you are having is because of how shitty toomanypuppies.wad is.

the input wad is literally just a grid of sectors, nothing else, so it will require edits in DB after being mathified. I'd actually recommend making your own template wad, as long as the file is organized in the same manner (byte size of lmps is the same, only 1 map in wad, etc) it will work. here's a description of how the script works:

-read in wad file, (maximum of 2^16-1 sidedefs)
-determine approximate (x,y) coords of each sector by averaging together the vertices corresponding to every linedef that references that sector
-apply function
-write output wad

After running the script on toomanypuppies, I went into DB, re-saved the nodes as zdsp (toomanypuppies was saved as gldsp or something, idk, I just chose a random nodebuilder until I found one that allowed for 2^16-1 sidedefs without compressing anything). Then I added textures, and fixed some stupid linedef errors because I was sloppy when I drew the grid.

So you can feed the script any wad, make your own grids (or arbitrary cluster of sectors), etc, add player starts/items/whatever, and it should be good to go.



zzzornbringer said:
looks awsome. can you animate it and make it looks like waves? :)


with enough dummy sectors and hours of tedium I imagine I could, but at that point I would probably cave and go learn acs or something :p

Old Post 04-01-13 17:02 #
Ribbiks is online now Profile || Blog || PM || Search || Add Buddy IP || Edit || Quote
gggmork
If you can make any sense of this post, congratulations


Posts: 2814
Registered: 06-07


This is pretty badass (animating waves using acs for zdoom):
http://filesmelt.com/dl/heightFunction222.wad

I basically succeeded in making complex animated interesting waves, even though it probably has bugs/brainfarts/etc, and never would have thought that just popping each x/y of a grid into a function to get a height could make kinda organic waves. The variables were getting complex like heightStep then heightStepStep (doublestep) or something to change the heightStep over time. Basically I have no idea what's going on, and maybe its time to stop coding it before I accidentally instruct the computer to fire a bolt of lightening at me.

Not sure what a R^2 --> R function is.
And I'm pretty sure its not possible to animate using a python script like that because acs is needed to change floors in game? Not 100% sure.
On the other hand, I wonder if acs can somehow "save" computed data OUTSIDE the program. Like maybe when you press the "s" key, it could output one of the animation "frames" data, so you can manipulate that particular frame, like process it to put that frame in a boom map instead etc. Maybe in the zdoom console or whatever it might be able to print the data but not sure if you can copy/paste the data into a text file or whatever.

Last edited by gggmork on 04-02-13 at 23:45

Old Post 04-02-13 23:28 #
gggmork is offline Profile || Blog || PM || Homepage || Search || Add Buddy IP || Edit || Quote
Ribbiks
Senior Member


Posts: 1316
Registered: 02-11


hah, that's strangely mesmerizing, almost makes me wanna putz around with acs. Now if only these grids didn't eat up so many linedefs...


gggmork said:
Not sure what a R^2 --> R function is.



2 variables in, 1 out, nothing fancy. technically it should be R^2 --> Z, takes 2 real numbers (x,y), spits out an integer z for each point.

Old Post 04-03-13 00:57 #
Ribbiks is online now Profile || Blog || PM || Search || Add Buddy IP || Edit || Quote
gggmork
If you can make any sense of this post, congratulations


Posts: 2814
Registered: 06-07


I think this step:
-determine approximate (x,y) coords of each sector by averaging together the vertices corresponding to every linedef
is unnecessary, because each x of the grid is just a linear sequence, like:
for y in range(gridheight):
for x in range(gridwidth):
would do the same thing and you could multiply by squareSize if necessary (but probably not).

zdoom wiki is key to learning built in functions etc of acs, just click acs links on left of main page. Many programming languages are practically the same, just a few differences like print(d:fart, s:butt); vs. print fart, butt.
Also I think it helps to pretty much make all numbers fixed point, at least when starting so you don't confuse the 2, like use 5.0 instead of 5. Then you have to use fixedmul() and fixeddiv() to multiply/divide 2 fixed point (decimal) numbers. U can convert from fixed to integer with >>16 and <<16.
Also all arrays have to be global (outside scripts).
And you can't have delays in functions, only scripts.
Those are the main tricky hurdles I know of. Oh also can't do an enormous amount of computation on a single tic or you'll get "runaway script", and each infinite while(1) needs a delay() in it.

Old Post 04-03-13 01:12 #
gggmork is offline Profile || Blog || PM || Homepage || Search || Add Buddy IP || Edit || Quote
gggmork
If you can make any sense of this post, congratulations


Posts: 2814
Registered: 06-07


Playing with a cellular automata algorithm instead now. So far I found one that takes randomized pixels and blends them over time into hills. Here's an animated gif of that happening:

http://www.freeimagehosting.net/edb4y

* start w/ "input" grid of pixels, each set to random 0 to 255 (EDIT: 0 OR 255 works better than a spectrum of greys)
* make an "output" grid of the same size
* for each output grid cell (C), check its 8 neighboring cells (from input grid)
* average neighbors and "slide" C a certain percentage toward that average
* this results in everything blending grey, so to prevent that, multiply them in a certain way to increase contrast (multiply values >=128 by a sliding value higher than 1 and values < 128 by a sliding value lower than 1)
* repeat by making output the new input

Haven't tried doing it for actual floor (and ceiling, so cavelike) heights in acs yet.

Last edited by gggmork on 04-04-13 at 05:34

Old Post 04-03-13 20:57 #
gggmork is offline Profile || Blog || PM || Homepage || Search || Add Buddy IP || Edit || Quote
gggmork
If you can make any sense of this post, congratulations


Posts: 2814
Registered: 06-07


Cave generator for zdoom and whatever else uses acs (type "idclev01" to make a new random cave). Not animated, so won't kill slow computers like the previously linked wavy thing (might update that later so the horizontal stripes are animated too). But not sure if zdoom 2.6.x is required because lots of actions happen per tick in the initial computation probably and 2.6.x has a higher cap than 2.5.x:

cave generator wad (uses cellular automata style height settings (where each cell is influenced by the average of its 8 neighbors) for 14 iterations):
http://filesmelt.com/dl/cellularAutomata.wad

As a final touch, I made the border of the whole grid much more likely to have 255s than 0s (so walls tend to hug the border) and made lights vary inversely with heights.

pic:
http://www.freeimagehosting.net/newuploads/pmm42.jpg

Last edited by gggmork on 04-04-13 at 05:44

Old Post 04-04-13 05:23 #
gggmork is offline Profile || Blog || PM || Homepage || Search || Add Buddy IP || Edit || Quote
Ribbiks
Senior Member


Posts: 1316
Registered: 02-11


damn ggg, looks awesome! I love the light gradients. If there was a wad format that supported a bajillion sidedefs/sectors, you could make some sweet Cave Explorer levels

Old Post 04-04-13 06:28 #
Ribbiks is online now Profile || Blog || PM || Search || Add Buddy IP || Edit || Quote
KiiiYiiiKiiiA
Senior Member


Posts: 1412
Registered: 04-11


As soon as I saw this thread, I immediately thought 2 things.

1) This has so much potential for awesome, and
2)gggmork is gonna turn up on this thread and do interesting stuff.

Keep doing stuff with this guys, because, well, awesome doesn't do itself.

Old Post 04-04-13 07:11 #
KiiiYiiiKiiiA is offline Profile || Blog || PM || Search || Add Buddy IP || Edit || Quote
CorSair
Forum Regular


Posts: 919
Registered: 11-12


An alternative for zdoom slopes... Interesting.

Old Post 04-04-13 07:26 #
CorSair is offline Profile || Blog || PM || Search || Add Buddy IP || Edit || Quote
gggmork
If you can make any sense of this post, congratulations


Posts: 2814
Registered: 06-07


Ha ha, I'm guessing cave explorer is perry bible fellowship, don't remember seeing that one.

It was kinda annoying me how everything was mirrored over the same x/y plane in the above wad, so I generated a SECOND separate grid of 'hills' to ADD/combine with the final thing. So now its more interesting looking imo:
http://filesmelt.com/dl/cellularAutomata2.wad
Might have to idclip at the beginning if it generates a wall on top of you, but liked how it "tidal waves" toward you (an accident since I just updated a row at a time per tic @start instead of the whole grid to reduce slowdown).

pic:
http://www.freeimagehosting.net/newuploads/ia2gk.jpg

By the way I "borrowed" this whole grid I've been using with all its tags from a previous thing I was working on, using acs set_color() or whatever to draw every pixel of a cacodemon on a grid on the floor (in 4 animated frames, used python to get the colors), which is why the grid is 50x60 (also because bigger would have more slowdown). I'll probably post that in the monochrome project thread later. Might make it shoot sphere homing projectiles or something.

Yeah, slopes are much more efficient/less computationally intensive, but this is still interesting imo. And maybe the data could be converted into slopes somehow, but I've hardly used them and doubt it'd be easy.

Last edited by gggmork on 04-04-13 at 16:25

Old Post 04-04-13 07:59 #
gggmork is offline Profile || Blog || PM || Homepage || Search || Add Buddy IP || Edit || Quote
jute
My avatar grips his belt rather tightly.


Posts: 1399
Registered: 03-03


Nice work. cellularAutomata2.wad is so cool! Can you make the cave bigger (preferably much larger)? If the cave was large and there was a way to populate it with monsters and items it would be really fun.

Old Post 04-04-13 20:50 #
jute is offline Profile || Blog || PM || Search || Add Buddy IP || Edit || Quote
gggmork
If you can make any sense of this post, congratulations


Posts: 2814
Registered: 06-07



jute said:
Can you make the cave bigger?


I think it can only get about 2x bigger without collapsing in a fail of slowdown. One cheap way to make it all bigger is copy paste the whole grid against itself on the right or whatever, then scale that double pasted grid to 200% or whatever. The cave becomes wider but less detailed/intersting.

Ground monster movements mostly fail over terrain like that, even when scaled 200%. They can barely step over any bumps, almost all demons are stuck if you just randomly put monsters in the grid.

I tried to make "infinite" caves, by a warping illusion, like when you walk too far in one direction you warp backwards and the whole cave warps back with you (more like shifts back because each side smoothly leads back into the opposite side). But that was too much slowdown.

Old Post 04-04-13 23:28 #
gggmork is offline Profile || Blog || PM || Homepage || Search || Add Buddy IP || Edit || Quote
mrthejoshmon
Senior Member


Posts: 1522
Registered: 12-12


That looks like it would blow up my low end pc, is it laggy or is it compensated or something like that.

Old Post 04-05-13 07:55 #
mrthejoshmon is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit || Quote
Katamori
Forum Staple


Posts: 2650
Registered: 08-10


I don't think that smilar structures can be made without FPS-lag on weaker PCs.

Old Post 04-05-13 10:29 #
Katamori is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit || Quote
gggmork
If you can make any sense of this post, congratulations


Posts: 2814
Registered: 06-07


zdoom 2.6.x runs it at a normal good speed for me (even the animated waves linked earlier). For the caves, the acs computation only happens once at the beginning, then its just a solid static but complex structure. I bought my computer used for like 40 bucks.

Old Post 04-05-13 15:25 #
gggmork is offline Profile || Blog || PM || Homepage || Search || Add Buddy IP || Edit || Quote
Suitepee
Member


Posts: 430
Registered: 03-13


Sure am liking the "caves" pictures there gggmork. Somebody could make a good Doom wad out of that kind of level architecture.

Or at the very worst, a Minecraft-Doom knock off.

__________________
www.youtube.com/JohnSuitepee = I like to Let's Play doom wads.
http://www.twitch.tv/johnsuitepee/ = Alien Vendetta part 1 livestream coming soon...

Old Post 04-05-13 16:48 #
Suitepee is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit || Quote
schwerpunk
Senior Member


Posts: 2067
Registered: 05-12


gggmork: Your screenshots call to mind a higher resolution version of Notch's "Cave Game" test before it became the sensation known as Minecraft.

Old Post 04-05-13 17:47 #
schwerpunk is offline Profile || Blog || PM || Search || Add Buddy IP || Edit || Quote
All times are GMT. The time now is 08:14. Post New Thread    Post A Reply
 
Doomworld Forums : Powered by vBulletin version 2.2.5 Doomworld Forums > Classic Doom > WADs & Mods > terrible doom terrain generator of terribleness

Show Printable Version | Email this Page | Subscribe to this Thread

 

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are OFF
[IMG] code is ON
 

< Contact Us - Doomworld >

Powered by: vBulletin Version 2.2.5
Copyright ©2000, 2001, Jelsoft Enterprises Limited.