|
1 registered members (Grant),
999
guests, and 2
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
machine gun?
#301658
12/12/09 16:08
12/12/09 16:08
|
Joined: Jun 2006
Posts: 2,640 Earth
Germanunkol
OP
Expert
|
OP
Expert
Joined: Jun 2006
Posts: 2,640
Earth
|
It seems that a trace for every shot of a fast machine gun will make the game rather slow. Does anyone know how "professional" games do it? A trace for every 10 shots...?
Or how would you do it?
~"I never let school interfere with my education"~ -Mark Twain
|
|
|
Re: machine gun?
[Re: Germanunkol]
#301660
12/12/09 16:28
12/12/09 16:28
|
Joined: May 2009
Posts: 1,816 at my pc (duh)
darkinferno
Serious User
|
Serious User
Joined: May 2009
Posts: 1,816
at my pc (duh)
|
well... i create a tracer per shot.. but you can probably do random(10)+2 to determine when to spawn a tracer, the speed of which the tracer moeves has alot to do with how it'll look though.. i think games like call of duty create a tracer for like every 8 shots or so...
it shouldnt slow you game down too much... just dont use c_move to move your tracers
Last edited by darkinferno; 12/12/09 16:33.
|
|
|
Re: machine gun?
[Re: darkinferno]
#301679
12/12/09 19:11
12/12/09 19:11
|
Joined: Jul 2007
Posts: 959 nl
flits
User
|
User
Joined: Jul 2007
Posts: 959
nl
|
other thing you can try is make the trace shorter so it scans less entity's
"empty"
|
|
|
Re: machine gun?
[Re: darkinferno]
#301734
12/13/09 14:48
12/13/09 14:48
|
Joined: Jan 2007
Posts: 1,619 Germany
Scorpion
Serious User
|
Serious User
Joined: Jan 2007
Posts: 1,619
Germany
|
c_trace is not as slow as you think, for a machine gun it's just a trace every few frames... You probably can do 100 traces per frame and a normal pc wouldn't slow down too much. Just try it out! edit: ofc the speed of trace execution relies on it's length and the level complexity in this area of the level edit2: did a small test 100 random traces inside a box of 1000³ with 400 boxes inside per frame still give me 60fps
#define vec_randArea(var) vector(var-2*random(var),var-2*random(var),var-2*random(var))
int i;
void main(){
level_load(NULL);
for(i=0;i<400;i++){
ent_create(CUBE_MDL, vec_randArea(1000), NULL);
}
while(1){
for(i=0;i<100;i++){
c_trace(vec_randArea(1000), vec_randArea(1000), NULL);
}
wait(1);
}
}
Last edited by Scorpion; 12/13/09 15:06.
|
|
|
Re: machine gun?
[Re: Redeemer]
#301790
12/14/09 11:51
12/14/09 11:51
|
Joined: Jun 2006
Posts: 2,640 Earth
Germanunkol
OP
Expert
|
OP
Expert
Joined: Jun 2006
Posts: 2,640
Earth
|
wow, lots of answers. Okay, first: I am using c_trace atm. Darkinferno, i don't know what you mean by "tracer"... can you explain? Scoprion, thanks a lot for testing that. I think in my case, the slowing down has to do with level complexity. I don't want to post a screenshot of my level atm, because we're planning to post a big post with infos and videos soon and want it to be a surprise, but we have a loooot of asteroids in the level. All models, all polygon-collision. I would like to put some of the asteroids to box collision or entirely passable if they're outside the ship's weapon range, but the tracing is done serverside atm, for speed and anti-cheating reasons. That means that I have to make the asteroids around every player non-passable, and with the computing that is needed to check the distance of every asteroid every frame to every ship, I think I'm better off not doing it at all.
Redeemer: I do the same atm. Have you tested what happens when 10 players (or bots) fire a machine gun at the same time? Do you trace for every shot? What firing rate does your gun have?
Flits: That is an idea, and I believe it would work, to make the trace shorter, but I can't. if I decrease the weapon range any more, it'll be weird and hard to hit enemies in a space shooter.
~"I never let school interfere with my education"~ -Mark Twain
|
|
|
Re: machine gun?
[Re: Germanunkol]
#301798
12/14/09 12:48
12/14/09 12:48
|
Joined: May 2009
Posts: 1,816 at my pc (duh)
darkinferno
Serious User
|
Serious User
Joined: May 2009
Posts: 1,816
at my pc (duh)
|
oh, sorry germanunkol, i thought you already wrote the code for shooting and was just trying to set up the bullet tracer visual effect that the players would see.. i really dont see why c_trace should slow you game down that much though, especially since the server wont be handling shaders, just shooting and sending positions i assume... in my scion tps demo, here: scion tps gameplay video all weapons are c_trace weapons and notice how many shots you see being done, every bullet fired was a c_trace, and each enemy and player traced to the ground alot to help with movement and it ran very fast though not optimized in any way
Last edited by darkinferno; 12/14/09 17:32.
|
|
|
Re: machine gun?
[Re: darkinferno]
#301848
12/14/09 17:32
12/14/09 17:32
|
Joined: Jun 2006
Posts: 2,640 Earth
Germanunkol
OP
Expert
|
OP
Expert
Joined: Jun 2006
Posts: 2,640
Earth
|
Hm. Okay...
Well, the visual effect pretty much works. It's not perfect, but it'll do for now. It's the c_trace I'm worried about. And really, it doesn't slow down the game to an unplayable state, but it does slow it down from 75 fps if nothing hits to 60 fps if something hits. But if you all say that it's not that slow, maybe I should check if it's the bullet-impact-effects that slow down the game...
~"I never let school interfere with my education"~ -Mark Twain
|
|
|
|