ED Team Alex Okean Posted May 25, 2012 ED Team Posted May 25, 2012 (edited) By default DCS scanning two folder : Mods/aircrafts Mods/tech. as aircraft addon and ground vehicles respectively. scan is recursive , for each founded folder system tries execute entry.lua file. If it exist scanning of this folder is stopped and only entry.lua is executed , otherwise it will execute all founded lua's in folder and doing the same for subfolders. all files are executed in safe environment with restricted access to database and functions basic lua functionality available table pairs ipairs type assert print math tostring dofile -- safe enveronment version loadfile current_mod_path -- path of your plugin -- localization using gettext : _(string) -- i.e. localized_string = _("ENGLISH SENTENCE STRING") -- mounting shapes and textures libraries mount_vfs_model_path (current_mod_path..'/Shapes/MyZipOrFolder') mount_vfs_texture_path (current_mod_path..'/Textures/MyZipOrFolder') mount_vfs_liveries_path (current_mod_path..'/Liveries') plugin declaration must be started by calling declare_plugin(unique_plugin_id,info_table) as sample: declare_plugin("My Mod maded by Me", { installed = true, -- if false that will be place holder , or advertising dirName = current_mod_path, fileMenuName = _("My Mod"), -- for mission editor version = "1.1.2.0", state = "installed", info = _("Short info about me and my application"), --collection of binaries which will be asociated with my plugin binaries = { 'FM_plugin', 'Cockpit_dll_1', 'Cockpit_dll_2' }, --collection of input profiles InputProfiles = { ["PLANE NAME"] = current_mod_path .. '/Input/hardcore', ["PLANE NAME_easy"] = current_mod_path .. '/Input/easy', }, -- skin for mission editor , see sample for P-51 , A-10C etc Skins = { { name = _("My Mod"), dir = "Skins/1" }, }, --missions and campaigns Missions = { { name = _("My Mod"), dir = "Missions", CLSID = "{CLSIDCLSIID}", }, }, -- options related to my plugin Options = { { name = _("My Mod"), nameId = "My Mod", dir = "Options", CLSID = "{0394EC1E-3C24-4ed5-8F13-CD90FF9091A5}" }, }, -- logbook entry LogBook = { { name = _("My Mod"), type = "My Mod", }, }, -- precache resources preload_resources = { textures = {}, models = {"tracer_bullet_a-10", "shell_50cal", "tracer_bullet_red", "sled"}, fonts = {}, explosions = {}, }, }) -- the body of your plugin must be placed here -- declaration of plugin finished by calling plugin_done() plugin_done() adding new aircraft with cockpit bells and whistles i attached simple prototype package which will add aircraft named Wunderluft as newly object with cockpit . I will use it to explain basic available at current moment features ( features will be continiously growth i hope :) ) NOTE : At present moment you only able to create SFM based aicraft, support for third party FM binary packages is planned. Let's start each plugin can add several objects at once add_aircraft(table_with_aircraft_data_1) add_aircraft(table_with_aircraft_data_2) arcraft table should have all data needed for mission editor and simulation some notes : if you open Wunderluft.lua you will see WSTYPE_PLACEHOLDER entry , it means that database will automatically change it to first available index for aircraft . and it means that maximum available aircraft types in simulator is limited to 256 ! this will be fixed in future. SFM and engine data should match each other in terms of aircraft perfomance , for example you must be targeted to known perfomance data as maximum turn rate , climb rate but simple placing 13000 kg of thrust to Su-27 ASAP i will give you detailed instructions of each aspect , and now i will go to bed , good night for all . Edited May 29, 2012 by Alex O'kean 2
HungaroJET Posted May 26, 2012 Posted May 26, 2012 Thank you Alex I have one question: can we change textures by model arguments and values in liveries//description.lua just like in FC2 .skins files ? Atop the midnight tarmac, a metal beast awaits. To be flown below the radar, to bring the enemy his fate. HAVE A BANDIT DAY ! [sIGPIC][/sIGPIC] "When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." - R. Buckminster Fuller (1895 - 1983), American Architect, Author, Designer, Inventor, and Futurist
Silver_Dragon Posted May 26, 2012 Posted May 26, 2012 great adition.... looking for more ;) For Work/Gaming: 28" Philips 246E Monitor - Ryzen 7 1800X - 32 GB DDR4 - nVidia RTX1080 - SSD 860 EVO 1 TB / 860 QVO 1 TB / 860 QVO 2 TB - Win10 Pro - TM HOTAS Warthog / TPR / MDF
ED Team Alex Okean Posted May 26, 2012 Author ED Team Posted May 26, 2012 Thank you Alex I have one question: can we change textures by model arguments and values in liveries//description.lua just like in FC2 .skins files ? if you about extending skin amount for old models , (which was limited by number of 10) so we have example of it "Bazar\Liveries\f-16a mlu\CMD extended skins"
HungaroJET Posted May 26, 2012 Posted May 26, 2012 (edited) if you about extending skin amount for old models , (which was limited by number of 10) so we have example of it "Bazar\Liveries\f-16a mlu\CMD extended skins" im about bringing back the F-18 afterburners 1+5 stages textures and correcting old F-4, F-5, F-16, F-14, MiG-29s, Su-27 etc. idle (fully opened) nozzles without the "flame" textures :idea: so this "feature" really need variable textures by values of arguments :cry: Edited May 26, 2012 by HungaroJET Atop the midnight tarmac, a metal beast awaits. To be flown below the radar, to bring the enemy his fate. HAVE A BANDIT DAY ! [sIGPIC][/sIGPIC] "When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." - R. Buckminster Fuller (1895 - 1983), American Architect, Author, Designer, Inventor, and Futurist
joey45 Posted May 26, 2012 Posted May 26, 2012 Interesting. How would I go about adding a Naval ship? 1 The only way to make sense out of change is to plunge into it, move with it, and join the dance. "Me, the 13th Duke of Wybourne, here on the ED forums at 3 'o' clock in the morning, with my reputation. Are they mad.." https://ko-fi.com/joey45
Pikey Posted May 28, 2012 Posted May 28, 2012 Oh this post is fantastic! So much creativity and such a bright future ahead :) Bookmarked. ___________________________________________________________________________ SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING *
ED Team Alex Okean Posted May 30, 2012 Author ED Team Posted May 30, 2012 (edited) Cockpit from scratch what you need to make cockpit package : 3d model of cockpit (we will not discuss about aspects of creation 3d models here), lua skills , C/C++ skills (optionally ),patience ! Each time when you take control over aircraft ,DCS will try to load package from HumanCockpitPath entry of database for this aircraft type, it can be added for existed aircraft (ie F-16 in DCS ) by calling make_flyable("F-16",current_mod_path..'/Cockpit/Scripts') -- for example if such path exist DCS will start loading it by executing two files at the root of this folder clickabledata.lua device_init.lua clickabledata contain info about clickable elements of your cockpit 3d model and commands which will be raised to targeted device on click. devices are declared in file device_init first device which you always need is MainPanel it is always declared in form of MainPanel = {"ccMainPanel",LockOn_Options.script_path.."mainpanel_init.lua"} where ccMainPanel is command to factory to create object of type ccMaiPanel next is init script for your device MainPanel will hold and render your 3d model and animate gauges by "arguments" after main panel declaration you are can declare up to 255 devices for different purposes creators = {} creators[devices.TEST] = {"avLuaDevice" ,LockOn_Options.script_path.."test_device.lua"} creators[devices.WEAPON_SYSTEM] = {"avSimpleWeaponSystem" ,LockOn_Options.script_path.."Systems/weapon_system.lua"} creators[devices.CLOCK] = {"avAChS_1" ,LockOn_Options.script_path.."clock.lua"} creators[devices.ADI] = {"avBaseIKP" ,LockOn_Options.script_path.."adi.lua"} creators[devices.ELECTRIC_SYSTEM]= {"avSimpleElectricSystem",LockOn_Options.script_path.."Systems/electric_system.lua"} creators[devices.RADAR] = {"avSimpleRadar" ,LockOn_Options.script_path.."RADAR/Device/init.lua"} table devices is just named index local count = 0 local function counter() count = count + 1 return count end -------DEVICE ID------- devices = {} devices["TEST"] = counter()--1 devices["WEAPON_SYSTEM"] = counter()--2 devices["ELECTRIC_SYSTEM"] = counter()--3 devices["CLOCK"] = counter()--4 devices["ADI"] = counter()--5 devices["RADAR"] = counter()--6 all devices except TEST store their base functionality inside our libraries and used just as entry point to core data of FM and other objects avLuaDevice is device which functionality completely driven by lua for example content of test_device.lua local dev = GetSelf() local my_param = get_param_handle("TEST_PARAM") -- obtain shared parameter (created if not exist ), i.e. databus my_param:set(0.1) -- set to 0.1 local update_time_step = 0.1 make_default_activity(update_time_step) --update will be called 10 times per second local sensor_data = get_base_data() local DC_BUS_V = get_param_handle("DC_BUS_V") DC_BUS_V:set(0) function post_initialize() electric_system = GetDevice(3) --devices["ELECTRIC_SYSTEM"] print("post_initialize called") end function update() local v = my_param:get() print(v) my_param:set(sensor_data.getMachNumber()) if electric_system ~= nil then local DC_V = electric_system:get_DC_Bus_1_voltage() local prev_val = DC_BUS_V:get() -- add some dynamic: DC_V = prev_val + (DC_V - prev_val) * update_time_step DC_BUS_V:set(DC_V) end end function SetCommand(command,value) if command == 3001 then print("user click") end end most important thing of that is local my_param = get_param_handle("TEST_PARAM") get_param_handle create named databus entry which can be accessed by any other device, indication element , panel gauge , trigger event by name this code inside mainpanel_init.lua will animate value of TEST_PARAM as argument 113 of 3d model TEST_PARAM_GAUGE = CreateGauge("parameter") TEST_PARAM_GAUGE.parameter_name = "TEST_PARAM" TEST_PARAM_GAUGE.arg_number = 113 TEST_PARAM_GAUGE.input = {0,100} TEST_PARAM_GAUGE.output = {0,1} this code inside indicator's script will add text to HUD with this value local test_output = CreateElement "ceStringPoly" test_output.name = create_guid_string() test_output.material = FONT_ test_output.init_pos = {0,-1} test_output.alignment = "CenterCenter" test_output.stringdefs = {0.01,0.75 * 0.01, 0, 0} test_output.formats = {"%.2f","%s"} test_output.element_params = {"TEST_PARAM"} test_output.controllers = {{"text_using_parameter",0,0}} --first index is for element_params (starting with 0) , second for formats ( starting with 0) test_output.additive_alpha = true test_output.collimated = true AddElement(test_output) as more usefull sample gun_sight_mark = create_textured_box(0,0,32,32) -- this is create_textured_box function call with parameters gun_sight_mark.material = PIPER_ gun_sight_mark.name = BASE_COLOR_MAT gun_sight_mark.collimated = true gun_sight_mark.element_params = {"WS_GUN_PIPER_AVAILABLE", "WS_GUN_PIPER_AZIMUTH", "WS_GUN_PIPER_ELEVATION"} gun_sight_mark.controllers = {{"parameter_in_range" ,0,0.9,1.1},--check that piper available using WS_GUN_PIPER_AVAILABLE {"move_left_right_using_parameter",1, 0.73 }, --azimuth move by WS_GUN_PIPER_AZIMUTH , 0.73 is default collimator distance (from eye to HUD plane) {"move_up_down_using_parameter" ,2, 0.73 }, --elevation move by WS_GUN_PIPER_ELEVATION } AddElement(gun_sight_mark) use three named params to control gun piper mark position on HUD to be continued... Edited May 30, 2012 by Alex O'kean 1
SilentEagle Posted May 30, 2012 Posted May 30, 2012 Excellent! Keep the info coming! It will takes some time to go through these functions and see just how much functionality is available.
Krebs20 Posted May 31, 2012 Posted May 31, 2012 I love you. This alone will keep me busy for the next month. [sIGPIC][/sIGPIC]
SilentEagle Posted May 31, 2012 Posted May 31, 2012 (edited) Alex, could you give an example of duplicating a default FC2 aircraft while calling a default cockpit that works as a sample aircraft? I've tried to remove all wunderluft references and duplicate the L-39, but the game crashes on me whether I try to fly in the cockpit or even load it as an AI jet. Edited May 31, 2012 by SilentEagle 1
shagrat Posted May 31, 2012 Posted May 31, 2012 :music_whistling:Alex, could you give an example of duplicating a default FC2 aircraft while calling a default cockpit that works as a sample aircraft? I've tried to remove all wunderluft references and duplicate the L-39, but the game crashes on me whether I try to fly in the cockpit or even load it as an AI jet. Yesterday I played around with the DCS World/Mods folder... So, basically you may copy the SU-25T folder and simply fix the F-15C references (especially for the Input) and "Make flyable = F-15C" - Works! :thumbup: You then have the F-15C flyable in the ME, but it uses the default SU-25T Cockpit. I guess the challenge is to get a EDM compatible F-15C Cockpit 3D-Model plus Textures to reference, and a correct Input binding... As I'm lacking programming experience and in-depth LUA knowledge, may some body with better know how investigate this path? Speed? PeterP? :helpsmilie: EDIT: or we just wait for FC3 to happen... Shagrat - Flying Sims since 1984 - Win 10 | i5 10600K@4.1GHz | 64GB | GeForce RTX 3090 - Asus VG34VQL1B | TrackIR5 | Simshaker & Jetseat | VPForce Rhino Base & VIRPIL T50 CM2 Stick on 200mm curved extension | VIRPIL T50 CM2 Throttle | VPC Rotor TCS Plus/Apache64 Grip | MFG Crosswind Rudder Pedals | WW Top Gun MIP | a hand made AHCP | 2x Elgato StreamDeck (Buttons galore)
Pikey Posted May 31, 2012 Posted May 31, 2012 (edited) :music_whistling: I guess the challenge is to get a EDM compatible F-15C Cockpit 3D-Model plus Textures to reference, and a correct Input binding... NOTE: fixes/hacks aren't in the spirit of this post so the two are mutually exclusive until you know what you are doing. Krebs solved this with the mod on lockonfiles in this post. http://forums.eagle.ru/showpost.php?p=1452599&postcount=6 Really its cockpit construction and flight models. Air radars are a big problem, but if your systems are using existing su25 or a10 stuff should be ok to fudge. Edited May 31, 2012 by Pikey ___________________________________________________________________________ SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING *
shagrat Posted May 31, 2012 Posted May 31, 2012 NOTE: fixes/hacks aren't in the spirit of this post so the two are mutually exclusive until you know what you are doing. Yep, totally agree, but many people here, including me, are so desperately waiting for "any" additional plane to fly, that in the time until FC3 and the "next DCS Fixed Wing US" I would rather like playing around with a 70% working F-15C, F-16, F/A-18 in between. With this mods integration available, I guess we don't need to wait that long for 3rd Party DCS Standard Models like Beczl's MIG-21bis or let's see perhaps an F-16C or the like. This copy and tweak can never keep up to the DCS standard and for me I can clearly say: I fly it! I buy it! :thumbup: So if a moderator thinks this information inappropriate he may delete my post. But I guess with this thread stating the obvious, anybody will try this sooner or later... Ehm, Krebs20's mod is perfect, to have a bit of fun in between betas :D Shagrat - Flying Sims since 1984 - Win 10 | i5 10600K@4.1GHz | 64GB | GeForce RTX 3090 - Asus VG34VQL1B | TrackIR5 | Simshaker & Jetseat | VPForce Rhino Base & VIRPIL T50 CM2 Stick on 200mm curved extension | VIRPIL T50 CM2 Throttle | VPC Rotor TCS Plus/Apache64 Grip | MFG Crosswind Rudder Pedals | WW Top Gun MIP | a hand made AHCP | 2x Elgato StreamDeck (Buttons galore)
SilentEagle Posted May 31, 2012 Posted May 31, 2012 :You then have the F-15C flyable in the ME, but it uses the default SU-25T Cockpit. Yea, I've been flying the F15 since DCS World was released, but not in a way that adds a completely new aircraft or uses a different cockpit. It's not so much that I want a fully working F-15, but it would be nice to get an example of a complete working aircraft added through the Mods folder.
Kegetys Posted May 31, 2012 Posted May 31, 2012 Will it be possible to add new countries, with custom skins and atc/jtac/awacs/etc. speech as mods in the future? As a cyborg, you will serve SHODAN well http://www.kegetys.fi
Yammo Posted June 1, 2012 Posted June 1, 2012 ...an example of a complete working aircraft added through the Mods folder. This would indeed be pure manna from heaven... ^_^
Tango Posted June 1, 2012 Posted June 1, 2012 it would be nice to get an example of a complete working aircraft added through the Mods folder. +1 Best regards, Tango.
42 Posted June 2, 2012 Posted June 2, 2012 (edited) Hi Alex, What i would love to know about are the connection with the binaries written and compilled with C++. you mentioned: --collection of binaries which will be asociated with my plugin binaries = { 'FM_plugin', 'Cockpit_dll_1', 'Cockpit_dll_2' }, I understand custom FM is in development but for example the cockpit DLL's what is the interface for that? Iam more a C++ developer then Lua but love both :-) But would love to hear about the implementation and the loading 'process' of the DLL. Want to have my systems developed in C++ (since you said C++ skills optionally that triggered me ;-) ) Have seen the LoRegisterControlls() which can be used to get the base functionality but what if i want to extend it a bit? :-) Is that possible in the current state of mod development? Or will that be available when binary FM is implemented? Thanks alot for the info already! Edited June 3, 2012 by 42
ED Team Alex Okean Posted June 3, 2012 Author ED Team Posted June 3, 2012 Working Sample of Wunderluft this is the same package of Wunderluft that i posted before , but now 3d models included : L-39 for external shape , and P-51D cockpit as cockpit shape , without textures as it will be to big for sample http://files.mail.ru/1U99DD
ED Team Alex Okean Posted June 3, 2012 Author ED Team Posted June 3, 2012 (edited) Hi Alex, What i would love to know about are the connection with the binaries written and compilled with C++. you mentioned: --collection of binaries which will be asociated with my plugin binaries = { 'FM_plugin', 'Cockpit_dll_1', 'Cockpit_dll_2' }, I understand custom FM is in development but for example the cockpit DLL's what is the interface for that? Iam more a C++ developer then Lua but love both :-) But would love to hear about the implementation and the loading 'process' of the DLL. Want to have my systems developed in C++ (since you said C++ skills optionally that triggered me ;-) ) Have seen the LoRegisterControlls() which can be used to get the base functionality but what if i want to extend it a bit? :-) Is that possible in the current state of mod development? Or will that be available when binary FM is implemented? Thanks alot for the info already! FM binary packages not yet available for third party developers, native cockpit libraries also , at this moment we talk about Lua implementation of all . of course you can put most of your internal logic to dll and use it as Lua module ( http://www.lua.org for doc about it) using "require" call. i hope i can give you C library to handle cockpit params shortly after release Edited June 3, 2012 by Alex O'kean
Blaze Posted June 3, 2012 Posted June 3, 2012 Thanks for the updates Alex, much appreciated. i7 7700K | 32GB RAM | GTX 1080Ti | Rift CV1 | TM Warthog | Win 10 "There will always be people with a false sense of entitlement. You can want it, you can ask for it, but you don't automatically deserve it. "
aaron886 Posted June 3, 2012 Posted June 3, 2012 Really helpful descriptions and example, Alex. Thanks!
Recommended Posts