The International Simutrans Forum

 

Author Topic: Miles per hour  (Read 16118 times)

0 Members and 1 Guest are viewing this topic.

Offline Sarrus pl

  • *
  • Posts: 52
  • Languages: EN, PL
Re: Miles per hour
« Reply #35 on: December 22, 2008, 10:05:26 AM »
I played many games, which has only the imperial metrics. For example, the speed was displayed as mph and I didn't know exactly how fast I drive. I'm used to this, and I still like these games.

Offline Casteele

  • *
  • Posts: 16
Re: Miles per hour
« Reply #36 on: January 17, 2009, 03:23:48 PM »
Personally, I do not think converting to "MPH" alone is such a good idea.. What I think would be a good idea is to simply internationalize the UI the same way it's done for languages. Internally, the game/code/cpu/whatever does not care if 1+1 is in miles or kilometres or martian zilwiks. All the game codes cares about is that 1+1 equals 2, whatever the type of units.

In truth, when I write software that I know is bound for an international market, I follow a few simple rules:

1) All input is converted into "standard units". That is, regardless of the input units, be it imperial or metric, I convert it on input into whatever unit makes the _code_ easier to write and maintain. For example, in financial software, I convert dollars, pounds, yen, etc., into FU's ("financial units"), which are roughly USD$1.00 to 10000000FU (which is large enough that converting back to almost any other world currency won't cause significant rounding errors.)

2) All internal calculations are done in the internal standard units. There are few, if any, conversions done in calculations, IF the internal/standard units are well chosen. Using FU's for example, since FU's are accurate to several decimal places no matter which currency is used for input or output, I generally do not have to worry about any conversions, rounding errors, etc. (For a game like this, though, scaling things like the maps may be a good idea. However, that really is not a "conversion" so much as a "scaling factor", which is not much different to calculate for drawing than it is to calculate the zoom level.)

3) All output is sent to functions which convert the internal standard units into whatever units are specified by the system locale, or a user defined locale, which are then output to the UI.

Doing it this way allows the software to run regardless of locale settings, and if done right, can even allow the user to set up custom conversions.. Image SimuTrans with the Mars pak using [hypothetical] Martian units, or a space pak version where the playing field is many light years of space between star systems.. Much like people have modding other games to their favorite genres. Such a game would have far more appeal to more people!

Of course, this would not be a trivial or minor project as far as code is concerned. It would require a lot of codework, and therefore would need to be an ongoing project. But I think it would be worth it in the long run: Once the input/output routines are in place, and the UI updated, the game becomes infinitely flexible. It might also make maintaining the code much easier, since the I/O conversions free the game engine from needing to worry about many different units--all code can be written using simple internal units that best fit the needs of the code.

Offline Fabio

  • Devotee
  • Administrator
  • *
  • Posts: 2898
  • The Pak128 Guy
    • Visit me on Facebook
  • Languages: EN, IT, RO, FR
Re: Miles per hour
« Reply #37 on: January 17, 2009, 08:16:11 PM »
this sounds interesting...

Offline VS

  • Senior Plumber (Devotee)
  • Devotee
  • *
  • Posts: 4855
  • Vladimír Slávik
    • VS's Simutrans site
  • Languages: CS,EN
Re: Miles per hour
« Reply #38 on: January 17, 2009, 09:34:36 PM »
Then you're welcome to take a shot at it :P

Offline Casteele

  • *
  • Posts: 16
Re: Miles per hour
« Reply #39 on: January 18, 2009, 03:32:48 PM »
I might just do that.. But like the developers, I'd like to know if there's even enough real _interest_ in such a patch before committing my time and effort to it.. or even a better way to go about doing it..

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 18740
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Miles per hour
« Reply #40 on: January 18, 2009, 07:35:45 PM »
I suspect that the interest, if there is any, is likely to come from people who don't currently play Simutrans partly because the units of measurement are unfamiliar - so there's no easy way of assessing the demand, I'm afraid.