over 4 years ago - /u/Klonan - Direct link

Originally posted by IdoNisso

I might have missed this point, but is this pathfinding algo running for each biter individually? Is it possible to group a bunch of biters coming from the same chunk and give them all the same route (with minor random variations) to improve the performance further?

The biters are typically put into unit groups, and the group pathfinds while the biters just follow the group

over 4 years ago - /u/Klonan - Direct link

Originally posted by ElVuelteroLoco

Two FFFs since i uploaded my Bobs Angels Madclowns Pyanodons +30 science packs Extreme MomoTweak Timelapse.. If i didn't made it to a FFF with that video i guess i never will.. It was my dream.. to being spotlighted by the devs of my favourtite game in their weakly blog. This guy uploads this video 3 days ago a gets to the FFF.. guess mine wasn't anything special, the biggest factory ever, with 1.1 millon bots and +800 trains.. rip dreams

I'm sorry we let you down

over 4 years ago - /u/Klonan - Direct link

Originally posted by hapes

I don't do game dev, and I don't do threading (it's all webapp stuff). So, maybe I don't understand something.

One solution that involves threads that I can think of would go something like this (vaguely C#-like syntax):

class biter {

Path path = new Path(currentLoc, targetLoc)

Position currentPosition = new Position(x,y)

private void move() {

if (path != null) {

// Move to first node in path

// delete first node in path

}

}

public class Path {

public Path(Position current, Position target) {

// Create a thread to generate the path

}

}

The biters won't move until the path is generated, and the path will generate on another thread (and theoretically another core). That seems like it might give some optimization.

Of course, there may be (and probably is) some other reason why you can't do this, but since I don't know the codebase, and I'm not a game developer, I'm not aware of what that reason is.

Putting work across more threads isn't really an optimization, and comes with its own massive constraints and difficulties.

We always prefer to look at single thread optimizations and solutions before considering multi-threading, just like we have done with the pathfinding in this case.

The advantage has a few aspects:

  1. It is a much more flexible domain to work within, we can implement novel and effective solutions that wouldn't be easily possible with a threaded solution.

  2. It benefits not only those with lots of spare cores, but all players. This is also a big benefit to budget server runners, where they may only be allocated 1 or 2 cores of a VPS.

  3. If we ever do end up threading the solution, then the single-thread optimizations are then multiplied.