Odd Realm

Odd Realm

Skar1ath Jul 23, 2019 @ 12:29am
Speeding up time slows down work
Well, relatively speaking.

I was doing some measurements of experience gain, and I noticed that it seemed to be strongly affected by whether or not I ran the game at maximum speed, or let it run at minimum speed in the background. At max speed, my imps can get 80-90k xp per game day. If I run at normal speed, however, this goes up to 105-115k xp per game day.

I believe the culprit is the AI system - when a unit finishes its current job, it waits before selecting a new one. This is most apparent with units that are hauling - after picking the item up, they pause before taking it back to a storage zone. What seems to be going on is that this delay is not affected by speeding up time - they wait the same amount of time for their AI to update, and if you are running the game faster, this pause effectively becomes longer. For jobs like mining, that frequently switch between individual tasks, as each tile is mined out, the longer delays add up and mean less work is done. Slower jobs like fishing aren't affected nearly as much.
< >
Showing 1-4 of 4 comments
Sleipnir  [developer] Jul 23, 2019 @ 9:00am 
That pause upon starting a job is actually the pathfinding manager trying to calculate a path to the target position. Pathfinding is pretty expensive and, to offset the cpu cost, I delay this calculation at specific intervals. i.e., every 1000 steps, delay one frame. This keeps the pathfinding from having massive noticeable lag spikes. That being said, I'm going to try factoring the game timescale into the intervals that are delayed. That should fix this inconsistency you've noticed.
Skar1ath Jul 23, 2019 @ 12:26pm 
Yeah, that makes sense.

Honestly, I'd be perfectly OK with massive lag spikes if the game is running at high time compression. If speeding things up is toomuch for the CPU to handle, then... don't speed them up.
Skar1ath Jul 23, 2019 @ 9:37pm 
One small follow-up on this, I think the delayed pathfinding also has some detrimental effects on issuing attack orders, especially when fighting on steep hills.

When I send guys out to intercept raiders, often the raiders just run right by them, and then it becomes very hard for the original interceptors to catch up. This isn't too much of an issue with ancients, since any raider armies will get mauled by whatever random void woken happen to be standing around in the base, but it makes it hard to organize fights, unless you know exactly where the raiders are going to go and station defenders there ahead of time.

Would it make sense to force the pathfinding to run immediately when certain orders are issued, such as move and attack? It would make the gameplay more intuitive if units issued an attack order would actually go and attack, rather than scratching their heads for a moment while a party of 20 raiders walks by one tile over and below them and enters the main base.
Sleipnir  [developer] Jul 23, 2019 @ 9:43pm 
Ya, you're right there and I've had plans to create a separate/non-delayed pathing for this. :)
< >
Showing 1-4 of 4 comments
Per page: 1530 50

Date Posted: Jul 23, 2019 @ 12:29am
Posts: 4