Page 1 of 1

Cannot create large terrains

PostPosted: Sun Dec 17, 2006 1:05 pm
by TheMeatMan
Creating small terrains has been fine for me. I cannot seem to create large ones though. L3DT runs for about 10 hours or so until the event log dialog pops up and starts filling up with TONS of errors. I am only creating a Design Map and a Heightfield. I just really need the heightfield data for the terrain engine that I am developing as I need 2^n + 1 x 2^n+1 sizes. I cannot seem to get a patchwork of heightmaps (which will eventually be resized). Here are the errors that keep repeating:

CMosiacMap::PrepareSubMap error
- cannot init sub map

CMosiacMap::GetPixel error
- cannot prepare sub map for pixel not in memory

CMapGroup::HF_ChannelPass error
- heightfield not initialized

CMapGroup::HF_HybribMethod_Mosaic error:
An operation has failed

L3DT_GetMemState error:
- cannot initialise performance monitor

CSubMap::InitMap error:
- calloc failed to allocate 64MB of RAM
- current state:

CMosaicMemTable::AllocMap error
- could not initialise map!

I have tried this on three computers so far:
Laptop: Windows XP Pro SP2, 2Gb of RAM, Pentium M @ 2.26GHz
Desktop 1: Windows XP Pro SP2, 2Gb of RAM, AMD FX-57 @ 2.8GHz
Desktop 2: Windows XP Pro SP2, 2Gb of RAM, Core 2 Duo @ 2.66GHz

On the laptop I tried a 33km x 33km map, Desktop 1 I tried a 66km x 66km map, and on Desktop 2 I tried a 131km x 131km map.

Here is the .def file for the 33km x 33km map:
<?xml version="1.0" encoding="utf-8" ?>
- <varlist name="Settings">
- <varlist name="DM">
<string name="Algorithm">PeakDM</string>
<int name="nx">512</int>
<int name="ny">512</int>
<byte name="SeaLand">66</byte>
<byte name="FlatSteep">54</byte>
<byte name="FeatureScale">57</byte>
<byte name="FracRough">50</byte>
<byte name="PeakRough">50</byte>
<byte name="Cliffs">70</byte>
<byte name="Erosion">5</byte>
<byte name="Lakes">40</byte>
<string name="Climate">Temperate</string>
</varlist>
- <varlist name="HF">
<string name="Algorithm">InflateDM64</string>
<float name="HorizScale">1.000000</float>
<bool name="MosaicFlag">true</bool>
<int name="MosaicSize">4096</int>
</varlist>
<bool name="WrapFlag">false</bool>
- <varlist name="Ops">
<bool name="GenDM">true</bool>
</varlist>
</varlist>

This is the version of L3DT that I am using:
Release no: 2.4b Rev. 2
Build date: 17-Oct-06

I am kind of stuck. The only think that I can think of doing at this point is to just generate all of the different maps at once in a batch rather than just the Design and Heightfield.

Thanks for your help
- Scott

PostPosted: Sun Dec 17, 2006 11:45 pm
by Aaron
Hi Scott,

The tile allocator has run out of RAM, and the problem seems to be the tile size you're using. By default, most calculations will allocate up to 16 tiles in memory. For a heightfield with 4096x4096 pixel tiles, that works out as 1Gb in memory. I think at the peak memory usage of the heightfield generation stage there are two heightfields initialised at once, so that means you'll have up to 2Gb allocated in RAM. That's getting a bit hairy.

The default and recommended tile size is 512x512 pixels, which means that the max memory allocation for each heightfield is 16Mb. You can probably go to 2048x2048 tiles, as that's 256Mb per heightfield. However, generating the water map will be a problem then, as its pixel size is around 10 bytes, as opposed to 4 for the heightfield (thus, much more RAM used). Oh yeah, the water map also has an auxiliary map during the flooding calculations that is ~8 bytes per pixel, which again will make things unpleasant with large tile sizes.

If 4096x4096 tiles are required, you can generate your heightfield with a smaller tile size, then export the heightfield (file->export->active map) as a mosaic with your larger tile size.

Cheers,
Aaron.