Forum Discussion
9 years ago
Nope, while it seems to help somewhat, the problem still occurs, sorry!
It seems that there is a cap on how much time the game spends on the simulation. Originally, the code looked like this. What the max_time_ms variable does is basically set how long simulating can take. If it takes longer than this, then it would
def update(self, time_slice=True):
max_time_ms = self.MAX_TIME_SLICE_MILLISECONDS if time_slice else None
result = self.sim_timeline.simulate(services.game_clock_service().now(), max_time_ms=max_time_ms)
if not result:
logger.debug('Did not finish processing Sim Timeline. Current element: {}', self.sim_timeline.heap)
result = self.wall_clock_timeline.simulate(services.server_clock_service().now())
if not result:
logger.error('Too many iterations processing wall-clock Timeline. Likely culprit: {}', self.wall_clock_timeline.heap)
I changed it so that I could see what was taking too long. I changed it to this. After running the game on speed 3 on a heavily populated lot, a LOT of interactions got delayed and got logged to a file. The file reached 60KB after a minute!
@injector.inject_to(time_service.TimeService, 'update')
def update(original, self, time_slice=True):
max_time_ms = self.MAX_TIME_SLICE_MILLISECONDS if time_slice else None
result = self.sim_timeline.simulate(services.game_clock_service().now(), max_time_ms=max_time_ms)
if not result:
ScumLog.log('Did not finish processing Sim Timeline. Current element:')
result = self.wall_clock_timeline.simulate(services.server_clock_service().now())
for handle in self.sim_timeline.heap:
if handle is not None:
ScumLog.log(handle);
if not result:
ScumLog.log('Too many iterations processing wall-clock Timeline. Likely culprit: ')
for handle in self.wall_clock_timeline.heap:
if handle is not None:
ScumLog.log(handle)
I saw that a lot of interactions kept being delayed, so out of curiosity, I raised the max_time_ms to a really high number.
@injector.inject_to(time_service.TimeService, 'update')
def update(original, self, time_slice=True):
max_time_ms = self.MAX_TIME_SLICE_MILLISECONDS if time_slice else None
result = self.sim_timeline.simulate(services.game_clock_service().now(), 90000000)
if not result:
ScumLog.log('Did not finish processing Sim Timeline. Current element:')
result = self.wall_clock_timeline.simulate(services.server_clock_service().now())
for handle in self.sim_timeline.heap:
if handle is not None:
ScumLog.log(handle);
if not result:
ScumLog.log('Too many iterations processing wall-clock Timeline. Likely culprit: ')
for handle in self.wall_clock_timeline.heap:
if handle is not None:
ScumLog.log(handle)
Surprisingly, this worked. No interactions were getting delayed any more, as I can tell from the log... which didn't generate at all, so it shows that NO interactions got delayed!
The simulation got a lot more responsive, although this came at a somewhat negligible cost. CPU usage rose from 60% to 70%. Which is not bad at all, honestly.
EDIT: It seems that interactions are still getting delayed... but I believe something else is causing it this time. Let me investigate....
About The Sims 4 Gameplay Questions & Issues
Get help and answers to your gameplay questions and issues in The Sims 4.
944 PostsLatest Activity: 6 hours agoRelated Posts
Recent Discussions
- 6 hours ago
- 8 hours ago
- 10 hours ago
- 11 hours ago