• Optimizing props clientside and serverside
    6 replies, posted
I'm looking for a way to spawn props that would be optimized and cause the least slowdown for: • players that are looking at the props; • the server (during spawning and after being spawned). [B]The properties that the props should exhibit are the following:[/B] • Unmovable by physgun; • Impossible to shoot with the toolgun; • No collisions - should not collide with players, props or the world; • Possible to color and materialize in code; • Possible to be seen by players that have connected not only [I]before[/I] prop creation, but also [I]after[/I]. This is what I am doing so far: [lua] local ent = ents.Create( "prop_physics" ) ent:SetModel(modelPath) ent:DrawShadow(false) ent:Spawn() ent:SetSolid( SOLID_NONE ); ent:SetMoveType( MOVETYPE_NONE ) ent:SetNotSolid( true ); [/lua] The reference I used for the properties a 'ghosted' entity would be given can be found HERE: [url]https://github.com/garrynewman/garrysmod/blob/master/garrysmod/gamemodes/sandbox/entities/weapons/gmod_tool/ghostentity.lua#L38-L42[/url] [B]My questions:[/B] 1. Are there any other properties that can be set on an entity that would improve performance? 2. Concerning the code I mentioned above, do the following two lines do the same? If so, is one of them redundant and can be removed? [code]ent:SetSolid( SOLID_NONE );[/code] and [code]ent:SetNotSolid( true );[/code] 3. Would it be possible to restrict toolgun usage on the props to specific groups on the server? Ideally I would leave administrators the ability to remove the props created by players.
Why would you want to optimise props?
[QUOTE=Netheous;48039727]Why would you want to optimise props?[/QUOTE] I'm making a tool that would allow players to spawn these 'special' props and wouldn't affect their prop count in case there is a prop limit. Even though I will implement a limit of how many of these 'special' props a player can spawn, I still believe that if a large amount of them is spawned it may have a detrimental effect on the server/player performance. Therefore, I want to optimize them as much as possible.
[QUOTE=DevKin;48039761]I'm making a tool that would allow players to spawn these 'special' props and wouldn't affect their prop count in case there is a prop limit. Even though I will implement a limit of how many of these 'special' props a player can spawn, I still believe that if a large amount of them is spawned it may have a detrimental effect on the server/player performance. Therefore, I want to optimize them as much as possible.[/QUOTE] Disabling shadows and such won't optimize it serverside, since server is not the one that does rendering.
[QUOTE=Netheous;48039771]Disabling shadows and such won't optimize it serverside, since server is not the one that does rendering.[/QUOTE] Fair enough. I disabled shadows to optimize it a little bit clientside. Optimization of both serverside and clientside is what I'm after.
[QUOTE=DevKin;48039783]Fair enough. I disabled shadows to optimize it a little bit clientside. Optimization of both serverside and clientside is what I'm after.[/QUOTE] Yeah, but let's think logically about this. If someone has a low end computer and needs more FPS - he most likely turned shadows off already along with other video options such as AA. At this point you aren't doing much more than spawning less functional props that affect the performance in the same way.
[QUOTE=Netheous;48039796]Yeah, but let's think logically about this. If someone has a low end computer and needs more FPS - he most likely already turned shadows off along with other video options such as AA. At this point you aren't doing much more than spawning less functional props that affect the performance in the same way.[/QUOTE] Point taken. I could leave this as a server-side configurable option for whoever wants to use the tool. Thing is, keeping shadows on the props is not a functional requirement for this tool. The reason I disabled them is because having many props stacked together with their shadows colliding has caused me quite a bit of performance decrease clientside while testing.
Sorry, you need to Log In to post a reply to this thread.