Not logged inOpenClonk Forum
Up Topic General / Help and Questions / dynamic landscape questions
- - By Pyrit Date 2013-12-02 19:53
I have some questions about some dyn landscape stuff.

1. I have used the lines algorythm to make a landscape, but the lines always have a random phase. (shift to left and right). I can lock the phase with a seed, but then the turbulence of the borders always stays the same.
Caesar suggested a steep sine, but how do you make lines, where the space between the lines and the thickness of the line is not the same? You could make 2 sines, where one cuts out the other, but I'm not sure how to do that.
2. I'm using sine at some other places in the landscape. Can you define a random phase for it in landscape.txt?
3. Should I use map.c? Can Mape do map.c?
Parent - - By Sven2 [de] Date 2013-12-02 22:03

> 3. Should I use map.c?


Yes

> Can Mape do map.c?


No
Parent - - By Newton [th] Date 2013-12-03 05:25 Edited 2013-12-03 05:29
So, Landscape.txt is obsolete in your opinion? Why is using Map.c better than Landscape.txt
Parent - By Sven2 [de] Date 2013-12-03 20:53
Map.c is a lot more powerful since you can write any algorithm you want in script. For example, with the landscape.txt lines algorithm you're bound to implementation details of that algorithm, such as the random offset. In Map.c, if you don't like what the algorithm does, you can just write your own loop that iterates over all pixels and draws lines. On an unrelated note, the Map.c lines algorithm also supports arbitrary offsets.

You also have more control over the landscape. So if you want for instance exactly three batches of gold, placed anywhere on the landscape, you can write a loop that does exactly that. In landscape.txt, such control was impossible.

You can use extra parameters in the map. For example, you can place as many batches of gold as there are players activated for the game.

You can reuse script functions you wrote for one map on another. For example, there's a helper function to fix liquid borders so you don't have batches of water floating in the sky. This helper function can be called from any script. In landscape.txt, every landscape had to invent its own method using some variation of the border algorithm (and it usually didn't work perfectly).

You can post-process parts of the map already drawn. For example, you can create the left side of the map randomly and then mirror it to the right. You should also be able to combine that with Landscape.txt (Although admittedly that's still untested). E.g. : Create a landscape with Landscape.txt for the base map and then use a Map.c script to free space for starting positions, mirror the map, fix liquid borders, etc.

If people still want to use Landscape.txt for some reason, I'm fine with that. But they have to live with the limits of the old generator then; I don't see a reason to add more features to it.
Parent - By Clonkonaut [de] Date 2013-12-03 14:28 Edited 2013-12-03 14:31
...and what is Map.c
Reply
Parent - - By Pyrit Date 2013-12-03 20:08
So you have to fire up the engine everytime you change something and see if it works?
Parent - - By Sven2 [de] Date 2013-12-03 20:40
At the moment, yes :(
Parent - - By Pyrit Date 2013-12-03 23:32
Mh, that's unfortunate.
Another question:
Can you do something like the following in map.c?

Let's for example have a normal flat surface for the map. And now the surface should have turbulence. But on the left, the turbulence should be 0 and on the far right it should have a lot of turbulence. So the map gets gradually more turbulent from left to right. Would that be somehow possible with a few lines of mapscript?
Parent - By Sven2 [de] Date 2013-12-04 02:16 Edited 2013-12-04 02:19

> But on the left, the turbulence should be 0 and on the far right it should have a lot of turbulence.


You could do this by first defining a random seed and then applying turbulence column by column with that same seed. But unfortunately, the result wouldn't be a continuous surface because the random values are determined as "rand() mod range" and not as "rand() * range / MAX_RAND". I wonder if I should change that to make such applications possible. Another option would be to introduce callback algorithms.

Without engine changes, if you really need this you can just copy the turbulence algorithm (C4MapScriptAlgoTurbulence::operator ()) to script. It's relatively simple and since it's mostly arithmetic, it wouldn't need that many changes from C++ to C4Script. Another option that might work: Scale the map into a trapezoid such that the left side is zoomed in and the right side remains at original size. Then apply turbulence, then scale back. See attached image.
Parent - By Newton [th] Date 2013-12-04 04:51
How hard would it be to make mape able to parse those things?
Up Topic General / Help and Questions / dynamic landscape questions

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill