What Does Optimisation Actually Involve?

Discussion in 'Off Topic' started by Djb1990, Jan 31, 2021.

  1. Djb1990

    Djb1990 Active Member

    Joined:
    Sep 1, 2020
    Messages:
    90
    Likes Received:
    123
    To any game programmers out there or perhaps a member of the dovetail team, or anyone with the knowledge - I was just curious as to what the optimisation process actually involved.

    Going from what the team have said about it in streams, it's a LOT of work, but how do you go about it? How do you make a tree or a signal use less memory? Do you need to completely rewrite the code? Or just change the art model?

    Bear in mind, my programming knowledge extends to 'hello, world!', and I have basic html knowledge from my teenage MySpace days, but that's about it. So you'll have to explain it to me like I'm ten, if that's even possible ;P
     
    • Like Like x 3
  2. Clumsy Pacer

    Clumsy Pacer Well-Known Member

    Joined:
    Dec 10, 2016
    Messages:
    2,956
    Likes Received:
    3,935
    Optimisation basically means 'making a piece of software run more efficiently with the end goal of increasing performance for the end user, or making processing time shorter, thereby improving the user experience'.

    This means if you have a simple calculator that just quadruples a given value (I'll call it 'x'), you could set it up to do x+x 4 times. That's not very efficient. You can optimise the program by making it instead do x*4 (* meaning multiply).

    In the context of a game, optimisation could mean, for example, reducing the size of textures, or reducing the number of polygons that make up a particular scenery item, as well as more sophisticated methods of doing stuff (like above, but much more advanced). In extreme cases, it could mean simply having less scenery (maybe have the scenery away from the play area be less detailed, or stop it earlier so it doesn't stretch out so far). It is a fair bit of work, especially on a project as big as TSW, as they have to check it doesn't detract from the gameplay, and doesn't make the game look much worse, and (most importantly) doesn't break anything.

    I hope that makes a bit of sense :)
     
  3. Djb1990

    Djb1990 Active Member

    Joined:
    Sep 1, 2020
    Messages:
    90
    Likes Received:
    123
    Yes thanks. That makes sense. I guess just making a tree slightly less detailed won't make much difference on its own, but do it for every tree on the route and it will result in an improvement in performance, with hopefully very little visual impact
     
  4. Doomotron

    Doomotron Well-Known Member

    Joined:
    Oct 24, 2018
    Messages:
    2,926
    Likes Received:
    3,530
    It could also involve preventing the game from doing things that don't affect the player. On the original Sand Patch Grade, the level crossing would go off even if you were miles away because it was always on, waiting for trains to go by. This, among others, was one of the reasons CSX: Heavy Haul was quite difficult to run compared to other routes.
     
  5. SamTDS

    SamTDS New Member

    Joined:
    Dec 30, 2018
    Messages:
    24
    Likes Received:
    14
    interesting in this case its about the same on the assembly code level, with modern cpu's having dedicated instructions and processing for this. In the most basic assembly code such as LMC you do not have multiply or divide, only addition and subtraction and branches so you have to be clever with how your going to implement them
     
  6. Clumsy Pacer

    Clumsy Pacer Well-Known Member

    Joined:
    Dec 10, 2016
    Messages:
    2,956
    Likes Received:
    3,935
    Yeah. It depends if you're running it on a CISC CPU or a RISC CPU - the former I believe has a specific "multiply" operator (that's from a rather fuzzy memory from college lol)
     
  7. SamTDS

    SamTDS New Member

    Joined:
    Dec 30, 2018
    Messages:
    24
    Likes Received:
    14
    good old computing at college, i spent hours on lmc and never made the multiply as i took up all the memory just converting to binary
     
  8. railway12

    railway12 Well-Known Member

    Joined:
    May 9, 2020
    Messages:
    134
    Likes Received:
    310
    Note: This is pretty straightforward, but still some level is needed.

    1 What does optimisation actually involve? Making your application run more efficient as in looking at memory usage finding memory leaks what causes them and come up with a solution.
    DTG said a while ago that they had some menu components in memory when playing a scenario or service, the option is to use classes and destroy menu elements if playing or delete them and import them again. Another point is making objects dissapear for example when passing stratford delete all objects from St. pancras. And of course the cache (rubbish) should be cleared pretty much all the time for instance by using a garbage collector. Aaand every variable uses memory so go easy or delete unneeded variables. Note that memory can also be transfered from RAM to GPU by doing something called hardware rendering, helpful when RAM is overtax but GPU is undertax.
    2 What does optimisation actually involve? Making your application run more efficient as in putting the code in less lines then previously and use methods which take less time but do the same.
    For examples if blitting (making it visible on screen) strings and integers (variables used as storage) as text use the following methods: f-string or fomat() rather than a+b. Or for multiple if's a for or while loop would be more efficient. And +=, ++ instead of + Note that only CPUs handle speed.

    Besides I might have some mistakes and missspelling going on, nethertheless hope it is readable. Thx for reading.
    Conclusion: It is even worse than fixing bugs, taks a lot of time and may get frustrating when restructuring is needed...
     

Share This Page