Jump to content

DCS Mods structure : How to create your plugin from scratch


Recommended Posts

But I don't see any reason why general know-how needs to be secret or why "how-to" subjects should be scattered all over the forum or kept inside closed forum sections - this very thread(and forum section actually) also seems to contradict that notion.

 

Nor do I see why anyone with a mod project needs to be granted "3rd party developer" status to be privy to documentation in regards to how the sim works. As I understand it, such a status is only necessary for developers who intend to charge for their work and as such become subject to quality control by Eagle

 

I agree with sides to both arguments and was only stating what I believe to be ED's stance on the issue of this information. To be honest, as Tango has pointed out, there isn't as much ED-provided information available as many would want to believe. Most information available is only a very minimal starting point for us to continue our development past what is possible using the information available in this public thread.

Link to comment
Share on other sites

Well forgive me for saying this aaron886, but you don't exactly strike me as a particulary diplomatic person yourself :D

 

I made my point clearly and objectively. You took the time to call us arrogant and our ideas idiotic. If there's no more positive contribution to the subject, maybe the thread can go back to its appropriate topic.

Link to comment
Share on other sites

I made my point clearly and objectively. You took the time to call us arrogant and our ideas idiotic.

 

I called your idea that lack of information helps to prevent sub-standard mods idiotic(I suppose I could have used the term "illogical" instead) and the notion that no one aside from the currently approved 3rd party developers could possibly understand and make proper use of better documentation arrogant(which I think covers it better than your own "rude").

 

But you are right - this discussion is clearly leading nowhere.

 

If there's no more positive contribution to the subject, maybe the thread can go back to its appropriate topic.

 

Which IIRC was to provide information to "every joe without an ounce of know-how".....otherwise I guess it would have been posted in some closed forum section :D

JJ

Link to comment
Share on other sites

Need help with SFM tuning.

I have testing results of aircraft I do, but some parameters in SFM_Data section is not clear for me.

Here is list

 

kjx=2.3,

kjz=0.001

Czbe=-0.014

 

B - Polar quad coeff

B4 - Polar 4th power coeff

I have graphics like Cx/Cy data, changing Cy by Mach.

 

c1tW6vFqOcg.jpg

 

So, maybe someone can explain where can I get those parameters? In my docs I can find only Cx,Cy, and drag coefficients for wings, flaps, brakes, but nothing about B,B4,kjz,Czbe. Maybe I need calculate it myself from Cx/Cy, but how-to?

 

And one question yet, I have some of Cx/Cy datas for H=0 and 5000 meters, also Cx/Cy for different throttle position.

Which one should I place to SFM section to get correct FM accordance to SFM limitations?


Edited by BR=55=Sevas
Link to comment
Share on other sites

  • ED Team

What's the plane?

 

Kj - are the coefficients time constant in short-periodic movement depends on.

 

B and B4 are the coefficients that determine L/D polar as Cx = Cx0 + B * Cy^2 +b4*Cy^4


Edited by Yo-Yo

Ніщо так сильно не ранить мозок, як уламки скла від розбитих рожевих окулярів

There is nothing so hurtful for the brain as splinters of broken rose-coloured spectacles.

Ничто так сильно не ранит мозг, как осколки стекла от разбитых розовых очков (С) Me

Link to comment
Share on other sites

  • ED Team
What's the plane?

 

Kj - are the coefficients time constant in short-periodic movement depends on.

 

B and B4 are the coefficients that determine L/D polar as Cx = Cx0 + B * Cy^2 +b4*Cy^4

 

I know my high school math teachers are somewhere right now laughing at me :music_whistling:

64Sig.png
Forum RulesMy YouTube • My Discord - NineLine#0440• **How to Report a Bug**

