Page 1 of 3

Advanced Terraform - Drag&Draw (r13116)

Posted: 05 Jan 2008 05:54
by Roujin
More progress: Advanced Terraform - Drag and Draw v3.
edit: rediff for r12968
rediff for r13116
Rediff for r12436.

There have been some changes in behavior due to some critical responses I got. Now raise and lower will behave more like the big_raise and big_lower tools in the scedit: This esentially means that a raise operation will NEVER lower a piece of land and a lower operation will NEVER raise a piece of land.
Also, clear tile (= Dynamite) and in scedit placing rocks can now be drawn (holding CTRL, as usual).

complete changelist is here: http://www.tt-forums.net/viewtopic.php? ... 77#p662577

Download:
adv_terraform_dragdraw_v3_r12436.diff
advanced terraform - drag&draw v3 for r12436
(28.8 KiB) Downloaded 695 times
Screenshot (new):
Drag and draw
Drag and draw
terraform.png (45.81 KiB) Viewed 27472 times

---
older post:

Update: Advanced Terraform - Drag and Draw v2.

Now supports rivers! :) (and some stuff fixed)
For complete Changelog see here: http://www.tt-forums.net/viewtopic.php? ... 51#p661651

---
older post:

Okay, it is done. (for now)

I present to you: drag-and-draw terraforming for normal game and scenario editor (when terraform size is set to 1)
A bit sad that no dev has commented on the 2nd step, hope they notice this one now... :?

It includes the changes i did in the "step 2" patch (see below).

What does it do? Hold CTRL while using the lower, raise or level tool to "draw" the selected terraforming mode in the landscape.

I personally think that maybe it's even more intuitive to switch the behaviors (this new one without CTRL and the area select with CTRL pressed). If I recieve positive feedback, I might add another version with it switched.

oh, and, feedback is very welcome :)


older post:
---
Step 2 updated to revision 11861.



It does several useful things:
- enables area_terraform in scenario editor when brush size is set to 1
- adds a an error string "Can't level land here..." (1st part)
- adds a an error string "Already flat" (2nd part)
- levelling now uses the Terraform command callback like raising and lowering (this also affects the played sound; is there any logical reason to have the exploding sound for leveling?)
- modifies the levelling code so that it counts the cost on when money runs out and displays not just the required cost for one tile but the estimated cost for the whole rest
- levelling (and generally all terraform actions) in scenario editor now doesn't make tiles brown anymore

Yep, that's it, i think. Here's the patch. Have a look at it, it should work fine... if not, please post a report.



Oh and by the way, the cost estimation for leveling (and thus for all area_terraforming) does not work correctly. That is a known bug since long time in trunk. (Won't promise to fix that...)

---

original post:


Okay, I renamed this thread because the patch i'm making somewhat turned in another direction and thus its name will be "Advanced Terraform".

So what is it about? Well, the final outcome should be that in both normal game and scenario editor you can:
- drag and drop an area for lower, level or raise
- drag and draw* an area while holding CTRL for lower, level or raise

* see picture in mikeel's post below


To do this i have made a patch first that moves the scenario editor terraforming stuff from main_gui.cpp over to terraform_gui.cpp (there's even a TODO by Darkvater in there that he'd do this sometime after 0.4.0 ;) )

The second step will be to somewhat unify the scenarioeditor- and normal game terraforming. This includes the area terraform that went into trunk short time ago (but is not available in scenario editor yet).

The third and last step will be to implement the new drag-and-draw function. Can't promise anything on that, but I'll try ;)


So, I hope my restructuring/preparation patch will be committed to trunk soon, so i can build on top of that. It doesn't really change anything (if i haven't screwed up badly :roll: ) and since it only moves the scenario editor stuff, I even doubt it would break any patches.
---
update:

Okay, the first step is finished and was added to trunk. Also, some stuff was moved to the newly created terraform_cmd.cpp by Rubidium. This makes stuff more structured and nicer to work on :)
Because of the changes my little "Area Terraform in Scenario Editor" hack needs a little update.

Re: Area Terraform for Scenario Editor (r11760)

