Page 2 of 4

Re: Zoning - Local Authorities

Posted: 27 Aug 2007 22:50
by Svip
Nickman wrote:I don't like the half boxes...

They look broken to me :D.
Not only does they look broken. But it is also confusing, the user would think that the different box means something different. And too add to that, it means I will have to a lot more checking on nearby tiles AND create a lot of new sprites. Which I seriously cannot be bothered with.

No need to slow down the game any further, people.
Nickman wrote:What you could do is only make an outline, so not draw ALL the squares, but only the ones on the outside?
That's not zoning.

Re: Zoning - Local Authorities

Posted: 27 Aug 2007 23:06
by NukeBuster
Svip wrote: EDIT/UPDATE:
Next mission is to add a gui window that would allow you to pick specific things to zone. So you don't have to see the authority zoning while just wanting to see where you can't build. Also allow for other possibilities of zoning, like cost for building a track/road on tiles, rating from cheap to expensive via reasonably.
Perhaps it would be wise to make that a seperate patch, to make inclusion to trunk easier.

Re: Zoning - Local Authorities

Posted: 27 Aug 2007 23:18
by Svip
NukeBuster wrote:
Svip wrote: EDIT/UPDATE:
Next mission is to add a gui window that would allow you to pick specific things to zone. So you don't have to see the authority zoning while just wanting to see where you can't build. Also allow for other possibilities of zoning, like cost for building a track/road on tiles, rating from cheap to expensive via reasonably.
Perhaps it would be wise to make that a seperate patch, to make inclusion to trunk easier.
I don't understand why, as this is clearly part of the patch, and these are just things I'm adding to it. Wait till you see some progress, I think (and hope) you might agree with me. Just starting at university again, so my time to write code and compile isn't as much for the time being. So progress may be slow.

Re: Zoning - Local Authorities

Posted: 28 Aug 2007 01:37
by athanasios
Outline would look confusing. Continue as it is or consider coloring all tile instead of the inside borders if it doesn't slower the game.

Re: Zoning - Local Authorities

Posted: 28 Aug 2007 12:23
by PhilSophus
First of all: I like your patch.

Two small issues I noticed:
  • When the player's rating changes in a town, the tiles are not updated properly. You should invalidate the town's tiles in this case.
  • You can not see the white selection when building drive-through road stops on town-owned roads. I'm not sure where in the code this white square is drawn, but you have to make sure somehow that this happens after you draw the zoning.
I just thought, that the way you are doing the zoning visualization would also be a good thing for showing all own station catchment areas. Especially, as the areas differ for delivering from station to industry/house and the other way round, you need something like your inner and outer squares. If you allow, I would like to prepare a patch based on your patch (unless you're planning this feature anyway).
Probably not before the weekend, though. And I'm also not sure, yet, how to determine, whether a tile is in the catchment of a station in an efficient way. I'm afraid that the straight-forward solutions would eat too much processing power.

Re: Zoning - Local Authorities

Posted: 28 Aug 2007 12:33
by Svip
The update from when the authorities' opinion change is a bit more difficult, however, I have a new update for you.
This image shows the new zoning toolbar.
This image shows the new zoning toolbar.
Fintfingley Transport, 11th Jan 1930.png (214.34 KiB) Viewed 3241 times
Now I have also turned on authority and where I can't build, as you can see, I am using the opposite of what it previously used in the patch.
Now I have also turned on authority and where I can't build, as you can see, I am using the opposite of what it previously used in the patch.
Fintfingley Transport, 17th Jan 1930.png (203.03 KiB) Viewed 3246 times
And to prove it is not biased, it can also select the same type of zoning for both borders. :)
And to prove it is not biased, it can also select the same type of zoning for both borders. :)
Fintfingley Transport, 19th Jan 1930.png (197.97 KiB) Viewed 3245 times
Watch the next post for the diff file, as I can only upload three things in this post.
You can not see the white selection when building drive-through road stops on town-owned roads. I'm not sure where in the code this white square is drawn, but you have to make sure somehow that this happens after you draw the zoning.
Only true if you have outer border turned on for something that covers a lot, like authority zoning. Turning it on as "inner border", you avoid it overlapping the select tiles. That's why I prefer "where I can't build" for outer borders, thus I cannot build there. :P

