Optimization

NeXuSNeXuS US Join Date: 2013-10-13 Member: 188681Members, NS2 Playtester, Reinforced - Silver, Reinforced - Shadow, Subnautica Playtester
edited November 2013 in NS2 General Discussion
It's no secret NS2 is a CPU intensive game, so I started thinking about possible solutions to help optimize the game and make it more friendly to players with lower end PCs. Before I start let me just say, I do not claim to be a game dev nor do I possess EXTENSIVE knowledge of game design but I feel confident I know enough that I could possibly help. If I am incorrect about some of these things, please feel free to correct me as I am not afraid of constructive critisism

One thing my college professor drilled in our heads while learning UDK was optimization. A simple way to optimize a map is to not render any materials that will NOT be seen by the player. This will not only decrease the load on the GPU, but also, on the CPU. I went in to spectate mode just to see what kind of materials were, what I would say, unnecessarily rendered. This just on one map, Docking, and I found a few things within a matter of minutes.


This is a part of the map outside Cafeteria. Large structures being rendered on all sides, even sides that will never be seen by an in game player.
Y7hCwnQ.jpg


Here, the top of the fan blade, top part of infestation, and the support beams are rendered.
nVuMlbb.jpg


The roof of Cafeteria is rendered. Even with jetpacks, no player in game will be able to see this texture.
34bhRZr.jpg


From Courtyard, you can see the other side of these structures, so rendering one side is perfectly normal. However, why render the other side? I don't believe any player will see this side in game.
f6bIG0j.jpg


I'll say again, feel free to offer any explanations or thoughts on this. This is just a few things I found on one map. I'm sure I could find a lot more on this map and others as well. But in my opinion, looking for unnecessarily rendered materials is a great way to start optimization this game. I'm sure there are other more advanced ways NS2 could be optimized, but for the sake of this thread, I wanted to keep it simple.

