• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

[Trigger] Terrain Generation

Status
Not open for further replies.
Level 4
Joined
Aug 24, 2008
Messages
38
[Note: I didn't found a better forum for this thread, but if it belongs somewhere else, please let me know.]

Terrain Generation:

I began to think about creating good looking terrain by using scripts (GUI/JASS*, whatever). So I asked one of my friends to make a nice Ashenvale terrain, and I figured out a way, that allows us to create and make things look living. I'm bad at talking so I made a description in pictures. See them as attachments. (I wanted to make a GIF first, but this gives more control for the reader.) I make the most thing like the grass, if someone needs further information about the generation, I gladly help.
(*I do not use jass)

The map is also attached to the comment.
(To run the generation in different parts, type "-generate 1/2/3/4/5" To provide normal results, you have to run the generation parts in order!)
[Disclaimer: The scripts inside are not yet optimized, and I take no responsibility from the injuries they may cause.]

If someone else has a different idea from mine, then please share it with me. Actually this thread was made for discussion about this topic.


News: Yay! Version 1.1 is released, and if I don't find bugs, I think this is the final one. Uploaded as attrachment. Enjoy, and give me credits if you use it please! :thumbs_up:


-Added a global variable what defines the size of the generation
-Optimized the script a bit
-Region now is only needed to define the source point of the generation (easily can be changed to unit position, or other location)
-Maybe fixed some stuff... (?)
 

Attachments

  • Pic1.jpg
    Pic1.jpg
    182.1 KB · Views: 254
  • Pic2.jpg
    Pic2.jpg
    193.5 KB · Views: 247
  • Pic3.jpg
    Pic3.jpg
    205 KB · Views: 166
  • Pic4.jpg
    Pic4.jpg
    210.9 KB · Views: 268
  • Pic5.jpg
    Pic5.jpg
    221.8 KB · Views: 246
  • Pic6.jpg
    Pic6.jpg
    224.3 KB · Views: 253
  • Pic6-7.jpg
    Pic6-7.jpg
    191.8 KB · Views: 154
  • Pic7.jpg
    Pic7.jpg
    239.9 KB · Views: 302
  • Pic8.jpg
    Pic8.jpg
    241.5 KB · Views: 314
  • Pic9.jpg
    Pic9.jpg
    162.3 KB · Views: 258
  • Pic10.jpg
    Pic10.jpg
    217.8 KB · Views: 265
  • Pic11.jpg
    Pic11.jpg
    156.8 KB · Views: 293
  • Pic12.jpg
    Pic12.jpg
    234.3 KB · Views: 263
  • Generator.w3x
    23.9 KB · Views: 83
  • GenFinal.w3x
    28.9 KB · Views: 180
Last edited:
I've tried multiple times, terrain height generation is impossible with pathing in triggers. Anyways, it seems like a good method. I had attempted something like this before, a maze generator, but instead of trying to make terrain from nothing, I instead had the generator sort of "carve" it out of existing doodads which made the walls (yada yada yada, trees for a forest, magic blocks for a city type thing, etc.)
 
Level 4
Joined
Aug 24, 2008
Messages
38
i cant tell from the picture, but does this do with terrain height too?
Also, you should add destructibles to this
Overall looks very cool good job!

Witch destructibles you mean? This actually makes only a forest right now :D
About the rocks and mushrooms they are destructibles too because I couldn't find a way to add doodas with script. (Mabe I'm just blind :grin:)

@noob134: Well, this one only makes terrain for plain areas. Someone already said that he might require terrain generation for cliffs. But generating cliffs, looks kinda hard. Btw, if I will have some free time I'll try making something valuable.
 
Level 4
Joined
Aug 24, 2008
Messages
38
You can't make doodads with scripts as well as making cliffs and water. even you can't change the terrain's height as you want because the units will walk through it. not above it. I have made a random map generator for my map "Random Map". But the power of triggers are very low for such things

I'm sad to hear that. :sad: BTW thanks for the advice. (Still, I might give a try.)
 
Actually I heard you can place doodads with Jass.

You could use special effects anyways for doodads, and since you can place destructibles use pathing blocks to make the special effects act doodadish.

But yeah you can't change terrain height with pathing with triggers, even GetLocZ doesn't return the correct value when changing it.

In UTM there is a Water Doodad that does generate pathing (idk, it may be a destructable to generate pathing like that, since pathing blockers are destructables), if it is a destructable you could use that to make water - you could raise the terrain up slightly (nothing terribly large) and place some ground pathing blockers next to it to create rivers/lakes/etc. Its worth a shot but it seems pretty difficult.

With forests I'd recomend that the whole thing be pre-filled with trees then carve terrain out of it instead of placing trees in random places (dont forget to hide the trees you kill in the process so theres not tons of trunks everywhere)
 
Using special effecs for doodads is one thing I have done before and it didn't work as I wanted. Path blockers are too large and sometimes with a wrong direction so using them won't be so good.

You can use a water model(like moonwell's water) and path blockers to make seas. But you can't have cliff seas and also ships can't sail on such water.

And with all those, what do you want to do with minimap?
 
Level 10
Joined
May 26, 2005
Messages
194
minimap is a problem always....

but some things i really need to mention:
- dont create pathing blockers. useless lag. instead use scripts to make the terrain unpathable. (SetTerrainPathable(x,y,PATHING_TYPE_WALK, false), or something like that, for different pathng types (float + amphibious + walk (+ flying)), and at some more positions than just one, might be annoying at the first time, but as soon as you wrote a little function which does all that for you at once, its good)

- dont create masses of destructables and "cut things out"... it also lags, creating and removing destructables always leaks a little bit + never ever just hide the "tree corpse", remove it. but better would be creating trees... i mean internally you can decide to first virtually place the whole map full of trees (and save it to variables, but not really place destrucables), and then cut the variables out, not the real trees.

- i dont know all the problems with terrain deformations, but if the only problem would be pathing, that can be solved the same way as described above, check the angle of the terrain incline and if its steeper than a given value, make it unpathable

my supcom (open source) map uses an enumeration over the whole map to set custom pathing, it also changes the texture for terrain near water level, and for cliffs (steep incline), maybe you would like to take a look.



all in all, terrain generation is a great topic to play around with, i would love to see more maps with random terrain (remember good old age of empires? or empire earth, they already had random terrain)
 
- i dont know all the problems with terrain deformations, but if the only problem would be pathing, that can be solved the same way as described above, check the angle of the terrain incline and if its steeper than a given value, make it unpathable

Its not just pathing. Units completely ignore the terrain (say you just made a cliff with deformations, then order a unit to walk to the other side. The unit will walk through the deformation as if it wasn't even there, coming in one side of the cliff and out the other)
 
Level 10
Joined
May 26, 2005
Messages
194
Its not just pathing. Units completely ignore the terrain (say you just made a cliff with deformations, then order a unit to walk to the other side. The unit will walk through the deformation as if it wasn't even there, coming in one side of the cliff and out the other)

hmm... i think it depends

i know that it worked for me once, maybe it only works with some circumstances.... dont know
 
Status
Not open for further replies.
Top