Saving terrain deform and other things

Falagard

05-04-2006 22:13:03

Tuan, I'm curious - Lucky's old map editor used to save deformations automatically as you modified the terrain. I assumed, without looking at the code at the time, that it was just what the PLM2 did behind the scenes.

I figured I'd have to make special workarounds by working on a temporary terrain and then copy over the real terrain when the user clicks save. However, now I've noticed that PLM2 isn't saving as you deform, and saw that it's on your list of todos. Was it ever in there? If not, Lucky must have been doing something that I can't find yet - saving the terrain somehow.

If you are going to implement it, I'd prefer if you had to call Save() manually, and that it didn't just automatically save your deformations on exit.

Also, how would you suggest doing terrain deformation undo/redo? I was thinking I could use the GetAreaHeight function to get the height of terrain for a specific area and save that in memory, then during an undo I'd restore the height values of that area. I may need a function to update a specific area with specific values if it doesn't already exist.

Painting undo/redo is going to be much harder, and is one of the reasons I'm going to have to pick a specific texture mode and only support it.

tuan kuranes

06-04-2006 08:38:31

terrains is saved after deformations, but not after everyone, only on page unload, which can happens because of paging, or app shutdown. Just reloading terrain should do it.
There is that page deformed event I could send so that you can save by yourself, or keep a list of deformed page on client side ?
(which todo is that ?)

Also, how would you suggest doing terrain deformation undo/redo?
Exactly as you said. And there is a setOption that update specific area (don't recall which)

Painting undo/redo is going to be much harder,
unless we found a way to make that texturemode "synchronize"

tuan kuranes

06-04-2006 08:46:42

And there is a setOption that update specific area (don't recall which)
Cannot find it neither.
So perhaps I was thinking about a user asking for "erosion", getting actual area height, compare to old, diffing resulting in a brusharray, that will deform terrain exaclty like it should be...
Perhaps Can add a "setHeightArray" that does just that, or one that direclty set height array...

Falagard

06-04-2006 13:48:09

Ah. Well, can we add an option to not save on unload? I want full control over when the terrain is saved, just like you'd expect when in an editing application.

Thanks for the info,

Clay

tuan kuranes

06-04-2006 14:10:16

Well, can we add an option to not save on unload
It's possible. I'll check that asap.

tuan kuranes

06-04-2006 16:58:37

done.

- Added "SaveDeformation" option : prevent/enable deformation filesystem saving .
- Added "SetHeight" : should directly change value on heightmap

Falagard

06-04-2006 20:58:52

Awesome :-D

You rock, thanks.

OvermindDL1

07-04-2006 00:03:45

Perfect, those will come in useful later.