Posted: 05 Jan 2008 13:20
by mikeel
argh you're too fast :shock:
i posted a suggestion but in the other thread https://www.tt-forums.net/viewtopic.php?p=653500#p653500
it could be possible (and could you be interested to make something similar?

EDIT:
Ok now the link is correct :D
I link also the image explaining what i mean
Image

Re: Area Terraform for Scenario Editor (r11760)

Posted: 05 Jan 2008 19:32
by Roujin
Well your link leads only to the development forum :P

but i read what you wrote there and am thinking about it. To sum it up for other readers here's what he suggested:
mikeel wrote:thanks!
Maybe in the scenario editor would be better another system:
keeping the left button and moving the mouse it raises (or lower) all the points, without clicking each time.
this would be useful to make non-squared terrains
edit: actually i wanted to work on this today, but got distracted by my other patches...
now that my industry station naming patch is somewhat satisfying for now, i can go on with this one next ^^

One thought that i've been having is that, if i manage to implement it, it won't look exactly like your example image because there's no way to move diagonally directly.

---

Anyways, the concept that i have thought of is the following:
iirc the CTRL key is not yet used for terraforming (up, down, level)
So the normal action will be drag and drop to area terraform, like it is now for all three terraforming modes.
When holding CTRL, this changes to drag and drop to draw (like in your image) also for all three modes.

This can be made avaliable for both Scenario Editor and normal game then.

(edit: thinking about it, it might be more intuitive the other way around - no CTRL for drawing, CTRL for area; that might just make the people angry who are used to the controls how they are now. Well, that is a minor issue and could be solved with a patch option, once the stuff is all done)


Don't expect results too soon though, first some code restructuring/cleanup will be necessary before i can think of properly implementing it.

Re: Advanced Terraform

Posted: 06 Jan 2008 09:27
by Roujin
*bump* see first post

I hope that the devs see this soon and accept it into trunk ;)

Re: Area Terraform for Scenario Editor (r11760)

Posted: 06 Jan 2008 10:06
by mikeel
Roujin wrote: (edit: thinking about it, it might be more intuitive the other way around - no CTRL for drawing, CTRL for area; that might just make the people angry who are used to the controls how they are now. Well, that is a minor issue and could be solved with a patch option, once the stuff is all done)
i thought the same thing: is more intuitive.

Re: Advanced Terraform

Posted: 06 Jan 2008 21:49
by Wolf01
what about like roller coaster, where you can set the size of the brush and you can toggle between flat and linked borders by going to negative size

here can be: inreasing the size works with the standard behaviour
reducing the size to negative values (the picture of the grid should be different) allows you to paint the terrain with the brush (more you go negative, bigger you get the brush)

Re: Advanced Terraform

Posted: 07 Jan 2008 00:20
by Roujin
Hm, personally i don't like the idea to going to negative values. It seems so... unprofessional.

But the idea of drag-and-draw with brush size > 1 is noted. Maybe only in scenario editor though.


On behalf of my patch...
The preparation patch is in trunk now, nice. I'm now on the next step, which turns out to be more complicated than expected, since i have noticed that the way the level tool was implemented is a bit...well.. maybe hack-ish from the beginning (sorry at the creator of the level tool for saying this :oops: ).

So i plan to remake this a bit, to fix some things (e.g. correct cost estimation; this has been off for ages now).

Re: Advanced Terraform

Posted: 07 Jan 2008 02:32
by Bilbo
Roujin wrote:i have noticed that the way the level tool was implemented is a bit...well.. maybe hack-ish from the beginning (sorry at the creator of the level tool for saying this :oops: ).

So i plan to remake this a bit, to fix some things (e.g. correct cost estimation; this has been off for ages now).
I stumbled upon this too when I was trying my "Raising max. height to 127" patch. The level (raise/lower land too) tool stopped working correctly on larger land heights unless I increased some constants in it. But then it started to be slow. Well, considering how that piece of code is quite incomprehensible, it may be best to rewrite it from scratch.

Re: Advanced Terraform

Posted: 07 Jan 2008 08:43
by Roujin
Ok, the next step is done. Patch in first post.

What it does:
- enables area_terraform in scenario editor when brush size is set to 1
- adds a string for levelling "Can't level land here..."
- levelling now uses the terraform command callback like raising and lowering (this also affects the played sound; is there any good reason to have the exploding sound for levelling anyways?)
- modifies the levelling code so that it counts the cost on when money runs out and displays not just the required cost for one tile but for the whole rest
- levelling (and generally all terraform actions) in scenario editor now doesn't make tiles brown anymore

Re: Advanced Terraform

Posted: 07 Jan 2008 11:36
by Bilbo
I remember older 45° rotated rectangle clearing / leveling patch:

http://tt-forums.net/viewtopic.php?f=33&t=19311

Basically, it helps when building canyon for diagonal railroad track

Perhaps either merging code from that patch or implementing the idea from it would be also nice enhancement for your patch.

Re: Advanced Terraform

Posted: 09 Jan 2008 15:38
by Roujin
Thanks for the tip Bilbo, i'll see if I can get some use from this ;)


Currently I am waiting for some dev to notice my "step 2" patch and maybe look at it and comment if it's suited for trunk or not and, if not, what the offending points are. ;)

---

One change that might be noticable for the average player is that I define a leveling action that did not change anything because it already has the right level as succeeded. That means a sound will be played.
I did this because the other option (defining such as "failed") would now result in an error message displayed (because I enabled error messages for levelling).
OTOH, i could define it as "failed" again, and introduce a new string "is already flat." to be used as second part of the error message. "Can't level land here... is already flat."

