Any tricks to bring my pawn physics time down?

In my game, when you give an order to your army, you could move about 100 pawns at the same time. This slows down the game considerably. The GameplayProfiler shows that by far the largest amount of time is being spent on Pawn Physics Time, which consists of Single Line Checks and Move Actor Time.

The pawns’ physics are set to PHYS_Walking. I don’t actually need any of the pawns to collide with each other or with any triggers. I don’t need to know if they enter a physics volume or anything. I only need them to be able to respond to Controller.MoveTo(), and I guess, to stay stuck to the floor. I tried setting their physics to PHYS_None, which makes the game run faster, but then the pawns won’t move. Is there anything you know of that I can do to simplify the pawns’ physics?

I have a game which can have around 90 AI in game that behave individually, ubout 60 of those can be commanded by players.

If you try and kick off a single command to all at once you are bound to hit trouble, I found you need to stagger things slightly. I use the sleep at various points in the controller which is randomised to give a better feel. I use this in targeting enemy and movement commands so they all don’t try and action a command at the same time.

So instead of trying to move 100 at once why not split the AI it into smaller groups of say 25 where the command is staggered by a few seconds, this will help ease the burden on the CPU, sometimes you have to adjust gameplay to match technology expectations. I assume you are ordering a large group of 100 soldiers to march off at the same time, without seeing your game I’ll make an assumption here that by having 4 smaller groups march off a few seconds apart will not detract from the game …

Thanks for the suggestion Yummy. A few seconds apart might be a bit too much but maybe there’s something else I could do, like let one group move for a few ticks, then let the other group move.

Perhaps using “move(delta)” or “movesmooth(delta)” you can move the pawns in PHYS_none. Not tried yet. Certanly the pawns are much slower when they are in a moveto execution.

^^ that would depend on whether or not he’s using pathfinding
aside that he’ll still need to ground those pawns to the floor so he’ll at least need one manual trace per tick per actor

btw you could try PHYS_Interpolating instead of PHYS_None. I still don’t think they will move, but worth a shot I guess

Thanks Cobalt and Chosker. I’ll give those a try and get back to you. Maybe I’ll have to come up with something on my own that turns off physics but still moves some interpolated distance, while staying at ground level. I was reluctant to try that though because as I understand it, all of the code activated by PHYS_Walking and MoveTo() is native, and I would have to come up with something pretty simple in UnrealScript to overcome its inherent slowness. Still, I’ll just start with your suggestions and see if something simple can run faster than MoveTo.

Have you considered / ruled out Crowds or some type of hybrid solution?
Crowds don’t work well in a regular 3D game esp MP, but here they might:

Thanks for the input. Unfortunately crowds aren’t going to work for me in this case. However, I was able to get MoveSmooth to move my pawns even in PHYS_None. It took a bit of work to make the movement look natural because the pawns had a tendency to get stuck on the terrain. Basically what I do now is make a delta vector pointing in the desired direction of movement (normalized and multiplied by DeltaTime and the pawns’ GroundSpeed), then look at where that would put the pawn, go up from there and trace vertically down to see where it would intersect the terrain, and use that, plus a little extra Z, and the pawns end up looking a little bit jumpy, but the frame rate stays up and they don’t get stuck on the ground. I also tried putting the ground’s normal into the equation, but that didn’t end up making it look any better.

Edit: I guess I could have dug deeper to see how crowds implement their “conforming to ground,” and copied just that functionality. Maybe I’ll come back to that.