For worldmappers: You _must_ set elevation on worldmapground
Moderator: Board moderators
-
- Forum Fanatic
- Posts: 852
- Joined: Sun Jun 13, 2004 2:07 am
- Location: Hemel Hempstead
Yeah, but that is pretty much how the weathermaps work already, so it seems sanest to hijack them.Mith wrote:with =/= within...cavesomething wrote:it should belong with the weathermapMith wrote: i think it would be wise to store this data together with the map files
i thought of something like world_111_111 and grid_111_111, this wont break diffs
maybe have the server check the last_modified data for these files. when they differ, regenerate the grid, otherwise use the stored grid file
hmm, that is harder, it might well be possible to create uncreateable setups that way....Mith wrote: i would like to see it possible to overrule the algoritms guesses with explicit altitude definitions in the worldmap files. (the algoritm should takes these values as base values)
To express my previous post better (by which I mean by using more maths

make all hights h such that grad(h)<=f(terrain) and h(shoreline)=0 and h < max_h (probably whatever everest is)
f(terrain)=
200 - mountains
100 - hills
40 - roads
20 - plains
5 - beach.
div(h(x,y)) should be high for mountains, lower for plains. and negative for sea squares.
-
- Forum Fanatic
- Posts: 852
- Joined: Sun Jun 13, 2004 2:07 am
- Location: Hemel Hempstead
ooh, that is an interesting possibilty, and not too hard to do either, merely |grad(h)*travel_vector| and scale to an appropriate value to get speed modifier....Casper wrote:I assume then that walking uphill would be slower than walking downhill, shoting downlill should hurt more, and falling off something should hurt unless you can fly.
Well... levitation currently makes moving over mountains quicker, even really high ones, and levitation should realisitcly still be able to cushion your fall even if you can't levitate very high from the ground.bort wrote:What if your levitating? you can only levitate about 4-5 feet above ground...
Here is a hack I use to fill in areas of maps. It doesn't generate slopes and nice elevation but it does make ok ranges based on the arches.
Note* pasting this code into here borked the indentation so this won't run as shown.
Code: Select all
#elevate.py
#by Todd Mitchell
#written in python 2.2, also should work in older versions
#To generate random appropriate elevation based on landscape archetypes
#
#from __future__ import nested_scopes #<--may be required for python 2.1
import sys
import os
import random
import re
def multiple_replace(dict, text):
""" Replace in 'text' all occurences of any key in the given
dictionary by its corresponding value. Returns the new string.
Xavier Defrang:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/81330"""
# Create a regular expression from the dictionary keys
regex = re.compile("(%s)" % "|".join(map(re.escape, dict.keys())))
# For each match, look-up corresponding value in dictionary
return regex.sub(lambda mo: dict[mo.string[mo.start():mo.end()]], text)
archdict = {'deep_sea':[-20000,-5000],'sea':[-4999,-99],'sea1':[-4999,-99],\
'shallow_sea':[-98,1],'marsh':[-5,50],'cmarsh':[-5,50],'swamp':[2,9],\
'deep_swamp':[2,9],'pstone_1':[11,3000],'pstone_2':[11,3000],\
'pstone_3':[11,3000],'pstone_4':[11,3000],'grass':[11,2000],\
'desert':[11,3000],'dunes':[1000,5000],'brush':[11,3000],\
'evergreens':[1000,3000],'jungle_1':[10,3000],'jungle_2':[10,3000],\
'tree':[100,3000],'evergreen':[1000,3000],'woods':[100,3000],\
'woods_2':[100,3000],'woods_3':[100,3000],'hills':[3001,5000],\
'hills_rocky':[3001,5000],'treed_hills':[3001,5000],\
'steppe':[3001,5000],'mountain':[5001,9000],'s_mountain':[5001,9000],\
'glacier':[5001,9000],'mountain2':[9001,12000],'mountain4':[12001,15000],\
'mountain5':[15001,25000], 'beach':[0,300]}
def randomgen(range):
n = random.randrange(range[0],range[1])
return n
def elevate(None, dir, files):
for file in files:
file = os.path.join(dir,file)
try:
dict = {}
replist = []
f = open(file,'r')
contents = f.read()
contentlist= contents.split("end\n")
targetarches = [arch for arch in contentlist\
if ((str(arch)).find("elevation")) == -1]
#makes list of all arches without elevation entry
for arch in targetarches:
for item in archdict:
if (str(arch)).find("arch %s\n" %item) != -1:
chop = len(item)+6
ele = randomgen(archdict[item])
temp = "%selevation %s\n%s" %(arch[:chop],ele,arch[chop:])
dict[arch] = temp
if dict:
contents2 = multiple_replace(dict,contents) #find and replace
o = open(file,'w')
o.write(contents2)
o.close()
print "map file: %s, %d elevations assigned." %(file,len(dict))
else:
print "%s, no changes" %(file)
except(OSError, IOError):
pass
if __name__ == '__main__':
import sys
if len(sys.argv) < 2:
sys.stderr.write ('Applies arch appropriate random elevation\
to maps in target folder.\nUsage:\elevate.py <target folder>')
sys.exit()
else:
print "Generating new elevation information for maps in %s\
\n ...this may take a minute" %(sys.argv[1])
os.path.walk(sys.argv[1],elevate,None)
Last edited by Avion on Sat Mar 12, 2005 8:02 pm, edited 1 time in total.
-
- Forum Fanatic
- Posts: 852
- Joined: Sun Jun 13, 2004 2:07 am
- Location: Hemel Hempstead
My understanding of python is somewhere close to non-existant, so I stuggle to follow the execution path through that script. However it /looks/ like this just randomly assigns height to all squares within the range specified in the first array, is this correct?
If so then it might explain something.
weather.c line 873-875
which means that some of the mountain5's are probably having some very odd elevations indeed.
If so then it might explain something.
weather.c line 873-875
Code: Select all
if (weathermap[x][y].avgelev < -10000 ||
weathermap[x][y].avgelev > 15000)
weathermap[x][y].avgelev = rndm(-1000, 10000);
}
-
- Forum Fanatic
- Posts: 852
- Joined: Sun Jun 13, 2004 2:07 am
- Location: Hemel Hempstead
some further pokeage:
a quick grep and sort on the world maps show that they have elevations ranging from -32000 to 32000
This is well outside the value that the weather code checks for. Seems like a lots of ocean is actually really shallow, or even +ve altitude.
This might explain the precipitation on cat2, if the water tiles are having a randomly set height, then it could well be that the seas are acting like giant evaporating basins (only they don't evaporate ever, because sea doesn't turn into land), I'd need to simulate some conditions to determine if that is the case, unfortunatly the weather code doesn't have a test rig built in.
a quick grep and sort on the world maps show that they have elevations ranging from -32000 to 32000
This is well outside the value that the weather code checks for. Seems like a lots of ocean is actually really shallow, or even +ve altitude.
This might explain the precipitation on cat2, if the water tiles are having a randomly set height, then it could well be that the seas are acting like giant evaporating basins (only they don't evaporate ever, because sea doesn't turn into land), I'd need to simulate some conditions to determine if that is the case, unfortunatly the weather code doesn't have a test rig built in.
-
- Forum Aficionado
- Posts: 1994
- Joined: Tue Apr 29, 2003 5:55 pm
- Location: Minnesota, USA
- Contact:
/me pokes mikeeusa, again, for the color coded map elevation script for an output like this: https://24.190.58.202/cat2/CF-Adventurers-Map.png


-
- Forum Fanatic
- Posts: 852
- Joined: Sun Jun 13, 2004 2:07 am
- Location: Hemel Hempstead