Not logged inOpenClonk Forum
Up Topic Development / Developer's Corner / Removing exact map mode
- - By PeterW [gb] Date 2011-08-27 19:27
This is probably the direction we need to go in order to fix the strange situation that exact landscape drawing doesn't work.
Attachment: PeterWortmann_3293.patch (28k)
Parent - - By Fluff [gb] Date 2011-08-28 08:42
Somewhat off topic, but could it be that I finally know what the W in PeterW stands for?
Parent - By Zapper [de] Date 2011-08-28 11:57
My crystal ball tells me you will find your very answer in the post above if you look closely enough!
Parent - By PeterW [gb] Date 2011-08-28 12:15
Well, "Peter" was taken already in euIRC. Ironically, it's free again these days.
Parent - - By Newton [de] Date 2011-08-28 11:47
Since when does exact landscape drawing not work? What is "exact map mode"?
Parent - - By PeterW [gb] Date 2011-08-28 12:13 Edited 2011-08-28 12:17
Basically since I changed it while optimizing runtime join data size. Here's the story: The old situation was that you could have a number of landscape modes - dynamic, static or exact. Saving would fix this to "exact", which would save a dump to Landscape.bmp that would later read in completely bypassing all the zooming code.

That's a workable idea as long as you're talking local game saves, but really bad for runtime joins. As the landscape probably hasn't changed much since the start of the game, ideally you'd want the joining client to regenerate the original landscape using the same process that the other clients used at the start of the game. Afterwards, it is just a matter of applying some small "diffs" to get up to speed.

For that, it is obiously a very bad idea to "switch" the landscape to exact mode, especially if it overwrites the map in the process. Therefore I changed the system to not switch over to "exact", but just have the savegame creating code put in a "diff" if requested (only case where we wouldn't is when saving as scenario).

Now this has lead to quite a bit of dead code and confusion on the GUI side: The user interface still looks like you could "switch" it over and CR-newbies always get confused when it doesn't work. What's actually happening is that you're working on different data: For "static" you're editing the map (which gets synchronized to the landscape) while for "exact" you're only editing the landscape with no effects on the map.

The patch now kills all the dead code (well, sections were using it, somebody should check sometime whether I've broken them), and disables the exact drawing tools until we find a clearer way of representing them in the user interface - as a start, I converted the drawing mode in C4Landscape::Draw* to a flag, and also made them write the landscape and map at the same time. So maybe we could make a checkbox out of it that warns that using "exact" drawing shows you more detail than saving as scenario will retain.

It's kind of a messy subject - I still think this is what should be done, but as it now involves breaking pretty much every developer mode out there, I thought we might want to discuss it first.
Parent - By Newton [de] Date 2011-08-28 12:40
Sounds like that should be developed in a branch and be merged back again into default when exact drawing in developer mode works again then. I like your solution (Warning message, saving as scenario always means map-mode).
Parent - - By Günther [de] Date 2011-08-28 23:26
Please don't add new "bool" parameters to functions that aren't immediately obvious by just reading a call. A enum or flags argument or a separate function is a lot more readable.

Thinking about this, a way to convert landscapes back to maps would be nice. This should probably be done automatically by the editor. I think simply sampling the center of the square of a map pixel in the landscape should suffice. If you need to be exact for a scenario, simply set the mapzoom to 1. Otherwise, details of the landscape that aren't representable in the chosen map format are only preserved when saving a savegame. So, the editor needs a way to change the mapzoom, and to recreate the landscape from the map. The latter would also be useful to see the variations the map can produce. The painting tools could have an option to "always recreate the landscape from the map". While we're at it, we should add a way to change the landscape size. These can either be menu items or controls in the toolbox window.
Reply
Parent - - By PeterW [gb] Date 2011-08-29 01:57

> A enum or flags argument or a separate function is a lot more readable.


I know the argument, but really? An experimental parameter to three functions that we don't even know wether we'd like to keep? You want to give that its own type? Let's not go overboard here.

> Thinking about this, a way to convert landscapes back to maps would be nice.


Hm, I was under the impression that there is already code for that? Can't quickly find it though. And we should really not encourage anybody to use a static map with map zoom of 1, even if it's technically possible.

Mostly agree on the rest, even though changing landscape size and zoom doesn't really sound too useful to me.
Parent - - By Zapper [de] Date 2011-08-29 06:22

>And we should really not encourage anybody to use a static map with map zoom of 1, even if it's technically possible.


Mh, why is using that a bad thing? Only because of the size or does it have any other disadvantages?
Parent - By PeterW [gb] Date 2011-09-02 14:56
In a way it does boil down to size - but what I am after is again complexity bounds on the landscape data. Landscape should never be so complex that we can't put it using a map - that's just a recipe for Clonks getting stuck. When in doubt, we should make a more intelligent zoom mechanism, like Sven did (as sceptical as I am about the concrete implementation).
Parent - By Günther [de] Date 2011-08-29 09:11

> I know the argument, but really? An experimental parameter to three functions that we don't even know wether we'd like to keep? You want to give that its own type? Let's not go overboard here.


It's not overboard. It really is that much more readable. If you have something against types for some reason, use an int and constants. Pretend that it's a comment ;-)
Reply
Up Topic Development / Developer's Corner / Removing exact map mode

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill