Page 2 of 4

Posted: 21 May 2007 03:22
by Zojj
Thanks for feedback guys. I've decided to rip % change. I tried your suggestions hertogjan, but graph still sucks. The numbers are so scattered they are useless, even with smooth. BUT if you can make it work I'll be happy to put it back in!

I'm working on cleaning up the code / documenting now.

Posted: 22 May 2007 19:40
by Zojj
Latest ver. Apart from fixing a bunch of stuff, I've added a "maximum yearly income" mode in the cargo payment graph... But I don't like it and will probably scrap it. =)

Does the game use miles or km in the code? It seems like both...

Posted: 22 May 2007 21:26
by CMircea
The game uses miles AFAIK, and gets the km value dividing by 1.6.

Posted: 22 May 2007 22:02
by Zojj
hmm so it uses miles for distance... but speed is in kph?

Code: Select all

const RailVehicleInfo orig_rail_vehicle_info[NUM_TRAIN_ENGINES] = {
	//   image_index  max_speed (kph)      running_cost_base           ai_rank
	//   |  flags     |        power (hp)  |  running_cost_class       |  railtype
	//   |  |    base_cost     |    weight |  |   capacity             |  |
	//   |  |    |    |        |    |      |  |   |  cargo_type        |  |  engclass
	//   |  |    |    |        |    |      |  |   |  |                 |  |  |
	RVI( 2, G,   7,  64,     300,  47,    50, S,  0, 0              ,  1, R, S), //   0
	RVI(19, G,   8,  80,     600,  65,    65, D,  0, 0              ,  4, R, D), //   1
we got some ex-nasa people working on this? =)

Posted: 23 May 2007 18:34
by CMircea
I guess that's how the original TTD did, as Sawyer is from UK, and in UK they use the Imperial system (miles, pounds, mph, etc).

Posted: 23 May 2007 18:53
by Quinnyowns
Actually we use both imperial and metric :) The EU wanted to be entirely metric in a few years time but now that's been revoked we can use miles, gallons, stone, metres, litres and any other combo we like :D

Posted: 23 May 2007 19:03
by hertogjan
Well, the game uses strange units for speeds. Speeds are measured in units of 1/1.6 mph, despite numerous comments that claim it is km/h. The difference is not much, but it may cause speeds to be off by a few km/h. However, internal functions often work in arbitrary units.*
The unit for power is imperial horsepower, which is slightly different to the horsepower(s) as defined on the European continent. The other units (weight, volume and force) seem to be metric however.


*Once a while ago, these were proper km/h, but for some intelligent reasons (which I did not understand) they were changed to 1/1.6 mph units.

Posted: 23 May 2007 20:07
by Zojj
Ok I'll try to figure all this out in the code. Maybe they did it that way because

Code: Select all

  x * 10 >> 4 
is faster than

Code: Select all

  (x << 4) / 10 
Or is it the same with processors today?
Anyways thanks for help!

note: in puerto rico, speed is mph and distance km =)

Posted: 25 May 2007 04:36
by Zojj
Here is a completed version of new graphs! I figured out a good way to make the graphs smooth and accurate. What do yall think of the cargo max income graph?

Much appreciation for anyone who can play around with this patch and find a bug or 2.

Posted: 25 May 2007 10:55
by JamieLei
personally i love it - it looks amazing and no matter what other people were saying earlier, i have a strong preference for the black over the grey

Posted: 25 May 2007 15:29
by Zojj
JameiLei wrote:personally i love it - it looks amazing and no matter what other people were saying earlier, i have a strong preference for the black over the grey
Cool! Glad you like it.


Psistorm wrote: make the "year seperator lines" a bit more visible, I didnt notice they were there until I looked closely
Does anyone else have this problem? They are super visible on my screen.

Posted: 25 May 2007 16:33
by knedle
I can see them without any problems, maybe someone has too dark screen. ;)

Posted: 31 May 2007 22:21
by Zojj
Here it is as a patch option, "better_graphs".

I put the max player history back to 24 quarters. The devs can choose to increase this, if they include this patch in the trunk. I'd like a 100 quarter history. =)

What else does this patch need?

Posted: 01 Jun 2007 05:44
by Zuu
Nice graphs!
Zojj wrote:
XeryusTC wrote:I don't like the black background too much
Born Acorn wrote:Ooh, I like the black background
This will be probably be a patch option. =)
What about something such revolutionary as having the setting, not (only) in the patch-screen but close to where it is used. That chould be a small graph-settings dialogs accessible from the graph-windows.


But perhaps that is too revolutionary and should better be done as a separate patch that provide some generic infrastructure for a such feature.

Posted: 01 Jun 2007 21:25
by Zojj
Zuu wrote:...graph-settings dialogs accessible from the graph-windows
Would this be a button that you would use much? I think that people will pick their favorite graph style and stick with it.

If my graphs are inferior to the originals in any way, making it necessary to switch, please do tell. =)

Posted: 01 Jun 2007 21:34
by Rubidium
Zojj wrote:If my graphs are inferior to the originals in any way, making it necessary to switch, please do tell. =)
It's just that newgrfs authors *might* have chosen to use black as color for the cargo type, which makes them invisible on your graphs...

Posted: 01 Jun 2007 21:45
by Zojj
Rubidium wrote:It's just that newgrfs authors *might* have chosen to use black as color for the cargo type, which makes them invisible on your graphs...
Hadn't thought of newgrf cargos. =)

According to ottd--pallette.gif, the black (or near black) indexes are: 0, 70, 104, 215. What if I make all those display as gray in my graphs? The same gray as the original graph background.

Or do I need to be thinking further into the 32bbp switch?

Posted: 01 Jun 2007 23:29
by Zuu
Zojj wrote:
Zuu wrote:...graph-settings dialogs accessible from the graph-windows
Would this be a button that you would use much? I think that people will pick their favorite graph style and stick with it.
I would probably not use it much, no. And you should probably not spend time to implement it in your patch either.

But at some point patch-settings have to come closer to where they affect things. And the graph-window is a good example of where it can be done in a nice way.

Put it like this, if you open the graph-window, do you then want to open the patch dialog and look thought the list of 20 GUI options (today, and soon they are say 50) too see if there is an option for what you want to do with the graph-window? I have some ideas for how this can be done, but that is out of the scope for your patch, so please continue with your good work and ignore my comments. :)

Posted: 05 Jun 2007 05:15
by Zojj
I put in a fix for newCargos with black legend color. It changes the color to #40 (gray).

Posted: 18 Jun 2007 09:53
by chrissicom
This is great! I hope it's ok that I will post a link to this patch in my modified daylength patch thread. I think this payment graph fits a lot better then the standard graph with the daylength patch. What I did was only changing the graph from days in transit to seconds in transit since that is not a relative value affected by the daylength patch.