FAForever Forums
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Login
    The current pre-release of the client ("pioneer" in the version) is only compatible to itself. So you can only play with other testers. Please be aware!

    Supcom/Moho engine rewrite

    Scheduled Pinned Locked Moved Contribution
    62 Posts 32 Posters 3.9k Views 12 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S Offline
      SlightlyGrilled
      last edited by SlightlyGrilled

      A new version! (now working with faf 3841!)

      https://github.com/ThomasMonkman/rts-core-engine/releases/tag/v0.2.1

      Lua Debugging

      Thinking of developers, both for the game and modding, i have added debugging! you can see in the video below

      • breakpoints
      • conditional breakpoints
      • seeing variables
      • running code live in the console, such as in the video with SetHealth on the scout

      https://youtu.be/EZGhvC2t4Uk

      a9f6f45e-50b2-4efb-9548-d9295013842c-image.png

      this can even be used to debug mods! here is me stepping in to the hooked files of the RNGAI mod (credit to @relent0r)
      https://youtu.be/3pvMWk2clw0

      3bbeaa29-c283-46e7-9895-e373949dde72-image.png

      to try this your self, you can look here
      https://github.com/ThomasMonkman/rts-core-engine/blob/main/docs/guides/debugging-lua.md

      Improving the stats bar:

      The stats I use to see at a glance the performance of the game, both sim and rendering, but it was messy, time for a face lift. Thanks to @MayeulC for prompting and giving ideas for this work.

      33bc4a48-40c3-472d-b78b-1dcbe15bf08a-image.png

      hover on fps
      03eae585-6263-4639-bd48-0994bf1efabd-image.png

      hover on sim
      200b5f63-b83d-41bd-b412-662871149d22-image.png

      and to show off the networking, a very cool networking simulator, now you can pretend to be in Australia (or further) even if your not!
      8141d268-89d1-42fd-8d6a-e5c5215a76d6-image.png

      Next a series of bug fixes

      • Units turn for factory roll off
      • Trees now correctly blown away by explosions
      • Functions implemented that RNGAI used, which means RNGAI now works :), thanks relent0r
      • Mods and maps are loaded with case insentivity, so they now load on linux
      • Tree correctly blow away from explosions!
      • Blast damage now impacts shields
      • Diskwatch now reloads lua,textures,models, etc...
      • A vault folder without maps/ or mods/ still mounts
      • Closing the second monitor's window closes only that window, instead of shutting the game
      • Selection brackets are centred on the mesh, and range rings scale with the map when zoomed out
      • Intel is now fully parallel
      • Follow weapons are also now fully parallel
      • Improvements in movement with turning and corners
      • Aircraft refuel while being repaired, and dock at the nearest air staging platform
      • Eco stall for both mass and energy now handle like the base game

      Also thanks to:

      • MayeulC a PR for improving issue onboard, and for detailed bug reports
      • relent0r and an94 for bug reports
      1 Reply Last reply Reply Quote 0
      • S Offline
        SlightlyGrilled @Xiaomi
        last edited by

        @Xiaomi So yes your right, i think I'm approaching the ceiling on what can be done, although I'm sure there are always clever tricks to go further.

        Do bare in mind though that, that trace is a 64k air battle, the normal balance of the game simply doesn't run in to that kind of unit count, even if you played with 64 players.

        I do think a lua thread pool api could be introduced similar to love2d , but that would really only help with big chunks of work like ai and such.

        with this i would imagine some task api where you opt in to certain data (unit position, eco, intel, etc...) to be copied over to an isolated lua thread, then you would set a duration of ticks for the work to be completed in, such that it remains deterministic, if it hasn't completed in time the sim would wait.

        something a bit like this in the sim (this is pseudo code just to illustrate the idea)

        
        
        -- Plain-data arguments, deep-copied at post time
        local taskArgs = {
            thing = 5,
        }
        
        local dueInTicks = 10
        
        -- Which parts of the sim to copy over
        local unitsView = {
            fields     = { 'Position', 'Army', 'BlueprintId', 'Health' },
            categories = categories.MOBILE,
            armies     = 'enemies',
        }
        
        local access = {
            Units    = unitsView,
            Terrain  = true, 
            PathGrid = { 'Land', 'Amphibious' }, 
            Economy  = 'own',
        }
        
        -- Which task to run: a module path and a function in it
        local taskModule   = '/mods/myai/lua/tasks/threat.lua'
        local taskFunction = 'Compute'
        
        local pending = Pool.PostTask(taskModule, taskFunction, taskArgs, dueInTicks, access)
        
        -- do more stuff
        
        local ok, result = Pool.WaitForTask(pending)  -- resumes at exactly post tick + 10
        

        then the worker script

        
        function Compute(args, View)
            local units = View.Units
            local count = units.Count()
        
            for i = 1, count do
                local position = units.Position(i)
                local health   = units.Health(i)
                -- do stuff thats slow...
            end
        
            return args.thing * 42  -- plain data, handed back at the due tick
        end
        
        

        This has the advantage of allowing devs in the lua to break up work in to as many threads as they see fit, and with so many cores now available, more tasks are always better.

        https://love2d.org/wiki/love.thread

        There is also robloxs thread model where you can have read only access in parallel, and write access is then serialised.

        https://create.roblox.com/docs/scripting/multithreading


        but yes you are right, it is in conflict with how supcom was made, perhaps another possibility would be to allow some wasm runtime (still allowing scripting of a sorts, just compiled), but I'm not sure if those are actually that much faster than the luau vm.

        of course you could move the whole game to native code, but then you lose modding and such...

        interesting none the less

        1 Reply Last reply Reply Quote 0

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • First post
          Last post