Question is, which of these one is preferred?

---

Edit: okay, seems i did do something wrong in step 2.

Known Bug:
- Cost estimation displays 0 when estimating something one could not afford. done

so i'll have to do another version with this fixed for my "step 2" anyways. Then i'll define a "nothing leveled" action as failed again and introduce a fitting error message. If someone doesn't like it he can still complain and i'll remove it again.

---
edit: posted new version. look in first post.

Re: Advanced Terraform (Step 2; r11861)

Posted: 15 Jan 2008 12:50
by Roujin
updated patch to revision 11861. download in first post.

Re: Advanced Terraform (drag-and-draw; r11874)

Posted: 16 Jan 2008 12:46
by Roujin
It is done :P

I made drag and draw terraforming for both normal game and scenario editor. See first post for download. :)

Re: Advanced Terraform (drag-and-draw; r11874)

Posted: 16 Jan 2008 13:29
by frosch
Roujin wrote:I personally think that maybe it's even more intuitive to switch the behaviors (this new one without CTRL and the area select with CTRL pressed).
I don't think it is more intuitive:
- It would imply to change the behavior of the level-land-tool, where everyone has become used to it's current behaviour.
- IMO rectangular leveling is needed more often (when building stations etc.)
- Dragging always selects a rectangular area all over the game.

Re: Advanced Terraform (drag-and-draw; r11874)

Posted: 16 Jan 2008 13:31
by Bilbo
And what about diagonal leveling? Is it planned to support too in this patch somewhere in the future?

Re: Advanced Terraform (drag-and-draw; r11874)

Posted: 16 Jan 2008 13:53
by FooBar
I'm going to compile this right away. Since I haven't used either feature yet, I should be able to tell what's more intuitive...

Re: Advanced Terraform (drag-and-draw; r11874)

Posted: 16 Jan 2008 14:00
by Roujin
@frosch: yes, the biggest problem with that is that people are used to how it is currently i think.
My argument is that you can do with drag-draw what you can with area select (making a square) but not the other way around (making an individual shape), thus the "mightier" tool (freeform draw) without CTRL, and the "more handy"/"faster" tool (area select) with CTRL.
This is just my idea though, not gonna lay that down on you :roll:


@Bilbo: I didn't plan on merging this with the diagonal levelling one.. Furthermore I already reserve the CTRL for drag-draw, that's what diagonal did aswell, right? But you can draw any shape you want with drag-draw, also a diagonal shape.

Re: Advanced Terraform (drag-and-draw; r11874)

Posted: 16 Jan 2008 14:22
by FooBar
Well, I tried it, and must say that I prefer more advanced features under the ctrl-button. In this case, I think that the 'drag'n'draw' function is more advanced.

This would also keep the behaviour for all three buttons the same.
A single click does what the button image says: 1 up, 1 down or level.
Draging does the same as click, but for a larger area.
Ctrl does something very different. Either draw for the up/down buttons, or (in future) diagonal for level-tool.


Something different: the drag'n'draw tool doesn't behave as I expected.

Currently when I, for example, drag using the '1 up' button, it doesn't do '1 up' for every grid intersection I drag over. It goes '1 up' for the intersection where I start dragging, but for the rest it levels to whatever the new height for the first intersection is.

I'd expect that it would do '1 up' for every tile I dragged over; no levelling involved. A feature like this would allow for the creation of more natural looking mountains. In case you hold the mouse on the same spot when dragging, it would go up, up and up.
And now I think of it, I'd expect such behaviour without having to hold ctrl :wink:

Re: Advanced Terraform (drag-and-draw; r11874)

Posted: 16 Jan 2008 17:04
by NukeBuster
Bilbo wrote:And what about diagonal leveling? Is it planned to support too in this patch somewhere in the future?
I was planning to update the patch I'm supporting later today. I also have an idea to solve the remaining problems.

Re: Advanced Terraform (drag-and-draw; r11874)

Posted: 16 Jan 2008 22:05
by Bilbo
NukeBuster wrote:
Bilbo wrote:And what about diagonal leveling? Is it planned to support too in this patch somewhere in the future?
I was planning to update the patch I'm supporting later today. I also have an idea to solve the remaining problems.
Hmm ... by adding extra button for diagonal levelling?

Also, I spotted one ... imperfection with this patch.

If you see the attachment, you can see three lines. First was done when moving the cursor slowly, second when moving the cursor with normal speed and third when moving the cursor fast when using the "drawing" mode. Seems in one frame I moved the cursor more than one tile, so perhaps it would be better not to rise only the points but to rise the line between the points too, to achieve more consistent results not depending on the speed with which you move the moue cursor while drawing (like paint progams: if you move mouse too fast when drawing, you draw lines, not discrete points)