Re: Zoning - Local Authorities

Posted: 28 Aug 2007 13:02
by PhilSophus
Svip wrote:The update from when the authorities' opinion change is a bit more difficult, however, I have a new update for you.
Have a look at ChangeTownRating() in town_cmd.cpp:2212. That is where the opinion is changed. Still, it is not so easy to find out which tiles to mark dirty as towns can grow out of their radius.
Svip wrote:Only true if you have outer border turned on for something that covers a lot, like authority zoning. Turning it on as "inner border", you avoid it overlapping the select tiles. That's why I prefer "where I can't build" for outer borders, thus I cannot build there.
That feature (selecting what you wanted to see) wasn't there when I posted :P. However, the example you gave is exactly the problem: Town-owned roads are marked red because you normally can not build on them, except for drive-through stops, train crossings and trams. So you really should be able to see the selection even in this case, if it is not to difficult to implement.

Re: Zoning - Local Authorities

Posted: 28 Aug 2007 13:44
by Svip
PhilSophus wrote:
Svip wrote:The update from when the authorities' opinion change is a bit more difficult, however, I have a new update for you.
Have a look at ChangeTownRating() in town_cmd.cpp:2212. That is where the opinion is changed. Still, it is not so easy to find out which tiles to mark dirty as towns can grow out of their radius.
Already fixed that. But I need a more intelligent system, so now it updates upon every town change. Which isn't that good, so that's a todo.
PhilSophus wrote:
Svip wrote:Only true if you have outer border turned on for something that covers a lot, like authority zoning. Turning it on as "inner border", you avoid it overlapping the select tiles. That's why I prefer "where I can't build" for outer borders, thus I cannot build there.
That feature (selecting what you wanted to see) wasn't there when I posted :P. However, the example you gave is exactly the problem: Town-owned roads are marked red because you normally can not build on them, except for drive-through stops, train crossings and trams. So you really should be able to see the selection even in this case, if it is not to difficult to implement.
Yes, I am planning to make the can't build markings more intelligent, as of now it isn't. That is still a work in progress.

But here, you can have the new zoning diff file.

Re: Zoning - Local Authorities

Posted: 31 Aug 2007 08:54
by PhilSophus
It would probably be a good idea to put the newest version of your patch always into the starting post of the thread, so that it is easier to find.

Have you thought of separating just the drawing part of the patch (i.e. essentially the sprite definitions, DrawZoningSprites(), etc.) and bring that to trunk first? This kind of visualization might be quite useful for a lot of things and it would be a nice little patch. And little patches doing only one thing have a bigger chance of making it into trunk fast.

As I said earlier I would like to add the visualization of station catchment areas to your patch, if you allow. Or have you already planned to do so, yourself?

Re: Zoning - Local Authorities

Posted: 31 Aug 2007 13:06
by Svip
PhilSophus wrote:It would probably be a good idea to put the newest version of your patch always into the starting post of the thread, so that it is easier to find.

Have you thought of separating just the drawing part of the patch (i.e. essentially the sprite definitions, DrawZoningSprites(), etc.) and bring that to trunk first? This kind of visualization might be quite useful for a lot of things and it would be a nice little patch. And little patches doing only one thing have a bigger chance of making it into trunk fast.

