EvilKipper Posted September 26, 2024 Posted September 26, 2024 you have to unsanitize your lua environment by editing Scripts/MissionScripting.lua
bal2o Posted September 26, 2024 Posted September 26, 2024 3 hours ago, EvilKipper said: you have to unsanitize your lua environment by editing Scripts/MissionScripting.lua ya i do it (all the time for my code). but may be repair and ovgme do something bad. i will check. thanks
bal2o Posted September 26, 2024 Posted September 26, 2024 oh found it, thanks. i only unsanitize os/io/lfs but not require/loadlib and package .... thanks. let's start learning dcso3 (and rust).
EvilKipper Posted September 26, 2024 Posted September 26, 2024 Currently the best example is https://github.com/estokes/bfnext, bflib is the core of fowl engine. It's sadly not a very simple example, but if you look at the Cargo.toml, and the bottom of lib.rs you can see what you need to do to build a server using dcso3.
bal2o Posted September 26, 2024 Posted September 26, 2024 1 minute ago, EvilKipper said: Currently the best example is https://github.com/estokes/bfnext, bflib is the core of fowl engine. It's sadly not a very simple example, but if you look at the Cargo.toml, and the bottom of lib.rs you can see what you need to do to build a server using dcso3. yes i use this to learn about it. For now i can compil but see nothing in game (i just replace init_miz in lib.rs by simple out_text call) and my game crash when i stop mission. but i will find why and how use it (i'm a dev but not in rust...), just need time. I think my problem is in lua link when i compile bflib, not sure to export env var correctly. btw dcso3 look very good, just impressive work. very nice.
EvilKipper Posted September 26, 2024 Posted September 26, 2024 (edited) You need to link to the same lua.dll that DCS is linking to, otherwise you will get the smoke of very bad news. You can do that by making sure that you set the correct environment variables. There is a script setup_build.ps1 for windows, and setup_build.sh for linux that you can run to accomplish this. If you are not linking to the correct dll then DCS will say it can't require your dll, and what that really means is that the dynamic linker saved you from much worse consequences because it could not find lua51.dll As a general matter I would not recommend building native code mods for DCS unless you have a real need to do it. Fowl engine is very complex and thus benefits from strong static typing and compile time guarantees, some very specialized data structures, background threading and async for state saving, and vector optimized math libraries. Most scenarios don't need any of that and are better implemented as a couple of hundred lines of lua. Edited September 26, 2024 by EvilKipper
bal2o Posted September 26, 2024 Posted September 26, 2024 2 minutes ago, EvilKipper said: You need to link to the same lua.dll that DCS is linking to, otherwise you will get the smoke of very bad news. You can do that by making sure that you set the correct environment variables. There is a script setup_build.ps1 for windows, and setup_build.sh for linux that you can run to accomplish this. If you are not linking to the correct dll then DCS will say it can't require your dll, and what that really means is that the dynamic linker saved you from much worse consequences because it could not find lua51.dll ok. problem with windows security for ps1 script, but find how to change that. may be if you have a short code using dcso3 (like just print message with outText, without hook part) it could be help to be sure i have set all env correctly ^^
EvilKipper Posted September 26, 2024 Posted September 26, 2024 (edited) You get a pop up from DCS, and I'm not sure I can detect correctly what's happening from lua when require fails. Also I kind of view this as the price you pay. If you need to reach for the big guns, then you're going to have to think about things like what lua dll you're linking to, and all sorts of other things too like is it safe to call this api function from my current threading context. It isn't something that can be entirely smoothed over, which is why we have lua. The ps1 is 2 lines, you can just copy and paste them into your powershell if you don't want to run the script. I wrote them in a script so I didn't have to constantly do that. Edited September 26, 2024 by EvilKipper
bal2o Posted September 26, 2024 Posted September 26, 2024 2 hours ago, EvilKipper said: You get a pop up from DCS, and I'm not sure I can detect correctly what's happening from lua when require fails. Also I kind of view this as the price you pay. If you need to reach for the big guns, then you're going to have to think about things like what lua dll you're linking to, and all sorts of other things too like is it safe to call this api function from my current threading context. It isn't something that can be entirely smoothed over, which is why we have lua. The ps1 is 2 lines, you can just copy and paste them into your powershell if you don't want to run the script. I wrote them in a script so I didn't have to constantly do that. for now var export is ok, compilation too, but nothing in game and CTD when a go back in mission editor. need time to learn rust and rust in dcs ^^. may be i will first try with simple mlua code.
bal2o Posted 10 hours ago Posted 10 hours ago @EvilKipper I finally finish my own dcs lua framework and i'm starting to convert him in rust by using your dcso3 crate. And i have a question about perf : i see in your bflib that all update information are make in same 1s schedule function. In dcs there are many information that can be update via DCS Event (unit that are kill, born etc, ofc you know about it), so do you check what solution has better performance ? a large update every second or many update on each dcs event ? or it's because some information can't be update with event (like EWR situation) and it's easier to use a unique function ? I'm just curious about why you choose this solution thanks for your time, best
Recommended Posts