changing time in worldtime component of DaggerfallUnity entity while game is running makes unity freeze

Discuss coding questions, pull requests, and implementation details.
User avatar
Nystul
Posts: 1501
Joined: Mon Mar 23, 2015 8:31 am

changing time in worldtime component of DaggerfallUnity entity while game is running makes unity freeze

Post by Nystul »

Hi Interkarma!

I just realized that changing time in worldtime component of DaggerfallUnity entity while game is running makes unity freeze.

This never happened before and must be caused by some more or less recent changes.
It makes testing the game harder now since one can no longer easily change time.

can you reproduce the freeze or does it work on your system?

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: changing time in worldtime component of DaggerfallUnity entity while game is running makes unity freeze

Post by Interkarma »

Thanks for letting me know! I'll take a look tomorrow when I can.

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: changing time in worldtime component of DaggerfallUnity entity while game is running makes unity freeze

Post by Interkarma »

Edit: Just to confirm, are you editing the time directly from the Inspector panel or changing through code somewhere?

User avatar
Nystul
Posts: 1501
Joined: Mon Mar 23, 2015 8:31 am

Re: changing time in worldtime component of DaggerfallUnity entity while game is running makes unity freeze

Post by Nystul »

i try to change it directly via inspector

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: changing time in worldtime component of DaggerfallUnity entity while game is running makes unity freeze

Post by Interkarma »

I can confirm this one Nystul, although haven't been able to track it down yet. Problem seems to occur when time is set to something below the current time. One of the time-sensitive systems is trying to do a catch-up process or something and going into a very long loop that shuts out rest of game.

To help work around this and return some of the editor functionality, I've removed the ability to edit WorldTime in Inspector and added a "RaiseTimeInSeconds" value instead. This will immediately step forward time by that number of seconds then reset to 0. Raising time doesn't seem to encounter this problem.

I know this isn't perfect, but it should give you the ability to pass time in accurate increments. For example, just set to 3600 to raise time by an hour, 86400 to raise time by a day, 604800 for a week, and so on.

I hope this at least helps you test what you need to for now. I'll take another look at this bug in future.

User avatar
Nystul
Posts: 1501
Joined: Mon Mar 23, 2015 8:31 am

Re: changing time in worldtime component of DaggerfallUnity entity while game is running makes unity freeze

Post by Nystul »

thanks, yeah that is a suitable workaround ;)

User avatar
Hazelnut
Posts: 3015
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: changing time in worldtime component of DaggerfallUnity entity while game is running makes unity freeze

Post by Hazelnut »

Could be some of the time tracking code Allofich added maybe? Just a thought...
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: changing time in worldtime component of DaggerfallUnity entity while game is running makes unity freeze

Post by Interkarma »

Yeah, setting time backwards would probably throw those catch-up loops for a six. I don't mind though, real gameplay is much more important than mucking about with time in editor while game is running. Just being able to advance time in seconds is enough to work around problem and still gives some manual control over progress of time for testers. It just means time can only go forwards during normal play.

User avatar
Nystul
Posts: 1501
Joined: Mon Mar 23, 2015 8:31 am

Re: changing time in worldtime component of DaggerfallUnity entity while game is running makes unity freeze

Post by Nystul »

Interkarma wrote: Wed May 09, 2018 9:57 pm It just means time can only go forwards during normal play.
which is a reasonable decision anyway. otherwise you open pandora's box... or said differently you make the grandfather's paradoxon happen

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: changing time in worldtime component of DaggerfallUnity entity while game is running makes unity freeze

Post by Interkarma »

For sure. The more real game systems that come in, the more time-sensitive they become. I think the current means of just stepping forward time is a pretty good compromise for now, in addition to being able to set timescale from console.

Post Reply