1146563203_makefg(6).png.82dab0a01be3a361522f3fff75916ba4.png  80141746_makefg(1).png.6fa028f2fe35222644e87c786da1fabb.png  28661714_makefg(2).png.b3816386a8f83b0cceab6cb43ae2477e.png  389390805_makefg(3).png.bca83a238dd2aaf235ea3ce2873b55bc.png  216757889_makefg(4).png.35cb826069cdae5c1a164a94deaff377.png  1359338181_makefg(5).png.e6135dea01fa097e5d841ee5fb3c2dc5.png

Link to comment
Share on other sites

  • 2 weeks later...

That is only a test for a "pilotable" object add-on..... not sure if the data displayed has correct or not, but expected can be useful to test proposes. Need review them to improved and continue testing them.

 

 

--mounting 3d model paths and texture paths

 

mount_vfs_model_path (current_mod_path.."/Shapes")

--mount_vfs_liveries_path (current_mod_path.."/Liveries")

mount_vfs_texture_path (current_mod_path.."/Textures/Avionics")

 

 

Project183 = {

 

Name = 'Project183',

DisplayName = _('Project183'),

 

HumanCockpit = true,

HumanCockpitPath = current_mod_path..'/Cockpit/',

 

Picture = "Project183.png",

Rate = 40, -- RewardPoint in Multiplayer

Shape = "Project183",

 

shape_table_data =

{

{

file = 'Project183';

life = 18; -- lifebar

vis = 3; -- visibility gain.

desrt = 'Project183_destr'; -- Name of destroyed object file name

fire = { 300, 2}; -- Fire on the ground after destoyed: 300sec 2m

username = 'Project183';

index = WSTYPE_PLACEHOLDER;

},

{

name = "Project183_destr";

file = "Project183-destr";

fire = { 240, 2};

},

},

mapclasskey = "P0091000025",

attribute = {wsType_Navy,wsType_Ship,wsType_ArmedShip,PERRY,

"Frigates", "RADAR_BAND1_FOR_ARM",

"DetectionByAWACS",

Categories = {

{name = "Armed Ship"},

},

-----------------------

mass = 4.1e+006

max_velocity = 14.9189

race_velocity = 14.9189

economy_velocity = 10.2889

economy_distance = 8.334e+006

race_distance = 2.778e+006

shipLength = 137.5

Width = 13.5

Height = 31.5

Length = 137.5

DeckLevel = 5.8

X_nose = 59.1924

X_tail = -64.9268

Tail_Width = 13.5

Gamma_max = 0.35

Om = 0.05

speedup = 0.269786

R_min = 275

distFindObstacles = 462.5

}

add_surface_unit(Project183)

 


Edited by Silver_Dragon
  • Like 1
Link to comment
Share on other sites

Hi Silver Dragon.

 

You seem quite skilled.

I've an idea and I would like to ask your help, if you have the time.

 

Could you create a template like that one of a Ship, but for let's say a tank?

 

I'm thinking about creating a thing, that if managed, could actually blow some minds.

 

:D

 

Thank you!

Link to comment
Share on other sites

Ok, here are the template for a vehicle, the only problem not sure how make them "pilotable". No weapons or other system, only a stub.

 

 

 

--mounting 3d model paths and texture paths

 

mount_vfs_model_path (current_mod_path.."/Shapes")

--mount_vfs_liveries_path (current_mod_path.."/Liveries")

mount_vfs_texture_path (current_mod_path.."/Textures/Avionics")

 

 

T34 = {

 

Name = 'T34',

DisplayName = _('MBT T-34'),

 

HumanCockpit = true,

HumanCockpitPath = current_mod_path..'/Cockpit/',

 

Picture = "T34.png",

Rate = 40, -- RewardPoint in Multiplayer

Shape = "T34",

 

shape_table_data =

{

{

file = 'T34';

life = 18; -- lifebar

vis = 3; -- visibility gain.

desrt = 'T34_destr'; -- Name of destroyed object file name

fire = { 300, 2}; -- Fire on the ground after destoyed: 300sec 2m

username = 'T34';

index = WSTYPE_PLACEHOLDER;

},

{

name = "T34_destr";

file = "T34-destr";

fire = { 240, 2};

},

},

mapclasskey = "P0091000025",

attribute = {wsType_Ground,wsType_Tank,wsType_Gun,wsType_GenericTank,

"Tanks", "Old Tanks",

Categories = {

{name = "Armor"},

},

-----------------------

life = 18,

mass = 36000,

length = 9,

width = 3.27,

max_road_velocity = 12,

max_slope = 0.27,

canSwim = false,

canWade = true,

engine_power = 580,

max_vert_obstacle = 0.5,

max_acceleration = 1.85185,

min_turn_radius = 3,

X_gear_1 = 2.062,

Y_gear_1 = 0,

Z_gear_1 = 1.346,

X_gear_2 = -2.674,

Y_gear_2 = 0,

Z_gear_2 = 1.346,

r_max = 0.46,

r_track = 0.6,

armour_thickness = 0.060,

 

 

}

add_surface_unit(T34)

 


Edited by Silver_Dragon
Link to comment
Share on other sites

Do you know how can i set followings in "add_aircraft-(new helicopter.lua)" ?

 

 

these are not correct :(

 

Pylons_Data = {

Pylons_Enumeration_Data = {4, 5, 3, 6, 2, 7, 1},

},

 

Helicopter_Exhaust_Data = {

exhaust_data = {

nozzle = {{pos = {0.78,1.095, 0.902},orientation = {0.5,0.5,-1}},

{pos = {0.78,1.095,-0.902},orientation = {0.5,0.5, 1}}},

nozzle_coefficient = 0.9

}

},

 

Something missing - or not implemented yet ? { } , ()

or am i using wrong words ?

 

TY

sign-pic4.jpg

Link to comment
Share on other sites

Yeah looks that way Beaker.

 

Vampire, each client needs to have the same module files as the server or they will get an integrity check error.

 

i did not put any addon aircraft into the mission what i runned as a server :sad_2:

i have some new stuff in the mods folder but those were not placed in that mission - surprising outcome :eek:

none was able to connect as a client - nor to a simple (only 4*Su-25T) mission :angry: while i killed the integrity check before, so nothing was checked i think (i hoped)


Edited by NRG-Vampire

sign-pic4.jpg

Link to comment
Share on other sites

Yes it seems at present time, just having personal mods in the mods folder without all players having the same content will result in an application error.

 

this is very bad :(

in this case if i add BeczL's Vehicle Upgrade Pack, "official" Armed Structures or any new aircraft into Mods folder then Clients will not able to join to my Server ? ? ?

even if i did not put these new vehicles/structures/aircrafts into the actual mission of server, even if i turned off IC. :mad: i hope this is just a "beta" bug

sign-pic4.jpg

Link to comment
Share on other sites

Hi all, I have followed this thread closely and am currently implementing my own custom aircraft into DCS. I have had some success as far as instruments, however I have been scratching my head when it comes to the clickable side. It's not entirely clear to me how one implements a simple clickable device, such as a switch.

 

I would be greatfull if someone could shed some light on how to code, for example, a gear lever, how you define the lever object as clickable, and implement it into DCS. I am aware you use the clickabledata.lua file, however I'm not sure just how one achieves what I have described.

 

Thanks,

Dime.

[sIGPIC][/sIGPIC]

Find us at http://virtual-roulettes.forumotion.com/

Link to comment
Share on other sites

Hey Dime,

You have 4 main files to do this:

 

clickabledata.lua - this defines the switch/dial type, the DEVICE in DCS to use, the argument DCS uses, the 3dMax argument and the 3dMax helper and ties them all together.

 

For the Hawk, we have two buttons in the cockpit, Gear Up and Gear Down.

As you can see below these are defined in DCS as Button_19 and 20. In 3dMax they are arguments 219 and 220 and they both use the device AVIONICS. PNT_019 and PNT_020 are our "helpers" in 3dMax (mouse over boxes in 3dMax).

 

clickabledata.lua code

elements["PNT_019"] = default_button("Gear Down",devices.AVIONICS, device_commands.Button_19,219)
elements["PNT_020"] = default_button("Gear Up",devices.AVIONICS, device_commands.Button_20,220)

 

Next you need to define your DEVICE in devices.lua

devices["AVIONICS"]     = counter()--17

 

The counter number at the end is just sequential from the previous ones.

 

Then you need to define what the device AVIONICS does in device_init.lua

creators[devices.AVIONICS]   = {"avLuaDevice"      ,LockOn_Options.script_path.."Avionics/avionics.lua"}

 

This tells DCS what file to run when you click a button, switch or dial in DCS.

In this case it is avionics.lua in the Avionics folder within the Cockpit folder.

 

In my avionics.lua I define the DCS switches as:

local iPlaneGearDown = 431 -- 431 is DCS argument for gear down
local iPlaneGearUp = 430 -- 430 is DCS argument for gear up

 

Then I define my 3dMax switches

local Gear_Down_Switch = 3019 -- 3019 is arg 219 in clickabledata
local Gear_Up_Switch = 3020 -- 3020 is arg 220 in clickabledata

 

Then I run the code to do the action in DCS:

function SetCommand(command,value)
  if command == 3019 then
 dispatch_action(nil,iPlaneGearDown)
 elseif command == 3020 then
 dispatch_action(nil,iPlaneGearUp)
 end
end

 

As you can see from the code, if button 3019 is pressed then carry out the action iPlaneGearDown (DCS argument 431) or if button 3020 is pressed then carry out the action iPlaneGearUp (DCS argument 430).

 

If you have a gear lever instead of two buttons then it's slightly different.

Let me know what you have and I'll put up some example code.

 

I hope that makes sense, if not just ask.

Chris.


Edited by Ells228
Link to comment
Share on other sites

And this is the code to do my flaps which is a 3 stage switch

 

clickabledata.lua

elements["PNT_018"] = FCS_Tumb("Flaps Control", devices.AVIONICS, device_commands.Button_18, device_commands.Button_134,218) -- uses PNT_018 and PNT_134

Again, PNT_018 is the helper in 3dMax. I use an FCS_Tumb type switch, use AVIONICS as the device and use Button_18 and Button_134 with argument as 218.

 

AVIONICS is defined as above post already.

 

And here is the code in avionics.lua:

function post_initialize()
   print("post_initialize called in avionics.lua")
Flaps = 0

   main_panel        = GetDevice(0)
   electric_system   = GetDevice(3)  -- Electic_System 
end

In the post_initialize section I set my Flaps definition to 0 so I can use this argument later.

 

local iPlaneFlapsUp = 146 -- Fully up
local iPlaneFlapsTakeoff = 72 -- Mid-way
local iPlaneFlapsDown = 145 -- Fully down

local FlapsUpSwitch = 3018 -- Button_018
local FlapsDownSwitch = 3134 -- Button_134

 

elseif command == 3018 then
 if Flaps == 1 then
 dispatch_action(nil,iPlaneFlapsTakeoff)
 Flaps = 0.5
 else
 dispatch_action(nil,iPlaneFlapsUp)
 Flaps = 0
 end
 elseif command == 3134 then
 if Flaps == 0 then
 dispatch_action(nil,iPlaneFlapsTakeoff)
 Flaps = 0.5
 else  
 dispatch_action(nil,iPlaneFlapsDown)
 Flaps = 1
 end  
end

 

As you can see I have written in logic to check the flaps state before carrying out the action. The flaps state 0. 0.5 and 1 are defined in my 3dMax animation.

 

The logic is if Flaps up switch is pressed 3018 then if flaps position is 1 (fully down) then move flaps to mid point 0.5 or if flaps are already at 0.5 then move them fully up to 0.

Then, if Flaps down switch is pressed 3134, if flaps are fully up 0 move flaps to mid point 0.5 or if flaps are already at 0.5 then move fully down to 1.


Edited by Ells228
  • Like 1
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...