Tribes 2 could. Why cant Torque handle over 100 players?
by Josh Albrecht · in Torque Game Engine · 07/15/2003 (10:05 am) · 27 replies
Maybe I've screwed something up, but from what I've seen, torque cant realistically handle 100 players like tribes 2 could. I made a server, and started adding AIPlayers to it (they dont have any more AI routines than the stuff already in the head)
When I got to 50 bots, the fps was at 14 while I was far away from, and looking away from the bots. If I doubled that number, it would bring my machine to it's knees, and this machine is better than anything that was out when Tribes 2 was released (1800+ processor, 512 mb DDR RAM, GeForce 4 Ti4200 128mb)
I tried using the profiler to figure out what was slowing it down so much, but I couldnt really see the problem. There was obviously considerable time spent in the player update functions (about 8%) but that shouldnt be crippling enough to bring my computer to it's knees, should it?
What am I missing here? Why cant torque handle 100 bots?
When I got to 50 bots, the fps was at 14 while I was far away from, and looking away from the bots. If I doubled that number, it would bring my machine to it's knees, and this machine is better than anything that was out when Tribes 2 was released (1800+ processor, 512 mb DDR RAM, GeForce 4 Ti4200 128mb)
I tried using the profiler to figure out what was slowing it down so much, but I couldnt really see the problem. There was obviously considerable time spent in the player update functions (about 8%) but that shouldnt be crippling enough to bring my computer to it's knees, should it?
What am I missing here? Why cant torque handle 100 bots?
#2
The AIPlayer class has no gameconnection (client) class overhead to worry about, it's basicalyl just a shape that can move around. However, I have not added any kind of pathfinding or thinking routines to these bots (like tribes 2 had), so I should be able to get an equal or greater number of bots than of regular players.
So there has to be another reason...
07/15/2003 (10:42 am)
Yeah, but these bots should take LESS resources than normal players.The AIPlayer class has no gameconnection (client) class overhead to worry about, it's basicalyl just a shape that can move around. However, I have not added any kind of pathfinding or thinking routines to these bots (like tribes 2 had), so I should be able to get an equal or greater number of bots than of regular players.
So there has to be another reason...
#3
07/15/2003 (10:51 am)
Well, the player class IS big and bloated... so it's shapebase.. so It might be bringing your box to it's knees... not sure myself, but I've never seen a Tribes2 game with 100 players on it so I have no idea if it could handle it in practice.
#4
and get all 16 bots in a scene close to each other..
and you will see tribes could not do it either.
they do Not take less than regular player objects..
comment out getAIMove if you want to do that...
now they use close the same resources..
the GameConnection class is not heavy.
so I doubt you can compare that to the getAIMove function.
which Is fairly heavy.
07/15/2003 (10:55 am)
Start up your tribes..and get all 16 bots in a scene close to each other..
and you will see tribes could not do it either.
they do Not take less than regular player objects..
comment out getAIMove if you want to do that...
now they use close the same resources..
the GameConnection class is not heavy.
so I doubt you can compare that to the getAIMove function.
which Is fairly heavy.
#5
Btw, I have played on a game with about 110 ppl on a 128 player server in tribes2. there was probably about 2sec trigger lag on 56k but it was still just about playable, framerate was poor also but still bearable. Having said that, ive only ever done it once, it seems any server larger than 50 is/was rare.
07/15/2003 (10:57 am)
Ah right :( well feel free to ignore me then :) . I see no reason why torque shouldnt be able to handle the numbers when Tribes2 can. Unless your using excessivly high polycounts on the player models with no lod. But im sure you would have thought of that. :-/ sorry for being no help what so ever.Btw, I have played on a game with about 110 ppl on a 128 player server in tribes2. there was probably about 2sec trigger lag on 56k but it was still just about playable, framerate was poor also but still bearable. Having said that, ive only ever done it once, it seems any server larger than 50 is/was rare.
#6
Should being the key word. The CPU you are playing on has to do all the move-queue stuff not to mention the net simulation for all of those bots. And you are playing on that CPU. Just because a bot is standing in one place doesn't mean nothing is happening with it. I don't think a Tribes 2 game could support 100 players if someone was playing on the machine at the same time either. It needs a dedicated server.
07/15/2003 (11:34 am)
Quote:
Yeah, but these bots should take LESS resources than normal players.
Should being the key word. The CPU you are playing on has to do all the move-queue stuff not to mention the net simulation for all of those bots. And you are playing on that CPU. Just because a bot is standing in one place doesn't mean nothing is happening with it. I don't think a Tribes 2 game could support 100 players if someone was playing on the machine at the same time either. It needs a dedicated server.
#7
@Badguy: The getAIMove function is NOT heavy at all. It has one matrix multiplication. Oooh, one big scary multiplication. ;) All the rest is addition and subtraction and some if's.
And your claim that T2 will lag with 16 bots nearby is an unfair comparison, because as I said, they do lots of AI routines, which torque is not doing.
@Mark: No high polycounts, in fact, I'm not even looking at the players, so they arent even being drawn.
@Pat: I think you're probably right. I wonder what the max in T2 was if you were hosting and playing on the same machine...
07/15/2003 (11:38 am)
@Exodus: thanks, I'll check out the player class and see if I can remove any bloat. However, I have seen, and played on, T2 servers with over 100 people, and there wasnt even that much lag or framerate drop.@Badguy: The getAIMove function is NOT heavy at all. It has one matrix multiplication. Oooh, one big scary multiplication. ;) All the rest is addition and subtraction and some if's.
And your claim that T2 will lag with 16 bots nearby is an unfair comparison, because as I said, they do lots of AI routines, which torque is not doing.
@Mark: No high polycounts, in fact, I'm not even looking at the players, so they arent even being drawn.
@Pat: I think you're probably right. I wonder what the max in T2 was if you were hosting and playing on the same machine...
#8
heh so you think getAIMove is not heavy?
maybe you should check the profile on it..
you seem to have missed some integral happening's..
the matrix mult is not such a big deal
and def dont make it a heavy function.
07/15/2003 (12:04 pm)
..heh so you think getAIMove is not heavy?
maybe you should check the profile on it..
you seem to have missed some integral happening's..
the matrix mult is not such a big deal
and def dont make it a heavy function.
#9
07/15/2003 (12:24 pm)
Have to agree with Pat here. The CPU is doing all the trajectory, probability, determination and AI (what little there is) for each bot. That's a lot more than keeping track of where a real player is in the mission. Bots take more resources than normal players. I've hooked up a bot and real player Torque game with some cpu and net profiling on and the same (on the same machine, different time) and profiled a Tribes 2 game with real players. The numbers are similiar as far as Torque vs Tribes (Tribes does have some advantages, probably some IP they put into it that we can't get to) but Bots vs Real always chews up more resources on the CPU side (net is incrementally smaller but nothing to notice as the sim is sending packets back to itself).
#10
07/15/2003 (12:47 pm)
Yes, a Bot is more heavy than a normal player, but what Josh was comparing was a BOT and an AIPlayer, which aren't the same thing. Using AIPlayers you have no net simulation, just another object in the server. Besides, for normal players, the server is still the one that moves it around etc, and the client is updated with it's new position, not viceversa... hence what we know as lag... you move the server corrects you and throws you back or forth depending on what the calculation on the server was. So the server DOES keep track of normal players too, and AIPlayers have no network simulation... so saying this, and AIPlayer should be less cpu intensive than a normal player. SHOULD... I might be missing something here, just my thoughts.
#11
@badguy: It is not computationally expensive. First of all, there isnt an entry with the profiler for getAIMove, you have to add one yourself. I did, and it ends up taking around 0.2 PERCENT of the totall processing cycles. That is not expensive.
@Bil: I agree with Pat too. I just dont see exactly where it gets expensive. Making the moves for the aiplayer takes almost no time, as shown above, and there should not be alot of the networking overhead, because they are not being treated as clients, just objects.
So I guess my real question is: What precisely makes it expensive to have so many bots? I dont see the increase anywhere with the profiler... most time is still taken up by rendering terrain and the GUI, etc.
I know that rendering scenes is computationally expensive, but just doing stuff like trajectory for stationary bots doesnt seem like it should take so much power.
Thanks for the answers so far guys! :)
07/15/2003 (12:59 pm)
@exodus: Actually, I'm comparing AIPlayers with normal clients. And I come to the same conclusion that you do: AIPlayers should be faster or equal.@badguy: It is not computationally expensive. First of all, there isnt an entry with the profiler for getAIMove, you have to add one yourself. I did, and it ends up taking around 0.2 PERCENT of the totall processing cycles. That is not expensive.
@Bil: I agree with Pat too. I just dont see exactly where it gets expensive. Making the moves for the aiplayer takes almost no time, as shown above, and there should not be alot of the networking overhead, because they are not being treated as clients, just objects.
So I guess my real question is: What precisely makes it expensive to have so many bots? I dont see the increase anywhere with the profiler... most time is still taken up by rendering terrain and the GUI, etc.
I know that rendering scenes is computationally expensive, but just doing stuff like trajectory for stationary bots doesnt seem like it should take so much power.
Thanks for the answers so far guys! :)
#12
I've had well over 100 AIPlayers moving around walking waypoints without suffering any major ill effects on P4 1.5 with 512 MB of RAM....
07/15/2003 (3:34 pm)
Josh,I've had well over 100 AIPlayers moving around walking waypoints without suffering any major ill effects on P4 1.5 with 512 MB of RAM....
#13
my wee little PIII 1k with 512 mb
GeForce3 Cannot do that..
Anything over 20 and she starts to buckle.
Real Slide show.
07/15/2003 (4:29 pm)
Wow ..my wee little PIII 1k with 512 mb
GeForce3 Cannot do that..
Anything over 20 and she starts to buckle.
Real Slide show.
#14
07/15/2003 (4:33 pm)
Mmm... I should try it myself and let ya guys know.. though i'm on the only hardware than josh... almost.
#15
Basically, you have to make your AI run over a set of frames, and try and stop any that arent needed. I..e dont "think" at the framerate for a start. Ideally dont do ANYTHING for a long time, but do it over frames and do small bits of it.
So instead of one long decision, make smaller, cheaper decisions that lead up to a bigger one.
Plus stuff like pathing etc needs to be split over frames.
I'm sure you could do 100+ AI players in torque, with a bit of work. And without a stupid fast machine.
Of course it'd require a dedicated server, not a client + server instance.
Phil.
07/15/2003 (4:46 pm)
The AI in tribes 2 was undoubtedly NOT running all the update move stuff EVERY FRAME as the current AI does.Basically, you have to make your AI run over a set of frames, and try and stop any that arent needed. I..e dont "think" at the framerate for a start. Ideally dont do ANYTHING for a long time, but do it over frames and do small bits of it.
So instead of one long decision, make smaller, cheaper decisions that lead up to a bigger one.
Plus stuff like pathing etc needs to be split over frames.
I'm sure you could do 100+ AI players in torque, with a bit of work. And without a stupid fast machine.
Of course it'd require a dedicated server, not a client + server instance.
Phil.
#16
So... Thinking that the problem lay with the number of calculations being performed, I removed the current "ai" and replaced it with my own streamlined version. It didn't make much difference, however, and I still found I was having framerate problems with more than around forty enemies.
Given that at that point in time, I was using simple, single-textured cubes for each bot and that I could have a huge number of such cubes open and on-screen in the show tool, I knew the framerate problem wasn't related to the polygon count of the scene, so I figured it was either the collision or the physics code. I went about messing with, removing, and replacing the code for both to no avail.
Then it occurred to me that the problem might lie in the network code itself and after a little fiddling managed to get more than 200 enemies in the vicinity of the player without much slowdown (though they weren't particularly accurate when compared to the server version -- which made shooting them very difficult).
In the end, I wound up re-writing all of shapebase, removing player, and adding an entity object which had minimal network traffic, and then deriving a character object from that which used something similar to the more accurate network of player.
Short of doing something like this, I don't know what you can do. Player objects spam position information pretty much every update and it adds up...
07/15/2003 (5:02 pm)
A few months back, I was messing around with having large numbers of enemies on the server with the players. I tried the current head at the time and found that with more than forty enemies in the vicinity, my machine was bent over and hammered where the sun don't shine (I'm running a 2100XP with 3Gb RAM and a GF4 which has been more than adequate for any other game I've played).So... Thinking that the problem lay with the number of calculations being performed, I removed the current "ai" and replaced it with my own streamlined version. It didn't make much difference, however, and I still found I was having framerate problems with more than around forty enemies.
Given that at that point in time, I was using simple, single-textured cubes for each bot and that I could have a huge number of such cubes open and on-screen in the show tool, I knew the framerate problem wasn't related to the polygon count of the scene, so I figured it was either the collision or the physics code. I went about messing with, removing, and replacing the code for both to no avail.
Then it occurred to me that the problem might lie in the network code itself and after a little fiddling managed to get more than 200 enemies in the vicinity of the player without much slowdown (though they weren't particularly accurate when compared to the server version -- which made shooting them very difficult).
In the end, I wound up re-writing all of shapebase, removing player, and adding an entity object which had minimal network traffic, and then deriving a character object from that which used something similar to the more accurate network of player.
Short of doing something like this, I don't know what you can do. Player objects spam position information pretty much every update and it adds up...
#17
07/15/2003 (5:03 pm)
Quote:That must have been a huge undertaking but it is definatly something which needs to be done in current Torque. Major respect for having the motivation to do that.
In the end, I wound up re-writing all of shapebase, removing player, and adding an entity object which had minimal network traffic, and then deriving a character object from that which used something similar to the more accurate network of player.
#18
Even if I just add AIPlayers, straight out of the head, my machine, which is better than yours in every respect, is brought to its knees.
Have you changed anything? Can anyone think of a possible explanation for this huge performance difference?
Where you running on a dedicated server?
@Phil: I understand the idea of distributing the AI load and not updating all the time, but right now I'm talking about AIPlayers out of the box so to speak. I've made no modifications to these boys, and they still slow me down incredibly.
@Daniel Eden: I believe that I will do something similar, though hopefully less drastic, sometime in the future. I need much of the functionality of the player class, but there are still many things that need not be there.
07/15/2003 (8:56 pm)
@J. Donavan Stanley: How!? This is precisely what I want to know!Even if I just add AIPlayers, straight out of the head, my machine, which is better than yours in every respect, is brought to its knees.
Have you changed anything? Can anyone think of a possible explanation for this huge performance difference?
Where you running on a dedicated server?
@Phil: I understand the idea of distributing the AI load and not updating all the time, but right now I'm talking about AIPlayers out of the box so to speak. I've made no modifications to these boys, and they still slow me down incredibly.
@Daniel Eden: I believe that I will do something similar, though hopefully less drastic, sometime in the future. I need much of the functionality of the player class, but there are still many things that need not be there.
#19
Have you had the chance to run your test as a dedicated server? I was just wondering if that helped at all. I'm having similar problems with my bots.
Thanks...
John.
07/16/2003 (12:40 pm)
Hi Josh,Have you had the chance to run your test as a dedicated server? I was just wondering if that helped at all. I'm having similar problems with my bots.
Thanks...
John.
#20
07/16/2003 (1:51 pm)
Running on a dedicated server SHOULD help a lot... since it doesn't have to do any rendering neither any client side calculations and stuff... so dedicated servers are the way to go for big games.
Torque Owner Solaris
Bots, Use your computers resources to "think" players are by default controlled by Humans using their own resources to control them. Tribes2 can handle 128 players, the fps will drop drasticly and the ping will rocket sky high, but its possible and even playable. Tribes2 is also limited to 16 bots.