FAForever Forums
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Login

    Accessing OS in LUA code for creating a mod

    Scheduled Pinned Locked Moved I need help
    12 Posts 7 Posters 523 Views
    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
      SusSusAmogus
      last edited by

      Hi there!
      I have some ideas for FAF mods that require executing external script (in pyhton actually, however I can compile it into an executable or run it on server with HTTP interface).
      I've never worked with lua before, so I've been studying this topic for a while recently: whether it is possible to access literally SOMETHING except of the log file from isolated lua environment?
      Maybe some lubraries can be added, just like the JSON library is added?
      Would be grateful for any help or advice!
      All the best!

      UvesoU 1 Reply Last reply Reply Quote 0
      • Brutus5000B
        Brutus5000 FAF Server Admin
        last edited by Brutus5000

        The Lua version in FA is sandboxed and has no access to the file system or the network.

        He said, "I've been to the year 3000
        Not much has changed, but they live underwater
        And your great-great-great-granddaughter
        Is playin' FAF, playin' FAF"

        SpikeyNoobS 1 Reply Last reply Reply Quote 0
        • UvesoU
          Uveso @SusSusAmogus
          last edited by Uveso

          @sussusamogus said in Accessing OS in LUA code for creating a mod:

          Hi there!
          I have some ideas for FAF mods that require executing external script

          Can you give us/me an example?
          what kind of mod or function you have in mind?

          S 1 Reply Last reply Reply Quote 0
          • S
            SusSusAmogus @Uveso
            last edited by

            @uveso I thought about machine learning and neural networks utilization. AFAIK, there's no e.g. tensorflow distribution for lua.

            1 Reply Last reply Reply Quote 0
            • SpikeyNoobS
              SpikeyNoob Global Moderator @Brutus5000
              last edited by

              @brutus5000 could someone patch the engine to make some outside interaction possible?

              1 Reply Last reply Reply Quote 1
              • BlackYpsB
                BlackYps
                last edited by

                Permitting outside interaction would open the gates for malware

                S SpikeyNoobS 2 Replies Last reply Reply Quote 1
                • S
                  SusSusAmogus @BlackYps
                  last edited by SusSusAmogus

                  @blackyps that's all very understandable. However textures, sounds and effects can be bundled using mods.

                  Maybe it could be possible to provide modders with possibility of including some "trusted" scripts into their mods too? Such mods could be double-checked by community, moderators and marked as "unsafe" in storage...

                  1 Reply Last reply Reply Quote 0
                  • SpikeyNoobS
                    SpikeyNoob Global Moderator @BlackYps
                    last edited by

                    @blackyps i would not like to see it done for normal games, but if it was possible using some ML for an ai would be quite cool. Even if its not used outside of a dev environment.

                    1 Reply Last reply Reply Quote 0
                    • S
                      SusSusAmogus
                      last edited by SusSusAmogus

                      At least file IO would be very helpful and (potentially) not very harmful. Like reading from a file packaged along with a mod - what can go wrong with that?..

                      HTTP IO would be even better. Just like sending and receiving simple JSON requests - no js scripts and stuff...

                      Let me know if you decide to implement it - I can provide any support needed!

                      1 Reply Last reply Reply Quote 0
                      • Brutus5000B
                        Brutus5000 FAF Server Admin
                        last edited by

                        Writing Io is super dangerous. A harmful or buggy mod could overwrite files or flood the disk.
                        Reading http during the game is also dangerous , because requests can fail (=desync) or take longer (=lag).

                        The lua engine is hardcoded into the engine. A few experts tried updating it with a newer version for performance improvements, but despite many years of trying it does not work.

                        He said, "I've been to the year 3000
                        Not much has changed, but they live underwater
                        And your great-great-great-granddaughter
                        Is playin' FAF, playin' FAF"

                        1 Reply Last reply Reply Quote 1
                        • Ctrl-KC
                          Ctrl-K
                          last edited by Ctrl-K

                          @Brutus5000 Well, the current game implementation actually doesn't protect you from flooding a disk (screenshot command) or checking for file existanse in sim may cause desync or creating too many logs causing lags. IO will make it only less complicated at this point.

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

                          1 Reply Last reply Reply Quote 0
                          • JipJ
                            Jip
                            last edited by

                            We won't introduce additional IO functionality. As Brutus states, it is extremely dangerous. @Genos is technically correct that we can already flood the disk, but that isn't an argument to open up more IO functionality.

                            A work of art is never finished, merely abandoned

                            1 Reply Last reply Reply Quote 1
                            • First post
                              Last post