As I said earlier I would like to add the visualization of station catchment areas to your patch, if you allow. Or have you already planned to do so, yourself?
Well, I sorta had. I am considering the following possible zoning types:
  • Station catchment area zoning.
  • Clear tile approx price (depending on what is on the tile, and how much it would take to clear it, so when you're low on funds, there are places you can steer around of).
  • Ownership zoning (so you can easily see which road tiles your competitors owns and stuff like that).
If you have any more zoning ideas, I'd like to hear them.

And I have a new version of the patch available that makes the "can't build" zoning a lot more intelligent. But as of right now, I have no idea how to figure out which tool is currently selected.

Re: Zoning - Local Authorities

Posted: 31 Aug 2007 14:09
by Sir A. Boey
WOW nice patch and a very good idea...

As I'm testing the One-Way Roads, and the contruction of a kind of Highway
this could really help me to know where I can build what (if you know what I mean).

keep up the good work...

I also asked Chrissicom to implement this in his next ChrisIN which you can find here if that ok by you that is, and if chrissicom is convinced this will benefit the game...

Re: Zoning - Local Authorities

Posted: 31 Aug 2007 16:19
by PhilSophus
Svip wrote:I have no idea how to figure out which tool is currently selected.
Have a look at HandlePlacePushButton() in main_gui.cpp:118 which is called by BuildRoadClick_BusStation() and many other build procedures. Seems that it sets the global variable _place_proc. So you could evaluate that to find out, which placing is currently active.

Re: Zoning - Local Authorities

Posted: 31 Aug 2007 16:42
by Svip
PhilSophus wrote:
Svip wrote:I have no idea how to figure out which tool is currently selected.
Have a look at HandlePlacePushButton() in main_gui.cpp:118 which is called by BuildRoadClick_BusStation() and many other build procedures. Seems that it sets the global variable _place_proc. So you could evaluate that to find out, which placing is currently active.
Yes, but most of the functions it refers to are not described in header files, and thus I cannot do some checking on the function.

EDIT: To avoid the use of making a double post, here is some updates;

I have added some Station Catchment zoning, thanks to the coding of PhilSophus, however, as we have agreed, the coding might need some fixing, but for now it works perfectly fine.

And also a screenshot of the new code in action:

Image

Re: Zoning - Local Authorities

Posted: 02 Sep 2007 21:10
by Svip
OMG, he is double posting! BURN HIM!

New developments: Now working on a good acceptance/producing zoning part:

Image

Re: Zoning - Local Authorities

Posted: 02 Sep 2007 21:49
by XeryusTC
You're breaking the table, and using an external host. Please use the attachment feature, it is there with a reason.

Re: Zoning - Local Authorities

Posted: 03 Sep 2007 16:01
by Svip
Now I am also implementing legend in the zoning toolbar, as you can see, I might extend its width as well ;o

Re: Zoning - Local Authorities

Posted: 03 Sep 2007 16:18
by PhilSophus
Svip wrote:I have added some Station Catchment zoning, thanks to the coding of PhilSophus, however, as we have agreed, the coding might need some fixing, but for now it works perfectly fine.
To make clear what Svip means by that: First, I just took the code for catchment detection out of MoveGoodsToStation, so that the code is duplicated, which is not very nice. Second, the code does quite a lot per tile as it searches the maximum catchment area (which is 21x21 tiles at the moment) for stations. You will notice that when you zoom out with catchment area enabled, scrolling will get very bumpy. The code is just a quick-and-dirty proof-of-concept implementation (I mean my station catchment part, not Svip's patch :D).

I'm working at a better solution. However, it will take some time, as I try to implement a quite generic solution (namely kind of a map cache for extra, map-related data), which the current catchment handling and maybe other parts of the code can benefit from, too.

Re: Zoning - Local Authorities

Posted: 03 Sep 2007 16:32
by richk67
Yup, my irregular airports feature would also benefit from a cached & more complex catchment area calculation.

Re: Zoning - Local Authorities

Posted: 10 Sep 2007 14:52
by Svip
I am bumping this topic for two reasons.

A. I don't want it to die.

B. And I am wondering if there has been any progress on that catchment function, Phil?

C. Also I have been holding a break, as uni is taking its time upon mine... so I'll get back to work soon. But as of now I am a bit baffled by a segmentation fault upon exit. I'll show the output from gdb later.

Re: Zoning - Local Authorities

Posted: 30 Dec 2008 11:38
by Skyruner2
Looks like this Died with the mini In?
Would be great to have it revived ( http://www.tt-forums.net/viewtopic.php?f=32&t=41183 )