Patch: New graphs

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
Zojj
Engineer
Engineer
Posts: 97
Joined: 27 Apr 2007 17:58
Location: Vegas baby
Contact:

Post 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.
I'm on the Zoloft to keep me from killing yall

My patches: Better graphs - Train acceleration - Crash rates
User avatar
Zojj
Engineer
Engineer
Posts: 97
Joined: 27 Apr 2007 17:58
Location: Vegas baby
Contact:

Post 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...
Attachments
new graphs r9897.diff
(64.69 KiB) Downloaded 304 times
I'm on the Zoloft to keep me from killing yall

My patches: Better graphs - Train acceleration - Crash rates
User avatar
CMircea
Chairman
Chairman
Posts: 887
Joined: 29 Dec 2006 14:05

Post by CMircea »

The game uses miles AFAIK, and gets the km value dividing by 1.6.
User avatar
Zojj
Engineer
Engineer
Posts: 97
Joined: 27 Apr 2007 17:58
Location: Vegas baby
Contact:

Post 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? =)
I'm on the Zoloft to keep me from killing yall

My patches: Better graphs - Train acceleration - Crash rates
User avatar
CMircea
Chairman
Chairman
Posts: 887
Joined: 29 Dec 2006 14:05

Post 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).
Quinnyowns
Engineer
Engineer
Posts: 44
Joined: 25 Aug 2005 00:42
Location: Bedfordshire, England.
Contact:

Post 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
lols internets.
hertogjan
Director
Director
Posts: 560
Joined: 03 Jan 2006 20:45
Location: Netherlands

Post 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.
User avatar
Zojj
Engineer
Engineer
Posts: 97
Joined: 27 Apr 2007 17:58
Location: Vegas baby
Contact:

Post 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 =)
I'm on the Zoloft to keep me from killing yall

My patches: Better graphs - Train acceleration - Crash rates
User avatar
Zojj
Engineer
Engineer
Posts: 97
Joined: 27 Apr 2007 17:58
Location: Vegas baby
Contact:

Post 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.
Attachments
new graphs r9915.diff
(73.08 KiB) Downloaded 283 times
Maximum income graph
Maximum income graph
Unnamed, 2nd Apr 2025.png (13.61 KiB) Viewed 8954 times
I'm on the Zoloft to keep me from killing yall

My patches: Better graphs - Train acceleration - Crash rates
User avatar
JamieLei
Tycoon
Tycoon
Posts: 7432
Joined: 10 Jan 2007 18:42
Location: Stratford, London

Post 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
User avatar
Zojj
Engineer
Engineer
Posts: 97
Joined: 27 Apr 2007 17:58
Location: Vegas baby
Contact:

Post 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.
I'm on the Zoloft to keep me from killing yall

My patches: Better graphs - Train acceleration - Crash rates
knedle
Traffic Manager
Traffic Manager
Posts: 158
Joined: 13 Apr 2007 17:07

Post by knedle »

I can see them without any problems, maybe someone has too dark screen. ;)
User avatar
Zojj
Engineer
Engineer
Posts: 97
Joined: 27 Apr 2007 17:58
Location: Vegas baby
Contact:

Post 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?
Attachments
better_graphs_r10002.diff
(52.61 KiB) Downloaded 246 times
I'm on the Zoloft to keep me from killing yall

My patches: Better graphs - Train acceleration - Crash rates
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Post 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.
Attachments
Possible config-button.
Possible config-button.
config.png (12.62 KiB) Viewed 8571 times
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
User avatar
Zojj
Engineer
Engineer
Posts: 97
Joined: 27 Apr 2007 17:58
Location: Vegas baby
Contact:

Post 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. =)
Last edited by Zojj on 01 Jun 2007 21:35, edited 1 time in total.
I'm on the Zoloft to keep me from killing yall

My patches: Better graphs - Train acceleration - Crash rates
Rubidium
OpenTTD Developer
OpenTTD Developer
Posts: 3815
Joined: 09 Feb 2006 19:15

Post 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...
User avatar
Zojj
Engineer
Engineer
Posts: 97
Joined: 27 Apr 2007 17:58
Location: Vegas baby
Contact:

Post 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?
I'm on the Zoloft to keep me from killing yall

My patches: Better graphs - Train acceleration - Crash rates
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Post 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. :)
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
User avatar
Zojj
Engineer
Engineer
Posts: 97
Joined: 27 Apr 2007 17:58
Location: Vegas baby
Contact:

Post by Zojj »

I put in a fix for newCargos with black legend color. It changes the color to #40 (gray).
Attachments
better_graphs_r10040.diff
(52.82 KiB) Downloaded 1241 times
I'm on the Zoloft to keep me from killing yall

My patches: Better graphs - Train acceleration - Crash rates
chrissicom
Route Supervisor
Route Supervisor
Posts: 415
Joined: 07 Oct 2004 10:05

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

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 7 guests