I was thinking about posting an enhancement in the bug tracker to add a flood-fill option to studio to allow the user to fill-in large areas of the map quickly. The problem is, I'm still not sure how exactly this should work. Here are my ideas on this.
Idea #1: Chunks as Boundaries
I'm guessing that Exult doesn't keep track of chunks used when building a map, but just the objects the chunk contains. If I'm wrong and it does keep track of chunks, then the floodfill option would be easy to do: just recursively change all chunks surrounding the original point to the new specified chunk until you reach a chunk that does not match the old chunk of the original point. This would allow users to just draw the outline of an area, then fill it in with the floodfill option.
Idea #2: Only Overwrite Null Shape
If Exult doesn't know what chunk was used for an area, one could instead have the floodfill algorithm check the upper-left corner of each chunk to see if it is the null shape, and if so, change the whole chunk to whatever chunk is being used for the floodfill option. Not as useful as #1, but still useful for creating the coastlines of continents and islands, then filling in the interior with the predominant land type, then filling-in the rest of the world with ocean.
If there is any interest in this idea, I'll write-up whichever idea is more feasible (if either are) in the bug tracker as an encancement with pseudocode for the actual floodfill algorithm.
-Karl
Floodfill option in Studio?
Forum rules
NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
Re: Floodfill option in Studio?
> I'm guessing that Exult doesn't keep track of chunks used when building
> a map, but just the objects the chunk contains.
It stores the actual chunks. (This is to keep the total map size on disk small.)
> a map, but just the objects the chunk contains.
It stores the actual chunks. (This is to keep the total map size on disk small.)
Re: Floodfill option in Studio?
What if you make customizations to one of the chunks on the map? Does it just store the objects in that case? For example, what if I put a forest chunk on the map, but manually deleted one of the trees and replaced it with a boulder, then saved the map?
I'm mostly just curious, but it may also affect how the floodfill option would work.
-Karl
I'm mostly just curious, but it may also affect how the floodfill option would work.
-Karl
Re: Floodfill option in Studio?
If you're NOT in 'terrain-edit' mode, it just affects the one chunk. If you are in 'terrain-edit' mode, then it affects all uses of that chunk. If you don't want that behaviour, you'd want to copy that chunk to a new one and then use that. I've been trying to think of a way to make this all more user-friendly, but haven't come up with anything yet. The sharing of chunks saves a lot of space; I think each one is used an average of 9 times.
The floodfill tool is a good idea, and shouldn't be too hard to do.
The floodfill tool is a good idea, and shouldn't be too hard to do.
Re: Floodfill option in Studio?
Again, this comes from outdated ES knowledge (perhaps I should try it and do some map editing soon)...
The easy way would be to just have a warning box pop-up when a chunk is about to be edited, mentioning that it exists in other places in the world and asking if the user really wants to modify it. This is only done the first time that chunk is edited (or maybe even the first time any chunk is edited.)
Another way is to not allow changing the chunks on the main screen at all. Edit them in a separate chunk-edit window. In terrain-edit mode the chunk the cursor is over will be highlighted instead of the tiles. When one is selected, the editing window appears. In that window you can scroll through available chunks. The main window is updated so you can see how it looks in context (that or the bordering chunks are also shown in the editor.) Tiles are listed, along with brush shapes. It is like a paint program. There are buttons to Save (modify the actual chunk and exit), Save New (create a copy in that location and exit), Clear, and simply Exit (no changes). This encourages you to share chunks instead of create new ones if possible... but it might be annoying for people who just want to change one minor detail to have new windows popping up all the time.
The easy way would be to just have a warning box pop-up when a chunk is about to be edited, mentioning that it exists in other places in the world and asking if the user really wants to modify it. This is only done the first time that chunk is edited (or maybe even the first time any chunk is edited.)
Another way is to not allow changing the chunks on the main screen at all. Edit them in a separate chunk-edit window. In terrain-edit mode the chunk the cursor is over will be highlighted instead of the tiles. When one is selected, the editing window appears. In that window you can scroll through available chunks. The main window is updated so you can see how it looks in context (that or the bordering chunks are also shown in the editor.) Tiles are listed, along with brush shapes. It is like a paint program. There are buttons to Save (modify the actual chunk and exit), Save New (create a copy in that location and exit), Clear, and simply Exit (no changes). This encourages you to share chunks instead of create new ones if possible... but it might be annoying for people who just want to change one minor detail to have new windows popping up all the time.
Re: Floodfill option in Studio?
I don't think the current behavior is that bad, but a simpler suggestion along the lines of what SB-X is saying might be to have a dialog pop-up after one leaves terrain-editing mode asking the user if he wants to keep the changes to that chunk, and if he chooses "no", then the original is stored. This is probably harder to implement than it sounds though since the originals of any chunks modified in map-editing mode would have to be stored in memory.
Maybe just the warning dialog with a "do not warn me again" checkbox would be the simplest solution.
-Karl
Maybe just the warning dialog with a "do not warn me again" checkbox would be the simplest solution.
-Karl
Re: Floodfill option in Studio?
Oh, and while we're talking about terrain-editing mode, how does one delete objects while in this mode? I tried changing the mode in Studio to Move instead of Paint while Edit Terrain was checked, but I still couldn't highlight and delete any objects.
-Karl
-Karl
Re: Floodfill option in Studio?
Karl: The suggestion for a 'keep changes' is good, and shouldn't be too hard to implement. I might (have to check) already be keeping a backup of the original.
As for deleting: The problem is that 'chunk objects' aren't really stored as objects; each is just an ID # assigned to a tile. So you can 'delete' an object by painting over its tile with another shape. But this should be fixed to it works like you'd expect.
As for deleting: The problem is that 'chunk objects' aren't really stored as objects; each is just an ID # assigned to a tile. So you can 'delete' an object by painting over its tile with another shape. But this should be fixed to it works like you'd expect.