Recent and upcoming engine changes

Bug fixes:

  • UserUnit:GetCustomName asks for 2 arguments, but actually needs 1
  • ForkThread crashes with cfunction, so we forbid this
  • Unit:SetStat no longer crashes the game. Returns true if stat wasn’t set. Must be set with Unit:GetStat
  • CMauiControl:SetAlpha tweaks: dont change whole mask, only alpha part and check for 3rd argument as boolean

New Features bugs eventually 😏:

  • 5th argument for IssueBuildMobile as flag for picking all units
  • introduced table.clone (which is partially safe tbh). Clones given table (game freezes in attempt to clone recursive table, eventually leading to stack overflow. So, suitable for non recursive table only.)
  • new category OBSTRUCTSBUILDING for props. Props with this category obstruct building on them
  • new category CANLANDONWATER for air units. Units with this category can chill on water (like transports do)
  • units won’t reclaim being paused anymore
  • Unit:GetCommandQueue returns a list of commands of a given unit
  • During init stage for certain hardware game will pick different cpu cores to run faster
  • New method to WorldView:
    • ProjectMultiple projects multiple vectors at once
  • New methods for UserUnit:
    • GetInterpolatedPosition returns position of a unit interpolated by current frame
    • GetFractionComplete returns float from 0 to 1
  • New method to MauiBitmap:
    • SetColorMask sets color mask of bitmap
      colorbmp.gif
  • Console command ui_StrategicIconScale. Sets icons' scale. Useful for high res screens.
  • Custom World Rendering: adds 2 functions for drawing circle and rect in world.
    • UI_DrawRect
    • UI_DrawCircle
      5ae6b8af-395d-4d95-8d7a-c17c8657c4ba-image.pngb06fadd8-10f4-484e-832f-c4146ac26bbd-image.png
      both functions must be called within OnRenderWorld of gamemain.lua.
  • new UI function CopyToClipboard(string) copies string to clipboard

“Be a yardstick of quality. Some people aren’t used to an environment where excellence is expected.”
— Steve Jobs.
My UI Mods
Support me

All releases can be found here.

“Be a yardstick of quality. Some people aren’t used to an environment where excellence is expected.”
— Steve Jobs.
My UI Mods
Support me

Thanks for the work on improving things!
A few queries on the changes:

@azath0th said in Recent and upcoming engine changes:

ForkThread crashes with cfunction, so we forbid this

Does this mean it no longer crashes, or that ForkThread itself is forbidden? (The latter would mean all my mods would break)

Unit:GetCommandQueue returns a list of commands of a given unit

Will this still be in the format of a table, with 1 entry for each command/order, and with a sequential numerical index (i.e. 1, 2....x) such taht table.getn will work on the result?

GetFractionComplete returns float from 0 to 1

Sometimes when dealing with what I presume are floats in other contexts with FAF I've noted FAF can fail to round things - will a complete unit always return 1 when complete, rather htan e.g. 0.9999999 or 1.00000001/similar?

@maudlin27
Forkthread works as before except it doesn’t accept cfunction anymore.

You can see the way @Jip used GetCommandQueue for distribute orders, I wasn’t the one who made this change.

Once unit reaches complete state (that means it received enough build time) this value must become 1.

“Be a yardstick of quality. Some people aren’t used to an environment where excellence is expected.”
— Steve Jobs.
My UI Mods
Support me

Interesting fact: all launchers are loading based on integer progress value. Due to this progress never advances when you stall resources. I think I can fix it at some point, but I may break something eventually:D

“Be a yardstick of quality. Some people aren’t used to an environment where excellence is expected.”
— Steve Jobs.
My UI Mods
Support me

@Azath0th I don't believe it is purely integer. Past effort to identify what goes one with building missiles can be found here. https://github.com/FAForever/fa/issues/711#issuecomment-303080789

And it was determined to be intentional so might want to discuss with others before changing it

@sheikah it is, it checks for enough income and increments counter.

“Be a yardstick of quality. Some people aren’t used to an environment where excellence is expected.”
— Steve Jobs.
My UI Mods
Support me

@sheikah I know, might require separate thread and minds of other people patching engine

“Be a yardstick of quality. Some people aren’t used to an environment where excellence is expected.”
— Steve Jobs.
My UI Mods
Support me

New ui drawing functions
Bitmap SetColorMask
IssueBuildMobile fix

“Be a yardstick of quality. Some people aren’t used to an environment where excellence is expected.”
— Steve Jobs.
My UI Mods
Support me

Added some pictures

“Be a yardstick of quality. Some people aren’t used to an environment where excellence is expected.”
— Steve Jobs.
My UI Mods
Support me

added info about CopyToClipboard.
https://github.com/FAForever/FA-Binary-Patches/pull/50

“Be a yardstick of quality. Some people aren’t used to an environment where excellence is expected.”
— Steve Jobs.
My UI Mods
Support me

Custom world rendering was reworked (fixed tbh), now it works as flag for WorldView control. See PR

“Be a yardstick of quality. Some people aren’t used to an environment where excellence is expected.”
— Steve Jobs.
My UI Mods
Support me

Also there was optimized VDist3 function.

“Be a yardstick of quality. Some people aren’t used to an environment where excellence is expected.”
— Steve Jobs.
My UI Mods
Support me