Zoning - Local Authorities

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

User avatar
Svip
Engineer
Engineer
Posts: 31
Joined: 11 Nov 2005 10:36
Location: Copenhagen, Denmark

Re: Zoning - Local Authorities

Post 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.
User avatar
NukeBuster
Traffic Manager
Traffic Manager
Posts: 222
Joined: 04 Jan 2006 18:16
Location: Alphen aan den Rijn, The Netherlands
Contact:

Re: Zoning - Local Authorities

Post 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.
NukeBuster

Transport Empire: The Transport Empire Linux effort
Join the Transport Empire IRC channel: [url]irc://irc.oftc.net/transportempire[/url] !

OpenTTD patch(es): Password at join
User avatar
Svip
Engineer
Engineer
Posts: 31
Joined: 11 Nov 2005 10:36
Location: Copenhagen, Denmark

Re: Zoning - Local Authorities

Post 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.
User avatar
athanasios
Tycoon
Tycoon
Posts: 3138
Joined: 23 Jun 2005 00:09
Contact:

Re: Zoning - Local Authorities

Post 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.
http://members.fortunecity.com/gamesart
"If no one is a fool I am also a fool." -The TTD maniac.


I prefer to be contacted through PMs. Thanks.
PhilSophus
Chairman
Chairman
Posts: 776
Joined: 20 Jan 2007 12:08
Location: Germany

Re: Zoning - Local Authorities

Post 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.
"The bigger the island of our knowledge, the longer the shore of our ignorance" - John A. Wheeler, Physicist, 1911-2008
User avatar
Svip
Engineer
Engineer
Posts: 31
Joined: 11 Nov 2005 10:36
Location: Copenhagen, Denmark

Re: Zoning - Local Authorities

Post 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 985 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 990 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 989 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
PhilSophus
Chairman
Chairman
Posts: 776
Joined: 20 Jan 2007 12:08
Location: Germany

Re: Zoning - Local Authorities

Post 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.
"The bigger the island of our knowledge, the longer the shore of our ignorance" - John A. Wheeler, Physicist, 1911-2008
User avatar
Svip
Engineer
Engineer
Posts: 31
Joined: 11 Nov 2005 10:36
Location: Copenhagen, Denmark

Re: Zoning - Local Authorities

Post 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.
Attachments
zoning0.9.1.diff
(15.95 KiB) Downloaded 262 times
innerhighlight.grf
Same grf as on the previous page, adding it again for your comfort of not going back to the previous page.
(6.79 KiB) Downloaded 282 times
PhilSophus
Chairman
Chairman
Posts: 776
Joined: 20 Jan 2007 12:08
Location: Germany

Re: Zoning - Local Authorities

Post 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?
"The bigger the island of our knowledge, the longer the shore of our ignorance" - John A. Wheeler, Physicist, 1911-2008
User avatar
Svip
Engineer
Engineer
Posts: 31
Joined: 11 Nov 2005 10:36
Location: Copenhagen, Denmark

Re: Zoning - Local Authorities

Post 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.
User avatar
Sir A. Boey
Transport Coordinator
Transport Coordinator
Posts: 299
Joined: 17 Nov 2006 17:40
Location: Everywhere and nowhere

Re: Zoning - Local Authorities

Post 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...
Image
_____________# If you believe in it, you can achieve it" # ____________
__________________# Check out My Closed Platform #___________________
PhilSophus
Chairman
Chairman
Posts: 776
Joined: 20 Jan 2007 12:08
Location: Germany

Re: Zoning - Local Authorities

Post 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.
"The bigger the island of our knowledge, the longer the shore of our ignorance" - John A. Wheeler, Physicist, 1911-2008
User avatar
Svip
Engineer
Engineer
Posts: 31
Joined: 11 Nov 2005 10:36
Location: Copenhagen, Denmark

Re: Zoning - Local Authorities

Post 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
User avatar
Svip
Engineer
Engineer
Posts: 31
Joined: 11 Nov 2005 10:36
Location: Copenhagen, Denmark

Re: Zoning - Local Authorities

Post by Svip »

OMG, he is double posting! BURN HIM!

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

Image
User avatar
XeryusTC
Tycoon
Tycoon
Posts: 15415
Joined: 02 May 2005 11:05
Skype: XeryusTC
Location: localhost

Re: Zoning - Local Authorities

Post by XeryusTC »

You're breaking the table, and using an external host. Please use the attachment feature, it is there with a reason.
Don't panic - My YouTube channel - Follow me on twitter (@XeryusTC) - Play Tribes: Ascend - Tired of Dropbox? Try SpiderOak (use this link and we both get 1GB extra space)
Image
OpenTTD: manual #openttdcoop: blog | wiki | public server | NewGRF pack | DevZone
Image Image Image Image Image Image Image
User avatar
Svip
Engineer
Engineer
Posts: 31
Joined: 11 Nov 2005 10:36
Location: Copenhagen, Denmark

Re: Zoning - Local Authorities

Post by Svip »

Now I am also implementing legend in the zoning toolbar, as you can see, I might extend its width as well ;o
Attachments
Little Trarnley Transport, 8th Jan 1930.png
Little Trarnley Transport, 8th Jan 1930.png (204.02 KiB) Viewed 1019 times
PhilSophus
Chairman
Chairman
Posts: 776
Joined: 20 Jan 2007 12:08
Location: Germany

Re: Zoning - Local Authorities

Post 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.
"The bigger the island of our knowledge, the longer the shore of our ignorance" - John A. Wheeler, Physicist, 1911-2008
richk67
Tycoon
Tycoon
Posts: 2363
Joined: 05 Jun 2003 16:21
Location: Up North
Contact:

Re: Zoning - Local Authorities

Post by richk67 »

Yup, my irregular airports feature would also benefit from a cached & more complex catchment area calculation.
OTTD NewGRF_ports. Add an airport design via newgrf.Superceded by Yexo's NewGrf Airports 2
Want to organise your trains? Try Routemarkers.
--- ==== --- === --- === ---
Firework Photography
User avatar
Svip
Engineer
Engineer
Posts: 31
Joined: 11 Nov 2005 10:36
Location: Copenhagen, Denmark

Re: Zoning - Local Authorities

Post 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.
Skyruner2
Engineer
Engineer
Posts: 21
Joined: 25 Dec 2003 18:41

Re: Zoning - Local Authorities

Post 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 )
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 22 guests