Log in to reply

Is there any advantage of using C++ over C# or VB to make mods?

  • This post is deleted!


    @JustSomeAussie 'Memory manipulation', as Unknown Modder might say. :) Allegedly, C++ is ideal for that. But I have too little experience with it to confirm this.

  • @JustSomeAussie Short answer, yes. The .NET and LUA APIs are just proxies to the underlying C++ API, so naturally they add some amount of overhead. With C++ you have 10x more control over how the code is compiled and you work almost directly with the scripting interface of the game.

  • @JustSomeAussie Otoh beginners don't know how to write performance friendly code anyway and they don't know about proper memory handling. So I'd recommend C#. A .net script just crashes on itself, less likely the whole game and therefore saving us from a sh*tload more complaints about crashes with an unknown cause.

    @meimeiriver said in Is there any advantage of using C++ over C# or VB to make mods?:

    'Memory manipulation'

    And that's something a beginner should avoid as hell (thinking of ACCESS_VIOLATION)!

    @CamxxCore I think that overhead is negligible for the following reasons:

    1. Most methods of shvdn simply provide a user friendly wrap for a native call. You provide the parameters and the method injects them into the native. Makes a few ms at most.
    2. Other shvdn methods provide a convenient way to implement something more complex by wrapping several native calls. It makes life much easier for a programmer and in C++ you'd also need to make these calls. Take DisplayHelpText for example. Again, the performance loss is negligible.
    3. 60 FPS means (rounded) 17ms interval. That's a value way over the performance hit of those wrappers and every developer needs to consider which parts of his code really needs to be called each frame. If he (speaking in general terms) is not able to do this he should better refrain from writing script mods anyway, regardless of C++ or C#.

  • @Cyron43 Yes you are right. I probably should have answered that a bit differently for someone who is only starting out. Overhead is negligible for most basic things and wouldn’t be noticeable. It’s when you are doing some things that would otherwise be bogged down with calls to .NET framework that C++ seems like a good option.

Log in to reply

Looks like your connection to GTA5-Mods.com Forums was lost, please wait while we try to reconnect.