FAForever Forums
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Login
    1. Home
    2. SlightlyGrilled
    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!
    S Offline
    • Profile
    • Following 0
    • Followers 3
    • Topics 1
    • Posts 19
    • Groups 0

    SlightlyGrilled

    @SlightlyGrilled

    79
    Reputation
    23
    Profile views
    19
    Posts
    3
    Followers
    0
    Following
    Joined
    Last Online

    SlightlyGrilled Unfollow Follow

    Best posts made by SlightlyGrilled

    • Supcom/Moho engine rewrite

      Hello, I have made an attempt at making a drop in replacement for supcoms Moho engine.

      First off I've finally released the source code, it took a ton of effort to make this ready for other people, and I'm sure it still needs more, so please be patient with what you find πŸ™‚

      I have made it as a fresh repo, as understandably when you work on something yourself which you're never sure may see the light of day, you can get sloppy, and I didn't want to risk passwords or what ever being public.

      I'm happy for people to raise issues for bugs and such πŸ™‚

      and I hope people have fun playing around

      source code
      https://github.com/ThomasMonkman/rts-core-engine
      exes:
      https://github.com/ThomasMonkman/rts-core-engine/releases


      Now first off the bat this was of course made with ai, but please before the pitch forks are raised.

      • this whole post has been done by hand
      • I did a large amount of research in to supcoms Moho engine, both for this project and many years ago when I tired (and massively failed to do this in c++) and I want to believe I carefully guided the ai in what I wanted and what I believe is important for this style of engine
      • I am also an senior dev with over 15+ years of experience, so I’m not just some script kiddy spluting out the game.
      • I have really done this in good faith, supcom is one of my all time favourite games and I really wish for it to live for ever

      That said, I also want to say straight away this wouldn’t have been any near as possible if it wasn’t for the huge huge amount of effort all the people working on faf and other communities have put in over the years to supcom, so a huge thank you to them.

      It’s also certainly not finished, it’s one of those 90% takes 10% of the time, and the last 10% takes 90%, but I wanted to get this out there.

      I guess first off, tech wise.

      • its written in rust
      • Its a drop in replacement (although requires currently faf github checked out and supcom installed on your pc, or atleast its files)
      • uses luau for the lua with both patches both to the lua vm, and also lua source code translation for all gpg specific changes they made.
      • I hope the luau in the future allows for using luau typed version of lua
      • shaders are written in wesl
      • it is cross platform (well at least windows and Mac)
      • it supports up to 63 player multiplayer. (I think it can go higher, but it's currently a performance trade off and I figured 63 was enough to compete against a certain other rts game πŸ˜› )
      • it works with faf lua unchanged, apart from some very small bits I had to shim.
      • 64bit
      • has testing and benchmarking

      It's fast. (This was super important to me, what’s the point if we can’t go fast?)
      With a 60min game of 4x4 on setons of ai vs ai runs at 4x real speed. and a 1v1 can run at 180x realtime on my Mac.
      This is really limited by the ai logic in lua, I have test maps with 16k units all pathfinding and shooting at each other, all running well above base game speed.

      And I’m 100% sure it could be improved further.

      Of course many things are still not working correctly, particularly the graphics are not an exact match.

      I also imagine a lot of work needs to be done on the look and feel of things, such as unit movement etc…

      It also doesn’t support save games at the moment or replays.

      Although with where i have got it to, im sure it won't belong before it's basically a mirror to the current game.

      I really hope this is well received, I know ai was used, but I did actually put a good amount of effort in to planning this, and just general slow build up of knowledge over the years.

      After a bit more work i will open source it πŸ™‚

      here are some videos of the game

      4 v 4 networked game between windows and mac (2 on windows, 6 on mac)
      https://youtu.be/OiNBzXKnppc

      an 4v4 full ai game
      https://youtu.be/GotWNzX6Xgs
      00c60896-dc45-4d06-be4f-b6e4ce384b2f-image.png

      a 63 ai player game (although could be people)
      https://youtu.be/u5EUMRxeL0Q
      d2a14893-0c86-41ad-aace-1e2fcfeb83e7-image.png

      bf7c4b1f-7349-4474-9af2-83d985bdb09c-image.png

      posted in Contribution
      S
      SlightlyGrilled
    • RE: Supcom/Moho engine rewrite

      And another quick update with a requested 10k vs 10k airfight video πŸ˜„

      https://www.youtube.com/watch?v=BrD_8Py4gX0
      image.png

      the dead rest...
      image.jpg

      posted in Contribution
      S
      SlightlyGrilled
    • RE: Supcom/Moho engine rewrite

      So this is a really big update from my side, tons of things, internally I use issues to track what I have and haven't done, so this time around I've put the issue numbers on what I've done πŸ™‚

      Open source

      First off I've finally released the source code, it took a ton of effort to make this ready for other people, and I'm sure it still needs more, so please be patient with what you find πŸ™‚

      I have made it as a fresh repo, as understandably when you work on something yourself which you're never sure may see the light of day, you can get sloppy, and I didn't want to risk passwords or what ever being public.

      I'm happy for people to raise issues for bugs and such πŸ™‚

      and I hope people have fun playing around

      source code
      https://github.com/ThomasMonkman/rts-core-engine
      exes:
      https://github.com/ThomasMonkman/rts-core-engine/releases/tag/v0.1.0

      #367 Replay keyframes: fast seeking, played ahead in the background

      Replays now support quick rewinding! and skip forward (to degree)

      when starting a replay, a second process now starts up in the background and plays the replay at max speed saving out "keyframes" of the game. You can see this in the video below as a buffer bar.

      You can now skip to anywhere in this buffer bar. a brief delay as the game reloads in at that time.

      But you can now go back and forth as you please.

      and thanks to differential compression it uses very little storage.
      These keyframes stay even after closing the game, so you can quickly look through a replay or preload it, and then scan through the whole replay later with no background processing

      Video:
      https://youtu.be/0MWgoXI4nQE

      this can all be controlled from settings.
      81fa8526-ab13-4bc8-a4f0-610959578e51-image.png

      #386 The lobby downloads a missing map from FAF's vault

      The lobby will now download maps from faf that are missing from clients, this happens as they are selected by the host, so no reloading needed.

      Testing

      An important part of any modern software development is testing.
      As such this project has a few different types.

      • unit test (very isolated, does the function add(2, 3) equal 5)
      • benchmarking
      • end to end, or real scenarios tests

      the scenarios tests are what I want to show below, it's massively sped up so you can actually see it somewhat in a lifetime.

      they each test something fairly specific, like "can this tank attack this tank", "is this tanks shot blocked by terrain"

      i did spot a few errors during this recording, but that's all part of the process πŸ˜›

      https://youtu.be/edDiLLQhGL4

      Naval

      • #351 Torpedoes run under the water, naval units start on the surface
      • #355 Submarines start submerged
      • #357/#358 Submarines surface on their own for carrier loads, unloads and AutoSurfaceToAttack
      • #356 Torpedoes fired from a still sub start at rest
      • #457 Submarines dive and surface bow first
      • #455 Carriers launch aircraft from their launch points, one a tick, without moving
      • #418 The cheat menu spawns ships on water

      Movement and pathing

      • #475 Units ease into a stop and coast to a halt on arrival
      • #327 Formations run at 0.85Γ— their slowest unit, and members steer for their final slots
      • #329 Units only push moving units on other orders, as fading impulses
      • #406 Land units no longer path over cliffs into or out of the water
      • #469 Hover units lean a tenth as far and level out after stopping (the seraphim where just bobbing around all over the place πŸ˜„ )
      • #467 Finished ground units stand on the ground under them
      • #361 Walk animations follow the unit's speed and turns
      • Issue* orders skip units that can't do the order, such as an shield generator being told to attack, or tanks being told to reclaim

      Combat and vision

      • #347 We now draw nice fog of war instead of pixelated from before πŸ™‚
      • #345 Weapon target searches skip targets the terrain blocks
      • #348 Weapons on hold fire search for no targets
      • #342 Aggressive moves and patrols engage a task step late
      • #420 Turret pitch is aimed from the barrel bone's own pose
      • #370 Persistent blips (FAF's Blip class, destroy hooks, real-game lifetime)
      • #468 Fog of war's clear ground is drawn as vision circles
      • #499 Czar and some other beams had effects sideways
      • Overcharge works
      • Weapons in general work better and more faithfully to the base game
      • Energy drains are actually paid, so T2 artillery charge-up, teleport and overcharge wait for energy
      • Weapons fire the beat after they take a target, as in the real game (i feel like this is something maybe should be changed about the game?)
      • Homing missiles steer by their facing. The Corsair's AA darts now fly level and hit, where before they flew into the ground
      • Solace torpedo bombers now actaully do damage
      • TMDs now actaully work correctly
      • Fire Beetle detonates on attack orders and no longer blows up at game start (this was more when doing testing, as you never start the game with fire beetles, but they also had other bugs)
      • HARMS sits on the sub layer
      • Weapon/damage callbacks now get the real tick number it happened on, instead of the tick n - 1
      • GiveStorage / GiveResource apis behave as in the real game
      • Anti torpedo weapons now work

      Networking, replays, lobby

      • #449 Lockstep desync fixes (local-only input, ejected turns, command text, observer sources) and a desync dialog
        (this was a nasty little bug, i was double reading local player input once, before the network tick and once after, so it was possible to input commands in to your local sim without sending to others!!)
      • #454 Desync detection: a checksum every tick, in parts, covering motion, orders and economy
        While i've made efforts to build the sim in such a way desyncs should be hard to get, its always still good to have logging for it πŸ™‚
      • #380 One broken map no longer empties the lobby

      Building, engineers, factories

      • #403 Build sites snap to the cell grid
      • #464 Assisting factories share the assisted queue and keep building their own
      • #465 An engineer's assist ends when an order is queued behind it
      • #451 Engineers parking to assist slide off each other instead of stacking
      • #456 Assisting engineers show the progress of what they help build or repair
      • #452 Build beams go away when an unfinished structure is destroyed
      • #463 Factories keep a queue of rally orders, shown with Shift and kept on upgrade
      • #416 The construction panel queue works for mobile factories and ACU enhancements
      • #417 One waypoint ETA per structure, at its builders' combined rate
      • #459 The ACU upgrade ETA shows without selecting the ACU
      • #466 Reclaiming a unit takes its health down with its fraction
      • #453 SetMaxHealth leaves health alone
      • #458 Excess resources overflow to allies
      • #365 Enhancement tabs are in the real game's order
      • #507 engineers assisting one of themselves leave its own build queue alone

      Camera and interface

      • #390 Camera spin (Space + mouse, Insert / Delete, cam_Free)
      • #389 Camera field of view and zoom works as in moho
      • #394 You can now scroll in and out when tracking a unit with "T"
      • #450 Camera SnapTo / MoveTo / RestoreSettings honour heading and pitch
      • #360 Queued waypoints and build placements can be dragged to move them
      • #414 A test that dragging the build queue reorders the factory queue
      • #382 Unit stats for the end-of-game screen
      • #385 The stats bar pause button no longer shifts
      • #404 The in-game exit says "Exit" on platforms other than Windows
      • Minimap shows an earlier game's map, if you play a second game without restarting
      • Wrong army in later games, if you play a second game without restarting
      • Game freezes when the other player leaves (no clickable buttons, black screen after the score view)
      • Process stays running after the window closes β†’ exits on its own after 3s
      • Map download "builder error" on Linux, i've added more logging, and a failed download now blocks that player's launch

      Visuals

      • #470 Seraphim build mesh and Seraphim / Aeon build beams match the real game
      • #474 Cybran structures under construction hide what's behind them
      • #461 Mesh LOD fixes
      • #492 Collision beam's far end starts at its target when enabled (Monkeylord laser)
      • #493 Ythotha death: energy being draws, wreck keeps its death pose, no white beam slabs

      Platform

      • #383 The join code now copies to the clipboard on sway / Wayland
      • #384 FAF and Steam are found where faf-linux looks for them
      • #413 A hidden window no longer stops the other window drawing, plus you can now window the other window
        and in general multi monitor should be much better supported, although their are limitations with wgpu and different platform support
      • Wayland terminal flooded with clipboard log lines
      • No vsync cap on Wayland (1000 FPS in the menu), wayland wasn't giving a framerate limit at startup, we now find the highest refresh rate screen and use that until we get the correct refresh rate

      Performance and internals

      • #338 Map decals skip lighting their transparent pixels
      • #339 Terrain shadow is worked out once a pixel

      So one of the only graphics changes i have made to the project is using SMAA for AA and PCF (percentage closer filtering) for shadows, along with up to 2k shadow maps instead of 1k.

      the downside to that shadow improvement is the shadow calculations becomes more expensive on the gpu.

      While playing around I noticed with just looking at the map was dropping my frame rate which absolutely shouldn't be happening on a game from 2007!

      well time to fire up the graphics profilers and have a look.

      got to say im very impressed with xcodes metal debugger.

      and its profiling instantly shows almost all the gpu time is spent drawing the decals on the map!

      you can see here in this image up at the top left hand side that vs_decal/fs_decal_albedo is at 68% of the world stage which its self is 90% of the frames work!
      84f65fd2-b2ed-4705-aa81-bdfbcb58c529-image.png

      well it turns out now calculating shadows is much more expesnive and its done for all the decals across the whole map.

      well the fix is easy, most of the decals texture is transparent.

      so right at the start of the shader, if the pixel is transparent stop.

      if (alpha <= 0.0) { discard; }
      

      this took my frame time from 15.46ms to 11.10ms!
      68aaadf9-98d1-4b2a-8b6b-aefbecffdc01-image.png

      next still for every decal we are calculating the shadows again, as decals can stack on top of each other, this is a lot of extra work.

      so we now precalculate the shadows and share between the terrian and decals

      this takes 11.10ms to 7.96ms!

      ~twice as fast as before!
      3d21f92b-4796-4cb6-9467-8f78c5b4fbda-image.png

      But we can go further! I noticed at large zoomed out views my fps again was dropping. Unacceptable!

      Most of the map drawing is dominated by reading lots of textures, but for when the texture is far away, you could use smaller textures right? you see less of it so who cares if its smaller?\

      well thats a well known thing in graphics already, called mipmaps. you store with the texture a version of it halfed and halfed until it gets to 4x4.
      like so

      • 512
      • 256
      • 128
      • 64
      • 32
      • 16
      • 8
      • 4

      then the shader uses the size appropriate in the moment, this saves a lot of memory bandwidth.

      this gives me 5.6ms to 3.88ms! (on a different map to the one above, so just look at the change)

      In fairness, the base game also does this, i just assumed all textures shipped with mipmaps...

      These mipmap textures are saved out to a cached folder, which can be configured both in size and expire date in the settings.
      it will make first startup slower

      • #374 Faster weapon target searches (this really only effects the 64k stress test, but weapons are now twice as fast)
      • #376 Effect expiry uses an index instead of scanning every effect
      • #368 Landing for aircraft searches are much faster now
      • #407 Mouse moves are coalesced, so hovering hit-tests once a frame (especially useful with super high hz mice)
      • #421 The interface keeps control layouts between frames (this is very much targeted at the restrictions page which is very heavy on the ui, now its atleast twice as fast)
      • maps can now be saved loaded when compressed with zstandard (god I love a good compression algo, this shrinks a 81km map to like 5-24x smaller)

      here is a grid of all the inbuilt maps which really shows you how good compression is, and to think they shipped the game on dvd!

      Base game map sizes, raw .scmap vs zstd level 19

      • SCMP_001 Burial Mounds (20 km) 9.4 MB -> 2.5 MB (3.7x)
      • SCMP_002 Concord Lake (20 km) 7.9 MB -> 2.5 MB (3.2x)
      • SCMP_003 Drake's Ravine (20 km) 8.8 MB -> 1.7 MB (5.2x)
      • SCMP_004 Emerald Crater (20 km) 10.8 MB -> 3.0 MB (3.6x)
      • SCMP_005 Gentleman's Reef (40 km) 37.9 MB -> 5.9 MB (6.4x)
      • SCMP_006 Ian's Cross (20 km) 10.8 MB -> 2.9 MB (3.7x)
      • SCMP_007 Open Palms (10 km) 2.7 MB -> 0.7 MB (3.7x)
      • SCMP_008 Seraphim Glaciers (20 km) 9.9 MB -> 2.0 MB (5.0x)
      • SCMP_009 Seton's Clutch (20 km) 9.6 MB -> 2.6 MB (3.7x)
      • SCMP_010 Sung Island (20 km) 9.9 MB -> 2.3 MB (4.4x)
      • SCMP_011 The Great Void (40 km) 31.2 MB -> 1.9 MB (16.1x)
      • SCMP_012 Theta Passage (5 km) 1.0 MB -> 0.2 MB (4.0x)
      • SCMP_013 Winter Duel (5 km) 0.9 MB -> 0.3 MB (3.5x)
      • SCMP_014 The Bermuda Locket (20 km) 11.1 MB -> 2.2 MB (5.0x)
      • SCMP_015 Fields of Isis (10 km) 3.9 MB -> 1.2 MB (3.4x)
      • SCMP_016 Canis River (5 km) 1.4 MB -> 0.4 MB (3.2x)
      • SCMP_017 Syrtis Major (10 km) 3.0 MB -> 1.0 MB (2.9x)
      • SCMP_018 Sentry Point (5 km) 2.0 MB -> 0.6 MB (3.5x)
      • SCMP_019 Finn's Revenge (10 km) 3.5 MB -> 0.8 MB (4.2x)
      • SCMP_020 Roanoke Abyss (20 km) 10.3 MB -> 2.3 MB (4.4x)
      • SCMP_021 Alpha 7 Quarantine (40 km) 32.2 MB -> 7.6 MB (4.2x)
      • SCMP_022 Arctic Refuge (10 km) 2.5 MB -> 0.8 MB (3.0x)
      • SCMP_023 Varga Pass (10 km) 2.5 MB -> 0.8 MB (3.1x)
      • SCMP_024 Crossfire Canal (20 km) 12.0 MB -> 3.5 MB (3.4x)
      • SCMP_025 Saltrock Colony (10 km) 2.7 MB -> 0.6 MB (4.3x)
      • SCMP_026 Vya-3 Protectorate (10 km) 4.0 MB -> 1.0 MB (4.0x)
      • SCMP_027 The Scar (20 km) 9.2 MB -> 2.8 MB (3.3x)
      • SCMP_028 Hanna Oasis (40 km) 32.5 MB -> 7.7 MB (4.2x)
      • SCMP_029 Betrayal Ocean (81 km) 122.0 MB -> 20.3 MB (6.0x)
      • SCMP_030 Frostmill Ruins (81 km) 126.8 MB -> 16.6 MB (7.6x)
      • SCMP_031 Four-Leaf Clover (10 km) 2.6 MB -> 0.9 MB (3.0x)
      • SCMP_032 The Wilderness (10 km) 3.6 MB -> 1.0 MB (3.5x)
      • SCMP_033 White Fire (10 km) 3.6 MB -> 0.7 MB (5.0x)
      • SCMP_034 High Noon (10 km) 2.9 MB -> 0.7 MB (4.2x)
      • SCMP_035 Paradise (10 km) 3.0 MB -> 0.8 MB (3.6x)
      • SCMP_036 Blasted Rock (5 km) 1.0 MB -> 0.3 MB (3.0x)
      • SCMP_037 Sludge (5 km) 0.8 MB -> 0.3 MB (2.8x)
      • SCMP_038 Ambush Pass (5 km) 1.3 MB -> 0.4 MB (3.3x)
      • SCMP_039 Four-Corners (5 km) 1.2 MB -> 0.3 MB (3.6x)
      • SCMP_040 The Ditch (20 km) 9.7 MB -> 2.4 MB (4.1x)
      • X1CA_001 campaign (20 km) 8.7 MB -> 2.3 MB (3.7x)
      • X1CA_002 campaign (20 km) 8.5 MB -> 2.7 MB (3.2x)
      • X1CA_003 campaign (40 x 20 km) 17.2 MB -> 4.5 MB (3.8x)
      • X1CA_004 campaign (20 km) 7.9 MB -> 1.5 MB (5.4x)
      • X1CA_005 campaign (20 km) 8.5 MB -> 2.1 MB (4.0x)
      • X1CA_006 campaign (20 km) 8.4 MB -> 2.1 MB (3.9x)
      • X1MP_001 Crag Dunes (5 km) 1.2 MB -> 0.4 MB (2.7x)
      • X1MP_002 Williamson's Bridge (5 km) 1.0 MB -> 0.4 MB (2.5x)
      • X1MP_003 Snoey Triangle (10 km) 2.4 MB -> 0.7 MB (3.3x)
      • X1MP_004 Haven Reef (10 km) 3.1 MB -> 0.8 MB (3.7x)
      • X1MP_005 The Dark Heart (10 km) 2.8 MB -> 1.0 MB (2.9x)
      • X1MP_006 Daroza's Sanctuary (10 km) 2.2 MB -> 0.7 MB (3.0x)
      • X1MP_007 Strip Mine (20 km) 8.6 MB -> 1.7 MB (5.0x)
      • X1MP_008 Thawing Glacier (20 km) 9.1 MB -> 1.8 MB (5.0x)
      • X1MP_009 Liberiam Battles (20 km) 8.5 MB -> 2.2 MB (3.8x)
      • X1MP_010 Shards (40 km) 33.9 MB -> 7.8 MB (4.3x)
      • X1MP_011 Shuriken Island (40 km) 32.4 MB -> 4.6 MB (7.0x)
      • X1MP_012 Debris (81 km) 122.2 MB -> 5.0 MB (24.5x)
      • X1MP_014 Flooded Strip Mine (20 km) 10.4 MB -> 2.5 MB (4.2x)
      • X1MP_017 Eye of the Storm (10 km) 3.0 MB -> 1.0 MB (3.1x)

      Total, 60 maps: 862.1 MB -> 152.8 MB (5.6x)

      posted in Contribution
      S
      SlightlyGrilled
    • RE: Supcom/Moho engine rewrite

      The Binaries

      Mac
      https://upload.disroot.org/r/XHFvbT4s#ZaPwUTGTjpmK0IlKXyW8N1f8c9Qu5JgVboD8USbDzxk=
      Windows
      https://upload.disroot.org/r/M0EnT4kb#Ws6EFNfzgC0s/xGGYsIdzgoQNjfmCodVQ6fozlJDfjQ=
      Linux
      https://upload.disroot.org/r/tuUFTLuT#27oozpFjzTrcIzBS1lY/AeicAgDbtqv5ns460MpwebQ=


      Picture in picture

      This is a cool new feature, I was mainly thinking of casters for this.
      Now on major events, such as your team building an experimental, or an acu dying, you get a picture popup that you can click on to view the location. it also supports modding, so modders can make new events, I've included an example mod that tells you when your acu is below 10% hp. (I'll make a follow up post about this, as I'm not sure i like the api...)
      of course this is all toggleable in the settings, and I'm super open to feedback.
      32d0ddbc-9e51-43a6-a3c0-b7972f289051-image.png

      Timeline on replay

      Another really cool feature, that was mainly me thinking about casters again. I've added a timeline view, that lets you move to any part in the game, it also highlights key events. Such as (ACU death, Exp built).
      Allows you to zoom to selected events, and will shift the camera to just before.
      It does support rewind, but at the moment it restarts the game and fast forwards, in the future we could save out keyframes, but i want to avoid game serialisation until later as its a source of endless bugs πŸ˜„

      I have more ideas for this one, but just wanted to get something basic in for now.

      like above this is a setting as well, it can be on either main or second screen, or just turned off.
      You can see a video here, although the ai playing makes the scrubbing a bit slow
      https://youtu.be/aOz7DxAPm28

      256e47fd-ce2c-4e0c-b530-7d445b9de59f-image.png

      Split screen! and Dual screen!

      This was a fair amount of work, and I'm sure will need more testing. It will work on different refresh rate screens with each screen running at its max speed. You can now in the settings set which display is main and secondary screen.
      If any one has a 240hz-480hz I'd love to know if it can go that fast
      3c13e75a-4803-46ac-9eba-381fe0a0cbe7-image.png

      Mod support!

      I haven't tested with blackops, but certainly the inbuilt x2 resources now work

      Lua documention!

      This one is also really nice.

      thanks to rust macros, the apis from the engine to the lua, are now auto generated, and output both to luau type file and a emmy lua file that faf uses, I love this sort of feature, it should help things stay in sync, and of course helps me compare my api to fafs
      here's an examples of it on the rust side, then the luau and the emmy lua output

      this rust adds the ChangeMaxRadius method to the weapon class, that comment is auto put in to the lua docs too

          lua_method!(lua, moho::Weapon,
              /// Sets the weapon's maximum range (world units) and refreshes the unit's attack range.
              ChangeMaxRadius = |lua, (this, r): (Obj<moho::Weapon>, f64)| {
                  with_state(lua, &this, |w| w.max_radius = crate::engine::sim::math::from_lua(r))?;
                  refresh_attack_range(lua, handle(&this)?.unit);
                  Ok(())
              }
          )?;
      

      Then the generated luau types (a snippet of them)

      declare extern type Weapon with
          --- A weapon dies with its unit.
          function BeenDestroyed(self): boolean
          --- True if the weapon is enabled and its fire clock has run out.
          function CanFire(self): boolean
          --- Overrides the weapon's damage.
          function ChangeDamage(self, damage: number): ()
          --- Sets how far (degrees) the turret may be off target and still fire.
          function ChangeFiringTolerance(self, t: number): ()
          --- Sets the weapon's maximum range (world units) and refreshes the unit's attack range.
          function ChangeMaxRadius(self, r: number): ()
      

      the emmylua type

      --- Sets the weapon's maximum range (world units) and refreshes the unit's attack range.
      ---@param r number
      function weapon_methods:ChangeMaxRadius(r) end
      

      while I'm sure this is far from perfect, it's just a fantastic example of little things that really can help a project stay manageable, in another time/life, this would have all been manual work of someone.

      Merge order lines for units sharing a first waypoint.

      No more 10k lines over the map causing massive lag

      ded0c310-5853-4195-abb9-dfdb26d42a0a-image.png


      Perf

      (I always strive for faster, not only does it mean higher end pcs will run it faster, but it unlocks lower end devices, which is just as important)

      Faster startups for lua transformaions

      in order to support fafs old lua under a new lua vm, I have to translate the lua.
      some things can be done very fast and quickly using find and replace, others require full parsing of the lua scripts which is really slow, I now do a quick check before fully parsing a file to see if the find and replace route works

      scripts/translate all FAF .lua (2,798 files, total cpu time over all cores) 538 ms -> 129 ms
      scripts/translate Unit.lua 12.1 ms -> 6.65 ms
      Headless startup, user CPU 3.62 s -> 2.68 s
      Script prewarm wall time (16 cores) 289 ms -> 196 ms

      Better thread pool allocation

      I've then rejigged the thread pools for the engine, taking in to account low core machines, this has helped the startup time on low core machines. (its a small amount, but poco a poco
      This is limiting the cores to 4
      Headless time to game start 2.23 s -> 2.12 s
      Script prewarm 726 ms 624 ms

      Texture loading

      Texture loading, textures are now all streamed as efficiently as possible to the gpu, minimising copies, and shifted off the main render thread to worker threads
      Render thread upload models ~675 ms -> ~60 ms
      Worst frame in upload models 13–21 ms -> ~1 ms

      total texture load time (this is limited to 4 cores)
      1,465ms -> 658ms

      Terrain loading

      we now load terrain much faster, and also much less work is done on the render thread
      and when map elevation is changes such as placing a building.

      81km map (again on a simulated 4core machine)
      map textures uploaded (time from launch) 8.4–11.8 s -> 1.4–1.8 s
      terrain change, render thread 23–38 ms -> 0.17–0.64 ms (worker: 4–8 ms)

      Bugs and features

      • killed units now stop showing their stragic icons and are no longer selectable
      • lods are now based on the distance to the plane of the camera, instead of the camera location, so no more circles of trees
      • all of fafs graphics settings are now supported (with bumps to shadow mapping as I now support 2k shadow maps instead of 1k)
      • we have edge of map mesh now!
      • paused builder updates progress and finishes when assisted
      • reclaim progress bar now
      • units move clear of a build site before construction starts
      • build range needs only touch the target's build skirt
      • units being built in a factory are no longer selectable
      • box selection leaves out engineers when other units are in the box
      • Novax satellite beam reaches the ground, satellite holds its height as well, instead of bobbing up and down
        • part of this fixed area damage, which i think effected other units as well
      • preferences are saved, and FAF's preferences are now imported on first launch
      • reclaim labels show (Alt-R)
      • interface settings now work
      • Half-built Fatboy - engineer assist offers repair, not the transport cursor
      • factory assist takes the queue and destination of the factory it assists
      • fixed no borderless windows on windows (how truly awful I let this even pass... serves me right for mainly testing on windows)
      • fixed bombers not dropping their bombs
      • fixed auto attack on idle, e.g. bombers moving around in their range to hit things
      posted in Contribution
      S
      SlightlyGrilled
    • RE: Supcom/Moho engine rewrite

      @Brutus5000

      I 100% want to make this open source, no worries, I just want a bit more time, as I'm well aware that open sourcing it will open the floor gates. I would also be interested in how this can be transferred over to the faf team as well. I do believe this has real merit to replace the base engine. it already demonstrates a large amount of the game working, and absolutely has the nuts and bolts to go all the way.

      @wilson_

      So it doesn't get rid of p2p, but I think/hope that it handles it more gracefully than base supcom, the faf team just need to host an iroh relay server, which from my understanding doesn't need to be beefy at all.

      Also along with the game being many times faster than the base game, should stop that horrible lag.

      and the dynamic input latency.

      @lan94

      Thank you very much for play testing! I believe I have fixed all but number 2, although air transports are not perfect πŸ™‚
      4. I tired to reproduce, but i have fixed some issues with weapons so maybe this has been fixed along the way before i got to your report πŸ™‚

      again thank you very much for the feedback.

      @giebmasse
      Also thank you for testing πŸ™‚ very much appreciated

      @cdrmv @garythegoat @downlord @saver @j_w_w @snoog @xanoxis @randomko @limez3_ @nomads @lycanrising
      Thank you for your nice words πŸ™‚

      @arkenflame @darien_
      Yes I do plan to make it open source, I just want it to bake in the oven a little bit longer as im sure you can imagine.

      posted in Contribution
      S
      SlightlyGrilled
    • RE: Supcom/Moho engine rewrite

      So in this update I really wanted to dial in and spend time on the air behaviour, while still some work is needed, air now behaves much closer to the base game.

      You can see below in this video, planes being generally more plane like πŸ™‚
      https://youtu.be/I4bx095DNqY

      Please try out it out and let me know, it's really helpful to get feedback πŸ™‚

      Windows:
      https://upload.disroot.org/r/FcnpXWYB#rq9t4XIPLv/UEhmeibcj0RKEuuvEJq6AZxfQ2f7AWN0=
      Mac:
      https://upload.disroot.org/r/bz30tWao#83WfQdi7ZiIGjZVe2njAUsuOqNU7b+63eICnlmf75CQ=
      Linux
      https://upload.disroot.org/r/rar4HZ26#kyjbGpbvSeB7HqYhrphLzJ9JjFJ1epcbDYo6xM3VIkY=


      Weapons

      Weapons should now behave far more true to the real game.

      Engine <-> Lua api

      I think I have also come up to parity with the base game on the engine <-> lua api bridge.
      This means the engine is much much more closely aligned on how the game should function.
      This was massively helped by the lua type documentation generation I talked about in the previous post.

      Perf

      With that 10k v 10k air battle, I noticed crazy lag when actually selecting units, this was a combo of the selection logic and also drawing the selection box, waypoints and rings.

      Now through some nifty gpu acceleration, range rings are reduced and culled to only the meaningful ones on the gpu, from 10's of milliseconds now down to sub 1ms.

      posted in Contribution
      S
      SlightlyGrilled
    • RE: Supcom/Moho engine rewrite

      So here is a "working" build, but first I just wanted to address the work, Yes of course I have made this with heavy amounts of AI, and I know that kind of sucks, especially for those that have worked so hard on faf over the years.

      In no way do i want this work to take away from that hard work.
      What I hope, is that those people will be empowered by this project, they can already achieve magic with asm patches to the exe, imagine what can be done when they have real code to work with.

      I have no doubt that many many people understand fafs lua better than me, have better understand of graphics/pathfinding/supcoms quirks and behaviours/etc...
      And I am excited to see what they will be capable of achieve with this work.

      I do plan to give the whole project to faf, code and all, and then you guys can do as you see fit with it.
      I just hope it helps and empowers the community. (I guess the ends justify the means???)


      Here is both an mac and windows exe. its to big to include here, so (and i can't believe this.. a link to limewire of all places... happy to share the file another means this was just the first google hit)
      https://limewire.com/d/kIwte#CQnpfbOgYt

      When launching either they will attempt to find faf and supcom, if they can't they will ask you to give it to them.

      you need the latest faf

      Although it does not intergrate in to faf currently.

      I explain networking below, but to play together:

      • someone must host the game using the multiplayer option in the main menu, create a game as usual
      • They will be give a long code in the chat, its also copied to the clipboard
        eab77297-d68e-4719-9af5-5b7418dcd2a2-image.png
      • Others can then join via the multiplayer option in the menu, putting that string in to the ip address section, and 1 in the port section
        like below (note the code doesn't match in this screenshot cos i took it at different times)
        connection-with-iroh.jpeg

      Now as said before while the game "works", its really really is far from perfect, many things are broken or not working as expected.
      I also have only been able to test, on an old windows machine, a surface laptop, and a new mac.
      I don't have anything with an amd card, so god knows if those work.

      If you get crashes, give me the logs to look at, although i make no promises πŸ™‚ im only human (even if ai can help...)

      I have zero idea about mod support, i haven't had the time to look at it, in theory it should work, or at least i originally set up the ground works for it.

      Bugs:
      There will endless bugs of that im sure, every time i launch the game i notice bugs, and i'm just a casual noob player.

      • behaviour bugs (the tanks don't work like that, gunships don't hover like that, navy pathfinding is just awful right now)
      • crashes (i'm guessing this will mostly be graphics card related)
      • missing functionality (the novax doesn't work at all)
      • look and feel of graphics (particles are all over the place, like projectiles, the uef t3 defence, or transports and gunships, the list goes on...)

      I haven't tested many things, as i just haven't had the time and wanted to get this build out to people to mess around with.

      Really this project is a proof of concept, i think it will take the faf community time if they choose to make this a real replacement)

      If you have things not working please give me the log file, it should be next to the exe.

      Networking:
      So I’m really excited about the networking.

      First off it uses this fantastic library called Iroh, which does p2p with nat punch though. It will attempt to create direct p2p connections between players, and if not possible it will route the connection through a relay, at the moment this uses iroh public server which has zero guarantee about uptime and through put, but faf could easily host their own one.

      When creating a lobby, the game will give you a long random string, others simply need to paste that in to ip direct connection, plus any port number between 1-65k

      and it should connect :fingers_crossed:

      The game still uses udp underneath although its got a reliability layer on top, and I believe connections through irohs relay are tcp, if your direct connected its udp.

      I have zero idea how well this will actually work in the real world, but I have played a game with a friend.

      Next is player input.
      (now I could be wrong) but my understanding of how supcom does its input syncing is:

      • sim ticks along at 100ms, player input it sent every tick, but with a 500ms(I think?) delay, as all players need to have this input from every other player in order for the game to continue, thats what causes hitches with bad connections. As the game pauses waiting for input.

      What this version does.
      Fundamentally its the same, however instead of a fixed 500ms, each player has a dynamic input step. All ticks still need an input step.
      but each player now measures their latency/ping to others, and picks an input delay for themselves.

      all their input is then marked with that delay. which comes in as (please apply this input in 5 ticks (or 500ms))

      or if they have a very fast connection (please apply this input in 2 ticks (200ms))

      The upside to this is bad connections should cause as much less hitching to everyone.

      The down side is unfairness, a very laggy player can cause the delay of inputs to rise for those connected to them with a bad connection (as it could just be a bad connection between only 2 people).

      I would purpose that there is an option to lock the input delay.

      I hope this means people with high ping can still play in games, even though it does still impact people by delaying their inputs. But should minimise freezes.

      To show this all off, there is now a ping table bit of ui. You can see it with ctrl + shift + p, or on Mac cmd + shift + p

      it's a grid showing the whole mesh of connections between everyone, so all players can understand the network layout of the mesh.

      it shows the current max game speed for each player, and their input delay

      This should help understand when 2 players have a bad connection to each other, but good to everyone else

      This screen shot is with faked players and numbers, but give you an idea, of course hopefully in a real game you don't see that much red
      6cd16127-1047-4911-80b9-160a753aa631-image.png

      Perf
      Here is a crazy 64,000 airplanes fighting, of course its completely laggy, but it's somewhere in the realm of vaguely playable, the main bottleneck for graphics is the particles which would need moving to be gpu accelerated, as they are currently processed all on the cpu.
      https://youtu.be/gTWnagf_Gak
      also for those that want it, here is a tracey profile of that, proving that it can use more than 1 core! although its still mostly single threaded unless the scale is really high.
      75822429-07c0-4c5a-b59d-55a1eefa5b95-image.png

      I did test 63 players locally and it brought my machine to its knees...
      31e4b0e2-f4c1-4ed6-99fe-6e7b7c74296e-image.png

      I have patched the faf lobby in this exe to allow 64 players, although no map supports that, i've included an edited flat map that should support it. Everyone would need this map, the exe does not support transferring files yet.
      I honestly have no idea how well it will work.
      flat_63.v0001.zip

      posted in Contribution
      S
      SlightlyGrilled
    • RE: Supcom/Moho engine rewrite

      Hello, I'm back, and I believe I'm even closer to feature parity with base supcom now!

      Before anything, the exes:
      Mac
      https://upload.disroot.org/r/Ruv6XWA3#wTu4NeQg/SvvKWHGL/Y7Z5k0qRnYoYJoUka+Ej3arog=
      Windows
      https://upload.disroot.org/r/q2XTdA0V#rTfciPHkfYNsX5bRLmBEeauD1BliPu8WrPebsCqWFjY=
      Linux
      https://upload.disroot.org/r/8FAj9fnz#ZHyZiptsQo4EmI53hP6sn2y2ea3NrL8OVosy61PgbRE=


      Many nasty little bugs have been squashed.
      Don't miss the particle video πŸŽ†

      But first performance!

      I wasn't happy with the fps in that 64k air fight, after all it's only 64k, that's rookie numbers for modern computers.

      While I can't do much about the 200-300ms of time spent in the lua (as a rule of this project is not to edit the faf/supcom lua, it must be a drop in replacement), I can certainly improve the rendering speed.

      and in this modern age computers come with many cores, so best put them to good use.

      The rendering loop is made up of a few stages

      • intel
      • strategic icons
      • minimap
      • interpolate positions
      • animation
      • lod selection
      • particles
      • ui
      • issuing draw calls

      before this was all serial in a single render thread.

      now its broken down, in to two main threads, with workers for more parallel work

      First LODs

      Then

      • intel
      • strategic icons
      • ui

      at the same time

      • interpolate positions
      • animation
      • particles

      as can be scene here
      37ad76e8-32d2-49e7-81c1-f5e324f58d7f-image.png

      Then the next thing was the draw submits to wgpu. Now we're long past the days of direct9 and being bound to a single thread.

      We can record the commands all in parallel.
      87166459-df35-479c-87f8-4855eff252d5-image.png

      Along with some work to batch process units

      we end up with a full frame looking like this
      e5762e9a-bfae-4e48-847b-da983caeeaef-image.png

      You can really see the difference vs before
      331b26a5-3d14-4a91-8246-12611c2e6c30-image.png

      This brings the 64k air fight from about 15fps up to 70-100fps.
      While the main sim only runs about 2.5-3x slower than the default speed!

      and can all be seen below in full technicolour!
      https://youtu.be/UVgRPUpkJp0

      And for extra fun, you can see the whole sim tick for that fight here, look at all that lua (in blue/cyan on the sim thread)!
      Every bit that isn't rips through as many cores as it can
      182367bc-0289-44d7-990b-c2bd53e94a38-image.png


      On to bugs/improvements, and there are many!

      Replays!

      Now these are only compatible with my version and only with the version that created them.

      The game will save out your last 100 replays, and you can access them in the replay menu.

      They are stored along side the exe
      7e49e8ac-8b69-4069-bdf7-dc05781db97d-image.png

      Particles!!!

      So supcoms particles where kind of gpu accelerated, well not full compute shader, but they wrote all the info to buffers, then let the vertex shader go to town.

      Also particles where just horrible broken in my version.

      We now in 2026 do the same! (along with my 2nd fav unit to show it off (don't worry fatboy, you're still number 1)
      edab2356-79a0-43b5-af79-5375ddb3b5eb-image.png
      ac95ae90-adcf-4c30-9ed7-44918a8849e3-image.png

      Actually I believe really you need to see the Video to really do particles justice πŸ™‚
      https://youtu.be/qlK1FC12H1o

      Map gen

      the map actually looks correct (or more so) now.
      Before πŸ˜•
      c154d317-8c4a-4d15-9e22-1975b2decbde-image.png

      After!
      6b6ac47f-ab49-458f-9104-2a533dd7bd3d-image.png

      Before
      2400916e-bb90-4a5d-acc7-ade6f44e663c-image.png
      After
      d6a0edd0-7045-4435-abd9-f6d606062477-image.png

      Before
      cef78e14-ab79-4539-a61f-d6c079f2e616-image.png
      After
      f653cb5e-b9ed-4999-b62b-a56e60f3f1c7-image.png

      Glowing Mexs!

      53c7d4b1-454a-429f-bdc2-9a0f561b6aba-image.png

      Rings!

      Now they work for hover and select, and just generally work
      79a26918-e1dc-439b-8126-003547059224-image.png

      Factory upgrades

      Gone are the days of waiting for factory to upgrade before queue those machines are war, now you can queue up builds as you would expect
      5c560bc4-fb37-4bb9-8939-b962bdcab33d-image.png

      The un pictured rest

      • you can queue mex upgrades
      • upgrading radar no longer shows the next ring level
      • reclaim numbers now show in the ui
      • you can no longer click on enemy units to see their orders! what a shame cheating will never be so easy again.
      • engineers will now help the target they are assisting when that target assist
      • random bright boxes on dying aircraft
      • veterancy works!
      • macos track pad scroll no longer sends you for a spin
      • Some better fps stats, we now list vram, ram usage, render cpu and gpu time (this screenshot is from the 64k air fight)
        d7fdabb7-7548-47bb-bfa8-a31f513c7ebf-image.png
      posted in Contribution
      S
      SlightlyGrilled
    • RE: Supcom/Moho engine rewrite

      @The_Janitor Can you send me the log file please? it should be right next to the exe πŸ™‚

      posted in Contribution
      S
      SlightlyGrilled
    • RE: Supcom/Moho engine rewrite

      @IndexLibrorum Hello! I think i have actually spoke to you a bit on the discord, when I've posted links, i think you had ideas on the keyframe stuff with the replays right? well know there in! 🐷

      I'm always happy to chat tech, or anything like that πŸ™‚

      On the speeding up tests, that's actually a great idea and didn't occur to me! thank you πŸ™‚
      I spent a bit of effort to load in the maps as fast as possible before, a main bottleneck for me is some of fafs start up lua is quite slow, although i did some work to speed that up, and the tests do run faster now.
      In reality i run the tests in parallel without the window, that i just measured, completes in 9.49 seconds on my machine.

      I did the screen recording just for visuals πŸ˜›

      But faster is always better!

      posted in Contribution
      S
      SlightlyGrilled

    Latest posts made by SlightlyGrilled

    • RE: Supcom/Moho engine rewrite

      @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

      posted in Contribution
      S
      SlightlyGrilled
    • RE: Supcom/Moho engine rewrite

      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
      posted in Contribution
      S
      SlightlyGrilled
    • RE: Supcom/Moho engine rewrite

      @Xiaomi you can see under lua weapon events, there is the number 13k, that's the individual lua callbacks, I'm just not zoomed in enough to see.
      And again under lua projectile impacts another ~3k

      So yes the general setup is rust systems calculate everything, then apply the effects.

      Actually now I'm looking I need to check that weapon step, and whether its unmarked lua, or native code. Thanks for the curiosity!

      Ok an update on that, i went and had a look, and it could totally disappear! here you go πŸ™‚ thank you!

      ad4b6242-b73b-45a8-9591-81e8c83acd8d-image.png

      This brought the 64k air fight from 307ms a tick to 270ms! (although not in that screenshot, but as an average, Tracy does also slow down the game alittle)

      On ECS, so from my understanding, ecs is really great when you have tight data you want to iterate very fast, moving as little data as possible from ram to cpu cache.

      Like if you want to move over every entities health and add regen.

      It's also great as an abstraction allowing separate systems to just deal with the data they want to deal with, they don't need to know about everything else, they just want to know health, and health regen etc...

      However in supcom, there is a huge amount of lua, and it's structured around being able to access any of the state at any point.

      So to this effect, i just store entities (units etc..) in a dense array, and lookup almost instantly by id/index.

      Another issue is the sim is deterministic, which means i need fixed iteration order, and when looking at the ecs around, they didn't guaranty fixed order, when components where added or removed.

      This was ages ago i made this choice though, so i could be miss remembering it, or it just straight wrong!

      And if i do get cache bottle necks on tight systems, i can always move to separate arrays for different parts of the data.

      Good questions though! happy to discuss more if you have more questions/ideas πŸ™‚

      posted in Contribution
      S
      SlightlyGrilled
    • RE: Supcom/Moho engine rewrite

      @The_Janitor ok found it, i will release a new version that fixes this, but in the mean time, in your mod folder you have a file mods/auto-upgrading mass extractors.7z

      my engine is picking this up and thinking its a zip file. if you move that file it should work πŸ™‚

      but i will also fix this in the next version.

      posted in Contribution
      S
      SlightlyGrilled
    • RE: Supcom/Moho engine rewrite

      @Dim-A-miD yeah its super cool!

      In case three isn’t enough and you’d like to bring the total to five...

      I think this, and your link goes way over my head? πŸ˜„

      posted in Contribution
      S
      SlightlyGrilled
    • RE: Supcom/Moho engine rewrite

      @The_Janitor Thanks I will have a look!

      posted in Contribution
      S
      SlightlyGrilled
    • RE: Supcom/Moho engine rewrite

      @IndexLibrorum you peaked my interest on the map loading, so i went and actually timed it.

      Both the total time with graphics running in a window.
      and if i run it headless without the graphics.

      Theta Passage (SCMP_012), 5 km
      total 0.89 s | map textures ready 0.71 s | sim running 0.75 s
      (headless total 0.47 s)

      Open Palms (SCMP_007), 10 km
      total 0.93 s | map textures ready 0.80 s | sim running 0.78 s
      (headless total 0.50 s)

      Seton's Clutch (SCMP_009), 20 km
      total 1.04 s | map textures ready 0.88 s | sim running 0.87 s
      (headless total 0.58 s)

      Gentleman's Reef (SCMP_005), 40 km
      total 1.38 s | map textures ready 0.87 s | sim running 1.20 s
      (headless total 0.83 s)

      Betrayal Ocean (SCMP_029), 81 km
      total 1.51 s | map textures ready 1.06 s | sim running
      (headless total 0.91 s)

      Frostmill Ruins (SCMP_030), 81 km
      total 1.51 s | map textures ready 1.02 s | sim running 1.34 s
      (headless total 0.94 s)

      Debris (X1MP_012), 81 km
      total 1.45 s | map textures ready 1.21 s | sim running
      (headless total 0.82 s)

      posted in Contribution
      S
      SlightlyGrilled
    • RE: Supcom/Moho engine rewrite

      @IndexLibrorum Hello! I think i have actually spoke to you a bit on the discord, when I've posted links, i think you had ideas on the keyframe stuff with the replays right? well know there in! 🐷

      I'm always happy to chat tech, or anything like that πŸ™‚

      On the speeding up tests, that's actually a great idea and didn't occur to me! thank you πŸ™‚
      I spent a bit of effort to load in the maps as fast as possible before, a main bottleneck for me is some of fafs start up lua is quite slow, although i did some work to speed that up, and the tests do run faster now.
      In reality i run the tests in parallel without the window, that i just measured, completes in 9.49 seconds on my machine.

      I did the screen recording just for visuals πŸ˜›

      But faster is always better!

      posted in Contribution
      S
      SlightlyGrilled
    • RE: Supcom/Moho engine rewrite

      @The_Janitor Can you send me the log file please? it should be right next to the exe πŸ™‚

      posted in Contribution
      S
      SlightlyGrilled
    • RE: Supcom/Moho engine rewrite

      @hobosapien Thank you πŸ™‚

      posted in Contribution
      S
      SlightlyGrilled