Natural Selection 2 News Update - Optimizing NS2

FlayraFlayra Game Director, Unknown Worlds EntertainmentSan Francisco Join Date: 2002-01-22 Member: 3Posts: 6,821Super Administrators, NS2 Developer, Subnautica Developer admin
Please post comments on the topic Natural Selection 2 News Update - Optimizing NS2 here
Charlie Cleveland
Game Director, Unknown Worlds Entertainment
«1

Comments

  • konatakonata Join Date: 2011-08-24 Member: 118296Posts: 862Members
    edited January 2012
    I'd imagine part of your optimization problems are due to the engine not being fundamentally finished?
    Post edited by Unknown User on
    ~ Konata

    À tellement bien mentir, on finit par se croire
  • RanemanRaneman Join Date: 2010-01-07 Member: 69962Posts: 450Members
    edited January 2012
    People don't get optimization is hard.

    According to some people: this is how optimization goes.

    CODE
    #include <iostream>
    #include "game.h"
    using namespace std;

    int main()
    {
        optimize.Game();
            return 0;
    }
    Post edited by Unknown User on
    Raneman's Curated Maps
    MOST BE LOGGED ONTO STEAM COMMUNITY TO VIEW
  • playerplayer Join Date: 2010-09-12 Member: 73982Posts: 1,677Members
    It's also a matter of getting the timing just right. If you optimize too early things are locked in and you end up having to break it open again later on to add some new things, if you optimize too late you might find some feature you've been spending ages on doesn't actually perform within reasonable parameters and needs to be scrapped entirely and redone in a different way. Optimization certainly doesn't always happen at the end as is often posited, I think Lua is a good example of this, its performance needs to be reviewed early on while major changes can still happen (rewriting the VM per example).
  • ZeikkoZeikko Join Date: 2007-12-16 Member: 63179Posts: 585Members, Squad Five Blue, NS2 Map Tester
    QUOTE (player @ Jan 11 2012, 01:41 AM) »
    It's also a matter of getting the timing just right. If you optimize too early things are locked in and you end up having to break it open again later on to add some new things, if you optimize too late you might find some feature you've been spending ages on doesn't actually perform within reasonable parameters and needs to be scrapped entirely and redone in a different way. Optimization certainly doesn't always happen at the end as is often posited, I think Lua is a good example of this, its performance needs to be reviewed early on while major changes can still happen (rewriting the VM per example).

    +1

    Optimising is an ongoing process where timing is crucial. One needs to monitor and profile all the time and act on the right time.
    Many optimising tasks have not been able to be done earlier because it has not been the correct time. It is just not worth it to spend days optimising stuff that can not be surely incorporated in the final product.
  • exoityexoity Join Date: 2003-03-17 Member: 14620Posts: 608Members, NS1 Playtester, Constellation
    I know that in the video you mentioned using an in game profiler, but do you happen to use any other optimization software such as vtune? Or perhaps even any static code analysis to see potential areas for optimization?

    I did enjoy the video, it is also great to see how you are developing NS2.
    NAPT : Former PT-Lead
    Game Developer.
  • SampsonSampson Join Date: 2012-01-06 Member: 139769Posts: 269Members
    i'd prefer at least a 190 test video... or 190 released.
    QUOTE (Lofung @ Nov 16 2012, 12:36 AM) »
    ditto.

  • konatakonata Join Date: 2011-08-24 Member: 118296Posts: 862Members
    QUOTE (Sampson @ Jan 11 2012, 01:59 AM) »
    i'd prefer at least a 190 test video... or 190 released.


    In fairness it is a developer blog and not a game progress blog.
    ~ Konata

    À tellement bien mentir, on finit par se croire
  • Kouji_SanKouji_San Sr. Hινε Uρкεερεг - EUPT Deputy The Netherlands, Hoogezand Join Date: 2003-05-13 Member: 16271Posts: 11,409Forum Admins, Playtest Lead, Forum Moderators, NS2 Playtester, Squad Five Blue mod
    QUOTE (Sampson @ Jan 10 2012, 11:59 PM) »
    i'd prefer at least a 190 test video... or 190 released.

    patience

    Forum Admin "to protect and serve" Admin/Moderator I mostly use a flamethrower tank for disputes... Mostly

    Existence Unknown
    NS2-720p Playlist or on the UWE Forums, last update 11-aug-2012
    NS2: 95x1HP Skulk escapes, latest NS2 Comic #49 GAS: Newton's third law was wrong?

  • konatakonata Join Date: 2011-08-24 Member: 118296Posts: 862Members
    Hey, they renamed Solitaire!?
    ~ Konata

    À tellement bien mentir, on finit par se croire
  • playerplayer Join Date: 2010-09-12 Member: 73982Posts: 1,677Members
    QUOTE
    the British use the term Patience to refer to Solitaire with cards

    You're a disgrace to England.
  • Who is Mike Jones?Who is Mike Jones? Join Date: 2011-10-29 Member: 130080Posts: 69Members
    I thought NS2HD was as official as it gets.
  • KrizzenKrizzen Join Date: 2011-12-16 Member: 138181Posts: 100Members
    I wonder how the devs feel about choosing LUA at this point? It seems the game spends an awful lot of time processing "game" code rather than rendering the scene. Maybe it was a bit of a bad choice, in hindsight?

    Don't get me wrong though: they seem like they can handle it just fine! However, from my experience, interpreted languages that compile into bytecode always appear fantastic on paper and may perform well in specific test cases, but in practice they just don't perform as well as their pre-compiled, compiler-optimized counterparts. Its a tragedy, really, because I adore interpreted languages.

    Regardless, by the time the game is released, most people will have a CPU powerful enough to just rip through all the game code anyway :P
  • NurEinMenschNurEinMensch Join Date: 2003-02-26 Member: 14056Posts: 1,352Members, Constellation
    I'm not sure LUA was a good idea or not. But the benefits of it will for the most part come to bear later, whereas the downsides are more obvious right now. Long term it may have been the right choice.
    This is the kind of thing that goes on behind close doors on normal game releases, where they are optimizing it right up until the end. You guys are just getting to play with a version of the game that normally only the developers see.

    --Cory
  • kingmobkingmob Join Date: 2002-11-01 Member: 3650Posts: 705Members, Constellation
    LUA was a good idea.
    It is used in other game engines.
    plenty of game engines use some sort of scripting.

    It is easy to change and makes changes faster.
    I seem to remember they built hotloading of scripts into their engine.

    that means someone could write code for a feature.
    test it ...realize what they forgot...add it...test that...and then check it in
    this cuts out compiles and game startups from iterating until a feature (or bug fix) is complete.
    Plus they got some GREAT ideas from the community.

    They may choose to move more code into C/C++ land now that they are nearing feature completion.
    But as an overall investment LUA is still worth it.
  • extolloextollo Ping Blip Join Date: 2010-07-16 Member: 72457Posts: 365Members
    QUOTE (kingmob @ Jan 11 2012, 11:15 AM) »
    LUA was a good idea.
    It is used in other game engines.
    plenty of game engines use some sort of scripting.

    It is easy to change and makes changes faster.
    I seem to remember they built hotloading of scripts into their engine.

    that means someone could write code for a feature.
    test it ...realize what they forgot...add it...test that...and then check it in
    this cuts out compiles and game startups from iterating until a feature (or bug fix) is complete.
    Plus they got some GREAT ideas from the community.

    They may choose to move more code into C/C++ land now that they are nearing feature completion.
    But as an overall investment LUA is still worth it.


    I think this as well, though it is sad that they can't leverage luajit due to binding optimization. i was wondering why charlie made the comment about discussions of writing a lua interpreter. there will be more optimization in this space for sure.
  • TweadleTweadle Join Date: 2005-02-03 Member: 39686Posts: 855Members, NS2 Map Tester
    Interesting and informative. Thanks!
  • ScardyBobScardyBob ScardyBob Join Date: 2009-11-25 Member: 69528Posts: 4,983Forum Admins, Forum Moderators, NS2 Playtester, Squad Five Blue, Reinforced - Shadow, WC 2013 - Shadow mod
    QUOTE (NurEinMensch @ Jan 11 2012, 06:43 AM) »
    I'm not sure LUA was a good idea or not. But the benefits of it will for the most part come to bear later, whereas the downsides are more obvious right now. Long term it may have been the right choice.

    True, but they are bearing some of the benefits of going with lua right now.
  • ReeseReese Join Date: 2003-05-08 Member: 16143Posts: 701Members
    Is fixing the luajit integration simply not a possibility? I guess a lot of the decision comes down to how often interpreted lua code is the bottleneck vs. binding code or c++ invoked through lua. Sitting here on the sidelines it seems like there's a good chance you could fix some of the current issues only to find that the lua interpreter is giving you a slightly smaller bottleneck than the bindings.

    That said, great post! It's always fun to watch people try to give accessible explanations of concepts that are difficult to explain to other programmers. From what I can tell you did a good job.
    Needs more cowbell
  • tobias3tobias3 Join Date: 2011-12-19 Member: 138543Posts: 12Members
    QUOTE (konata @ Jan 10 2012, 02:04 PM) »
    I'd imagine part of your optimization problems are due to the engine not being fundamentally finished?


    And that is due to them trying to build a state of the art engine that first used a state of the art culling method (which did not work) and now uses a Frostbite like approach (which still does not work). I personally do not get that arms race with the big league. I do not care about graphics that much. I just want a playable game! Why not go with something a little more proven? I mean it does not have to look like *insert big studio game here*.

  • Kouji_SanKouji_San Sr. Hινε Uρкεερεг - EUPT Deputy The Netherlands, Hoogezand Join Date: 2003-05-13 Member: 16271Posts: 11,409Forum Admins, Playtest Lead, Forum Moderators, NS2 Playtester, Squad Five Blue mod
    QUOTE (tobias3 @ Jan 12 2012, 08:43 PM) »
    And that is due to them trying to build a state of the art engine that first used a state of the art culling method (which did not work) and now uses a Frostbite like approach (which still does not work). I personally do not get that arms race with the big league. I do not care about graphics that much. I just want a playable game! Why not go with something a little more proven? I mean it does not have to look like *insert big studio game here*.

    The graphics rendering in Spark is very fast actually, it is the game code/lua that is holding back performance right now. But they are getting faster with each patch :)


    Being an indie doesn't mean it has to look crappy... It already looks awesome and when other filters are introduced it will be even more awesome!

    Forum Admin "to protect and serve" Admin/Moderator I mostly use a flamethrower tank for disputes... Mostly

    Existence Unknown
    NS2-720p Playlist or on the UWE Forums, last update 11-aug-2012
    NS2: 95x1HP Skulk escapes, latest NS2 Comic #49 GAS: Newton's third law was wrong?

  • HarimauHarimau Join Date: 2007-12-24 Member: 63250Posts: 3,883Members
    @tobias3: Isn't it about making the engine have a decent lifetime, and making it an attractive option for modders (and possibly other companies), and just generally attractive to prospective players? Some of the design decisions are also about making sure they can build the game quickly, with changes appearing on-the-fly.
    Suggestions: ! @ # $ %
  • tobias3tobias3 Join Date: 2011-12-19 Member: 138543Posts: 12Members
    QUOTE (Harimau @ Jan 12 2012, 08:06 PM) »
    @tobias3: Isn't it about making the engine have a decent lifetime, and making it an attractive option for modders (and possibly other companies), and just generally attractive to prospective players? Some of the design decisions are also about making sure they can build the game quickly, with changes appearing on-the-fly.


    So you are saying that engines that need a precomputation (shadow maps, visibility) step like source engine, unreal engine and ID engine do not have a decent lifetime - or that you cannot build a game quickly there?

    Having a sandbox like editor may have its advantages and may be very modern - but the focus should be on delivering something playable and finished. And modders and other companies shouldn't be the focus either.

    Back at the FarCry days I tried to make a mod for the CryTek 1 engine. That engine is similar in that it uses LUA and a sandbox editor. And it was godawful because you could really see that they moved LUA code back into C++ and what was left was an inconsise mess. That does not matter though because they were able to finish the game and deliver.

    Same thing happend here. I think: We need the level designers/game designers to be able to change the game -> Let's do the game part in an easy language that they can learn easily -> level/game designers produce messy, slow lua code -> Programmers have to fix it (costly). Because they like C++ more they move it back there
  • HarimauHarimau Join Date: 2007-12-24 Member: 63250Posts: 3,883Members
    I am saying nothing of the sort. Don't presume to put words in my mouth.

    Now, with regard to decent lifetime, I was referring to the more "modern" features - an engine that is full of outdated technology when it is released is not attractive to modders, developers, or, more importantly, prospective customers either. A scripting "layer" built on top of the engine was one design decision that creates accessibility for modders, and allows for instant changes in-game. The others you know: dynamic lighting, no pre-compiling, etc. More than being marketed towards modders and developers, the decisions were made so that UWE could import, edit and test lots of assets and features in a very quick period of time, without also requiring a very large team. It was UWE's belief that the benefits outweighed the costs, and they still believe they will get it to work. Honestly, this was all explained by UWE the day they announced the decision to switch from Source to the as-yet-unnamed engine that became Spark (and by Max in one of the recent NS2HD interviews), and I'm just regurgitating it for your benefit. Your frustration is misdirected.
    Suggestions: ! @ # $ %
  • tobias3tobias3 Join Date: 2011-12-19 Member: 138543Posts: 12Members
    edited January 2012
    QUOTE (Harimau @ Jan 13 2012, 09:09 AM) »
    I am saying nothing of the sort. Don't presume to put words in my mouth.

    Now, with regard to decent lifetime, I was referring to the more "modern" features - an engine that is full of outdated technology when it is released is not attractive to modders, developers, or, more importantly, prospective customers either. A scripting "layer" built on top of the engine was one design decision that creates accessibility for modders, and allows for instant changes in-game. The others you know: dynamic lighting, no pre-compiling, etc. More than being marketed towards modders and developers, the decisions were made so that UWE could import, edit and test lots of assets and features in a very quick period of time, without also requiring a very large team. It was UWE's belief that the benefits outweighed the costs, and they still believe they will get it to work. Honestly, this was all explained by UWE the day they announced the decision to switch from Source to the as-yet-unnamed engine that became Spark (and by Max in one of the recent NS2HD interviews), and I'm just regurgitating it for your benefit. Your frustration is misdirected.


    Nobody will want to play a game that is not playable because it is unfinished, unpolished and does not run smoothly, regardless how good it is for modders and developers. And modders and developers are not the customers here. They do not pay the bills. Players do not care if UWE can test or import assets, or change the game while it is running. Of course they care about the visuals, but people play TF2 don't they?
    If I remember correctly they switched to Spark also because Source hat some limitations with regard to dynamic lighting and dynamic infestation. We have yet to see dynamic infestation (as shown in the teaser) and I think some maps are not played because dynamic lighting does not perform well.
    If I read "Fixed a networking bug with acknowledging reliable packets" in the changelog then I'm asking myself: Why are they not using a network libary for that. They are wasting time reinventing the wheel here. This goes for the whole engine.

    Don't get me wrong. I don't think the technology decisions are wrong. They just all cost time getting right now. I think that they should concentrate on finishing the game. They are not Valve. They do not have unlimited time. The first teaser announced it for fall 2009! And frankly I'm afraid they are going to run out of money before the game is finished. And I want to play that game!
    Of course it is too late now to revert some decisions. But why, for example, did they add those atmospheric effects? Nobody requested them. Nobody would have missed them. They caused performance problems. They do not add much value to the game.
    Or constantly twiddling on the balancing while nobody can aim, the hit registration does not work, server tick rate goes down in the late game and so on. Get that to work first. Publishing statistics and analysing them is a joke otherwise.
    Post edited by Unknown User on
  • Kouji_SanKouji_San Sr. Hινε Uρкεερεг - EUPT Deputy The Netherlands, Hoogezand Join Date: 2003-05-13 Member: 16271Posts: 11,409Forum Admins, Playtest Lead, Forum Moderators, NS2 Playtester, Squad Five Blue mod
    edited January 2012
    From what I heard the atmospherics and AA were very easy and fast to implement and they don't cause performance issues right now, unless you're running it on some kitchen appliance... on my old rig it takes away maybe 1FPS...
    Post edited by Unknown User on

    Forum Admin "to protect and serve" Admin/Moderator I mostly use a flamethrower tank for disputes... Mostly

    Existence Unknown
    NS2-720p Playlist or on the UWE Forums, last update 11-aug-2012
    NS2: 95x1HP Skulk escapes, latest NS2 Comic #49 GAS: Newton's third law was wrong?

  • HarimauHarimau Join Date: 2007-12-24 Member: 63250Posts: 3,883Members
    QUOTE (tobias3 @ Jan 14 2012, 04:21 AM) »
    unfinished

    See above.
    Suggestions: ! @ # $ %
  • NurEinMenschNurEinMensch Join Date: 2003-02-26 Member: 14056Posts: 1,352Members, Constellation
    Half-Life single player ran so-so on my comp back then. Multi player (HL DM) was horribly laggy and choppy. Just saying.
    This is the kind of thing that goes on behind close doors on normal game releases, where they are optimizing it right up until the end. You guys are just getting to play with a version of the game that normally only the developers see.

    --Cory
  • Visor1Visor1 Join Date: 2012-01-13 Member: 140300Posts: 69Members
    after reading through alot of post i've found the following commands that may help to improve your fps

    r_fog 0
    r_shadow 0
    r_bloom 0
    r_atmospherics 0

    r_instancing 0 *not sure what this suppose to do*

    These commands need to be entered every time you change server and even if you change sides. They may not make a huge difference in your base but in combat I notice a big enough boost. Does anyone know how to turn off the marine hud? I'm getting about 5fps higher as an alien and would like to see if it's causing the problem.

    net_stats will display the server preformance, network and fps very helpful in seeing where the problem is
    r_stats shows your fps and other graphics related info
  • Kouji_SanKouji_San Sr. Hινε Uρкεερεг - EUPT Deputy The Netherlands, Hoogezand Join Date: 2003-05-13 Member: 16271Posts: 11,409Forum Admins, Playtest Lead, Forum Moderators, NS2 Playtester, Squad Five Blue mod
    edited February 2012
    r_gui false, but this one turns EVERYTHING off. You could test to see if there is an FPS gain, but I think it could be related to the view model, maybe the marine weapons are higher poly or the Flash elements on the waepons could be a cause.

    The odd thing is though, I don't see any difference in FPS between alien or marine view... Was it because you're in your base mostly so you have to render a lot more onscreen?
    Post edited by Unknown User on

    Forum Admin "to protect and serve" Admin/Moderator I mostly use a flamethrower tank for disputes... Mostly

    Existence Unknown
    NS2-720p Playlist or on the UWE Forums, last update 11-aug-2012
    NS2: 95x1HP Skulk escapes, latest NS2 Comic #49 GAS: Newton's third law was wrong?

  • Visor1Visor1 Join Date: 2012-01-13 Member: 140300Posts: 69Members
    edited February 2012
    QUOTE (Kouji_San @ Feb 7 2012, 03:17 PM) »
    r_gui false, but this one turns EVERYTHING off. You could test to see if there is an FPS gain, but I think it could be related to the view model, maybe the marine weapons are higher poly or the Flash elements on the waepons could be a cause.

    The odd thing is though, I don't see any difference in FPS between alien or marine view... Was it because you're in your base mostly so you have to render a lot more onscreen?


    Na I tested this by joining an empty server had a tick rate of 32 and running around the map. I've never notice a difference before though.

    Just tested with the gui on/off at different points on the map and there is a fps gain by turning it off. I did the test on the new map with the above commands off with net_stats running if anyone else wants to take a look and see if you get the same result.

    I tested removing the gui as an alien and also received a small fps boost. I ran fraps this time with net_stats and noticed a slight fps gain by not having net_stats running (standing still).
    Post edited by Unknown User on
«1
Sign In or Register to comment.