• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Library for terrain generation/formation/geography

Status
Not open for further replies.
Level 15
Joined
Aug 7, 2013
Messages
1,338
Hi,

Before I start re-inventing the wheel, are their libraries out there for doing terrain/geography creation dynamically. By dynamically I mean doing it during the game.

Some useful functions might be:

JASS:
library Terrain 

//creates a natural looking river
//parameters:
//width - how wide the river should be
//bend - the eccentricity of the river's bend/curve/angle
//source - the point/rect where the river starts
//mouth - the point/rect where the river ends
//depth - how deep the river is
function createRiver takes ... returns ...
...
endfunction

//creates a natural looking mountain range
//parameters: ...

...
function createMountainRange takes ... returns ...
...
endfunction

//creates a natural looking coast
//parameters: ...
...
function createCoast takes ... returns ...
...
endfunction

//and so on and so forth

If not available I guess I'll just ask threads about more specific questions.
 
Level 15
Joined
Aug 7, 2013
Messages
1,338
No need to do be saving the game. You can just call the function again and if you pass it the same parameters, it will be exactly the same.

Making rivers would require terrain deformations though? I have read those can cause desynchronizations...
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
We usually do not have such vague functions. But there are limits to what you can do ingame anyway. For example you cannot add/remove/reset the water level. Nor can you modify cliffs or place doodads. So you would have to find substitutes for them.

@Solu9: There is a load game event. Just store the deformations yourself in some data structure and restore them on this event.

No, terrain deformations do not desync the game perse since wc3 possesses no gameplay mechanics referencing the z value of things. It's only used for local graphical stuff. On the other hand, a lot of maps try to implement such features by using and assuming the GetLocationZ function would be synced. This is mostly fine as long as the terrain is static.
 
No such library exists

have fun

edit
When writing your new library

http://www.hiveworkshop.com/forums/...80/jpag-jass-proper-application-guide-204383/

Also look in "My Resources" at comment headers to get a good feel for easy to read documentation.

Many newer vJASS resources use some derivation of the comment headers found in there

Example: http://www.hiveworkshop.com/forums/jass-resources-412/snippet-delayeddummyrecycler-239327/

Also take a look at http://www.hiveworkshop.com/forums/...ssion-rules-updated-november-18-2012-a-40760/

Next, please consider Alloc with struct extends array compared to the default jasshelper allocation. There is a reason why most people use Alloc.

Finally, if you ever need a collection, many of them have already been coded. You know where to look ;).

Welcome to the JASS section! I hope to see many public resources from you :).
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Terrain generation is not easy. I am guessing you need quite a good understanding of geography to write an effective library. You also need to have a process in place to stop artefacts from occurring. Terrain artefacts are when the generation of 2 nearby structures cause an "un-natural" boundary which often looks like a real mess.

Empire Earth Art of War (a game from 2001) had a good example where the one space random map generator occasionally created moons such that it would prevent the generation of your capital and most starting civs due to the space boundary around the moon overlapping with the centre of your planet.
 
Status
Not open for further replies.
Top