The International Simutrans Forum

 

Author Topic: Computer going to sleep makes vehicles with wait times get stuck  (Read 3709 times)

0 Members and 1 Guest are viewing this topic.

Offline moogal

  • *
  • Posts: 3
  • Languages: EN
Computer going to sleep makes vehicles with wait times get stuck
« on: September 17, 2012, 12:13:23 AM »
I've been playing Simutrans for several years now and this bug has been present in all the versions since the vehicle wait time option was added. I've experienced it both on the Mac and latest Windows versions. I'm using pak128, not sure if it happens with pak64.

Basically if I play Simutrans on my laptop and leave the game running when the computer goes to sleep, any vehicle which has a "month wait time" set and is currently waiting on that instruction, will not time out. This means if they are at a stop where there are very few/no goods/passengers generated, they will sit there for much longer than intended, and show up as "stucked" in the vehicle list.

If the game is paused when the computer goes to sleep, this does not happen.
« Last Edit: September 17, 2012, 04:44:44 AM by IgorEliezer »

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 5418
  • Languages: EN, NO
Re: Computer going to sleep makes vehicles with wait times get stuck
« Reply #1 on: September 17, 2012, 04:48:59 AM »
A different aspect here is whether Simutrans should allow the computer to go to sleep when running in the first place. If I intentionally let Simutrans run unattended, it's probably because I want it to run for a while and I wouldn't want it to fall asleep. On the other hand, if Simutrans was left running alone unintentionally on a laptop, Simutrans would drain the battery until hibernation kicks in. (I don't think Simutrans should try to pervent hibernation.)

Offline Roads

  • Devotees (Inactive)
  • *
  • Posts: 645
Re: Computer going to sleep makes vehicles with wait times get stuck
« Reply #2 on: September 17, 2012, 05:17:12 AM »
One of the first things I do when I get a new computer is turn off the sleep thingy.  I have no use for that capability at all...no idea how others use it.

Offline kierongreen

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 2256
Re: Computer going to sleep makes vehicles with wait times get stuck
« Reply #3 on: September 17, 2012, 05:38:24 AM »
"month wait time" is part of simutrans experimental I thought?

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 5418
  • Languages: EN, NO
Re: Computer going to sleep makes vehicles with wait times get stuck
« Reply #4 on: September 17, 2012, 02:49:20 PM »
"month wait time" is part of simutrans experimental I thought?

No, it has been a feature in standard for quite some time now. It sets a maximum time a convoy will wait for the given load percent.

Offline Roads

  • Devotees (Inactive)
  • *
  • Posts: 645
Re: Computer going to sleep makes vehicles with wait times get stuck
« Reply #5 on: September 17, 2012, 04:37:20 PM »
I am not positive but I can't remember any vehicles in my games leaving the station after a month without the specified load.  I have had vehicles where the print turned yellow for their name if you clicked on the route.  That only happens after a month doesn't it?  I'm talking about pak128.

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 5418
  • Languages: EN, NO
Re: Computer going to sleep makes vehicles with wait times get stuck
« Reply #6 on: September 17, 2012, 04:50:18 PM »
I am not positive but I can't remember any vehicles in my games leaving the station after a month without the specified load.

Most likely because you didn't tell them to. And it's not necessarily after a month. It could be half a month, a quarter of a month, 128th of a month, etc.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9353
  • Languages: De,EN,JP
Re: Computer going to sleep makes vehicles with wait times get stuck
« Reply #7 on: September 17, 2012, 04:51:39 PM »
This indicates that the time (ms since last reboot) does have the wrong value. This is rather a bug of the OS. But thanks for notification.

Offline greenling

  • Lounger
  • *
  • Posts: 1728
  • Simutransarchology it my hobby!
  • Languages: DE,EN
Re: Computer going to sleep makes vehicles with wait times get stuck
« Reply #8 on: September 17, 2012, 05:22:08 PM »
That problem that moogal find cam out windows.
In Windows 7 make the energy option often after new installing problems.
That have i  self a life.



Offline Roads

  • Devotees (Inactive)
  • *
  • Posts: 645
Re: Computer going to sleep makes vehicles with wait times get stuck
« Reply #9 on: September 17, 2012, 06:20:37 PM »
Ters, I haven't a clue what you are talking about.  What I'm saying and I may be off in the lower 40 talking about something completely unrelated but...my vehicles leave the station as I direct.  It doesn't matter if I tell them 1/32 or 1 month.  They leave when that time has expired or when the specified load requirement has been met.  If I put 100% load with no expiration time, the vehicle stays at the station until it reaches 100% load regardless of how long that is - it could possibly be years as far as I know.

Offline Fabio

  • Devotee
  • Administrator
  • *
  • Posts: 2898
  • The Pak128 Guy
    • Visit me on Facebook
  • Languages: EN, IT, RO, FR
Re: Computer going to sleep makes vehicles with wait times get stuck
« Reply #10 on: September 17, 2012, 06:23:29 PM »
This indicates that the time (ms since last reboot) does have the wrong value. This is rather a bug of the OS. But thanks for notification.

Could it be fixed e.g. saving ms time every game month and if ms time is smaller than saved, set all variables checking against ms time to the new value + delta?

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 5418
  • Languages: EN, NO
Re: Computer going to sleep makes vehicles with wait times get stuck
« Reply #11 on: September 17, 2012, 06:39:29 PM »
Ters, I haven't a clue what you are talking about.  What I'm saying and I may be off in the lower 40 talking about something completely unrelated but...my vehicles leave the station as I direct.  It doesn't matter if I tell them 1/32 or 1 month.  They leave when that time has expired or when the specified load requirement has been met.  If I put 100% load with no expiration time, the vehicle stays at the station until it reaches 100% load regardless of how long that is - it could possibly be years as far as I know.
Then you know the setting. I just misunderstood and thought that you didn't. I'm not sure what you are writing about in your second post then.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9353
  • Languages: De,EN,JP
Re: Computer going to sleep makes vehicles with wait times get stuck
« Reply #12 on: September 17, 2012, 06:56:10 PM »
Actually that is done, i.e. delta_t <0 should not occur.

Did this happen in fast forward only or?

Offline moogal

  • *
  • Posts: 3
  • Languages: EN
Re: Computer going to sleep makes vehicles with wait times get stuck
« Reply #13 on: September 17, 2012, 07:35:27 PM »
I haven't tried it in Fast Forward mode, but it certainly does it in normal speed.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9353
  • Languages: De,EN,JP
Re: Computer going to sleep makes vehicles with wait times get stuck
« Reply #14 on: September 17, 2012, 08:35:41 PM »
Because in normal speed more than one place actually check for negative delta_t s ... Hmm ???

EDIT: I added some code, which may fix it. Please test with the next nightly.
« Last Edit: September 17, 2012, 08:48:03 PM by prissi »

Offline Roads

  • Devotees (Inactive)
  • *
  • Posts: 645
Re: Computer going to sleep makes vehicles with wait times get stuck
« Reply #15 on: September 17, 2012, 09:48:21 PM »
I am understanding only part of what is being said here but the bottom line is...I like how it works now and hope it does not change.  Sometimes, especially in cases with ships, which may need a long time to load because the only capacity ship you can buy is very large.  I offer the steel ship available in 1930 as an example.  I believe its capacity is 800 whereas the largest bulk truck is 6.  Both passengers and mail sometimes need to wait for a long time if the game engine is going through one of its spells of switching passenger/mail destinations from one location to another.

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 5418
  • Languages: EN, NO
Re: Computer going to sleep makes vehicles with wait times get stuck
« Reply #16 on: September 18, 2012, 05:38:11 AM »
I am understanding only part of what is being said here but the bottom line is...I like how it works now and hope it does not change.  Sometimes, especially in cases with ships, which may need a long time to load because the only capacity ship you can buy is very large.  I offer the steel ship available in 1930 as an example.  I believe its capacity is 800 whereas the largest bulk truck is 6.  Both passengers and mail sometimes need to wait for a long time if the game engine is going through one of its spells of switching passenger/mail destinations from one location to another.
Nothing is changing, except that something that normally works needs to work all the time.

Offline Roads

  • Devotees (Inactive)
  • *
  • Posts: 645
Re: Computer going to sleep makes vehicles with wait times get stuck
« Reply #17 on: September 18, 2012, 09:46:17 AM »
Thanks Ters and I was wrong about the steel ship.  Its capacity is 500.