Comments

  • BeigeAlertBeigeAlert Texas Join Date: 2013-08-08 Member: 186657Members, Super Administrators, Forum Admins, NS2 Developer, NS2 Playtester, Squad Five Blue, Squad Five Silver, NS2 Map Tester, Reinforced - Diamond, Reinforced - Shadow, Subnautica Playtester, Pistachionauts
    Those few visible faces won't have a noticeable impact on the game. I think the biggest performance hit on the game is the fact that it's all written in Lua, an interpreted language. Great for modding... not so great for performance. :(
  • The_Welsh_WizardThe_Welsh_Wizard Join Date: 2013-09-10 Member: 188101Members, Reinforced - Supporter
    omg proto lab with a0w0 noob comm.

    Don't you see in spectator mode the whole map anyway?
  • KamamuraKamamura Join Date: 2013-03-06 Member: 183736Members, Reinforced - Gold
    I have not a deep knowledge of this particular engine, but generally speaking, 3D engines use a feature called Z-culling that ensures that obstructed surfaces are not rendered at all. See the relevant paragraph in the following article:

    http://en.wikipedia.org/wiki/Z-buffering
  • RapGodRapGod Not entirely sure... Join Date: 2013-11-12 Member: 189322Members
    just... decrease precacheing timeeeeeeeeee
  • NeXuSNeXuS US Join Date: 2013-10-13 Member: 188681Members, NS2 Playtester, Reinforced - Silver, Reinforced - Shadow, Subnautica Playtester
    edited November 2013
    Like I said, I could be wrong. But with the issues some players have, I just thought I would see what others thought. Everything I showed may not be rendered until you look at them (portal). I just wanted to see what others thought.
  • IeptBarakatIeptBarakat The most difficult name to speak ingame. Join Date: 2009-07-10 Member: 68107Members, Constellation, NS2 Playtester, Squad Five Blue, NS2 Map Tester, Reinforced - Diamond, Reinforced - Shadow
    edited November 2013
    Most of these are props, so in order to optimize them they would have to make new versions of each prop just for that one area.

    It's not really cost effective at that point.

    Plus add the fact that skulks, lerks, and jetpacks can look outside from all angles of the map, so naturally they would need to cover some areas that would normally be unnoticed by a standard fps game.

    pZv4r6Dl.jpg

    You can totally see the roof.
  • NeXuSNeXuS US Join Date: 2013-10-13 Member: 188681Members, NS2 Playtester, Reinforced - Silver, Reinforced - Shadow, Subnautica Playtester
    edited November 2013
    Most of these are props, so in order to optimize them they would have to make new versions of each prop just for that one area.
    You can totally see the roof.

    Ok. Well, I messed up with this one then. lol
  • DestherDesther Join Date: 2012-10-31 Member: 165195Members
    Kamamura is correct. If you don't see it it's not being rendered. You can test this yourself at any time by looking at the floor or wall in a room. The FPS will immediately jump up despite the fact that your position didn't change at all. You can type in r_stats in the console to look at how many triangles (vertices) are being rendered. It'll show the number dip down drastically if you remove any models from your field of view. Those models stay in memory and are then rendered as soon as needed when they do enter view, but keeping things in memory doesn't cause any performance dips.

    Furthermore the game definitely has more of a CPU bottleneck as a result of all the in-game mechanics being written in LUA.

    You have to determine whether or not you can see an object in order to make this optimization, and that's a CPU cost in NS2. You can remove triangles that face away from the camera on the GPU but the whole object is still prepared and given to the GPU.
  • SamusDroidSamusDroid Colorado Join Date: 2013-05-13 Member: 185219Members, Forum Moderators, NS2 Developer, NS2 Playtester, Squad Five Gold, Subnautica Playtester, NS2 Community Developer, Pistachionauts
    edited November 2013
    Decrease precaching time> people complain about hitches.
    Increase precaching time, less hitches> people complain about loading times.
    BUT, those checker boards really need to be hidden from view...
  • persoperso Join Date: 2003-02-19 Member: 13740Members, WC 2013 - Supporter
    To see what is rendered by the engine, turn on the wireframe mode by typing "r_wireframe true" (without quotes) in the console. The engine uses mapper placed occlusion geometry (layer OcclusionGeometry if you open the map in editor) as cues for calculating what should be drawn and what not. (https://forums.unknownworlds.com/discussion/132211/what-does-occlusion-geometry-actually-do)

    List of console commands in ns2 wiki: http://wiki.unknownworlds.com/ns2/Console_Commands
  • Cannon_FodderAUSCannon_FodderAUS Brisbane, AU Join Date: 2013-06-23 Member: 185664Members, Squad Five Blue, Squad Five Silver, Reinforced - Shadow
    ZM_Reaper wrote: »
    Most of these are props, so in order to optimize them they would have to make new versions of each prop just for that one area.
    You can totally see the roof.

    Ok. Well, I messed up with this one then. lol

    Hey ZM_Reaper, don't worry about it. Its guys like you (and others) that make this the most community contributed game. We are thinking about things to improve it, and no one should feel bad about that. Keep it up.
  • cooliticcoolitic Right behind you Join Date: 2013-04-02 Member: 184609Members
    edited November 2013
    RapGod wrote: »
    just... decrease precacheing timeeeeeeeeee

    Lol so true.
    BeigeAlert wrote: »
    Those few visible faces won't have a noticeable impact on the game. I think the biggest performance hit on the game is the fact that it's all written in Lua, an interpreted language. Great for modding... not so great for performance. :(

    Yeah that's probably it but I think we can still do better.
    SamusDroid wrote: »
    Decrease precaching time> people complain about hitches.
    Increase precaching time, less hitches> people complain about loading times.
    BUT, those checker boards really need to be hidden from view...

    Then devs should make option? It really depends on your configuration.
  • amoralamoral Join Date: 2013-01-03 Member: 177250Members
    personally infant care about load times as long as in game stuttering is minimized. and I've got a good 3 or 4 minutes of loading if it's the first server im connecting to. I just go grab some water or use the restroom.
  • lwflwf Join Date: 2006-11-03 Member: 58311Members, Constellation
    SamusDroid wrote: »
    Decrease precaching time> people complain about hitches.
    Increase precaching time, less hitches> people complain about loading times.
    BUT, those checker boards really need to be hidden from view...

    Yeah... the chess board can be seen in reflections of the windows all over this and other maps.
  • Ghosthree3Ghosthree3 Join Date: 2010-02-13 Member: 70557Members, Reinforced - Supporter
    edited November 2013
    forums.unknownworlds.com/discussion/comment/2167703/#Comment_2167703

    This is the problem. I don't know how we're going to fix it, but THIS is the issue.

    EDIT: Updated that post again.
  • blindblind Join Date: 2010-04-17 Member: 71437Members, Squad Five Gold
    Precaching time decreased massively for me since I have a SSD.
Sign In or Register to comment.