Jump to content

Beginners Guide to DCS World Aircraft Mods


RedBeard2

Recommended Posts

Your current animation followed exactly by your code. No mistakes.

up is GEAR_STATE = 0

down is GEAR_STATE = 1

 

Animation between states should be let`s say 0.1 0.2 0.3.....

You have to think how to add code for making intermediate values.

 

I think noone will help you here, because its basics of programming.

Just google any articles how to program any dynamic processes, nothing difficult there.

Link to comment
Share on other sites

Not really a coding expert but the 'if true airspeed < 200 the gear = 1' statement will override any other command; I think you'd need to introduce a parameter for 'gear lever position' or similar and use that as part of the code, and use the true airspeed comparator as a limiter; I.e if TAS < 200 AND gear lever position = 1 then gear state = (add a stepping equation to simulate gear extension time until result = 1.)

 

Just a thought from my limited XML and Python knowledge!

 

 

Sent from my iPhone using Tapatalk

"The only replacement for a Buccaneer is a Buccaneer".

Link to comment
Share on other sites

Your current animation followed exactly by your code. No mistakes.

up is GEAR_STATE = 0

down is GEAR_STATE = 1

 

Animation between states should be let`s say 0.1 0.2 0.3.....

You have to think how to add code for making intermediate values.

 

I think noone will help you here, because its basics of programming.

Just google any articles how to program any dynamic processes, nothing difficult there.

 

Yes I know this(and I know very basic coding and it shows!) but when coded up how you said it does nothing(well I figured out the animation states before you posted so that part is solved).

 

For whatever reason it won't take any keyboard commands.

 

I think I am going to give up on SFM though, after reading through the f16demo thread it appears what I want to do is not possible using an SFM + clickable cockpit. I think I could probably code in a kind of "hack" that lets a key command call a device that "allows" the gear to go down under a certain airspeed. But as far as I can tell the changes they made to cockpits means you have no choice but to use a .dll.

 

I also could not get any of my cockpit devices to react to my clicks--probably also related to not using a dll--but thats something I will work on later.

 

I appreciate your response though as it kind of validated the direction I was heading anyway and as a very beginning programmer it helps to know what I was doing is right/wrong.

 

And yes I realize this isn't the best project for a noob programmer but just the same I am going to do it even it takes me a lonnnnnngg time to get where I want to be.


Edited by Hedhunta
Link to comment
Share on other sites

Almost everyone modder here has looooong way to success.

Right way to understand keys response is read lua files in ED`s modules.

 

clickable_data file define what button will response to specific command (3001....)

you device.lua can handle this events (button press/unpress) by SetCommand function.

 

True, all those links between files are mindblown at first steps in modding. But you have to deal with it.

 

Just read, code, try, correct and again and again :)

Link to comment
Share on other sites

  • 1 month later...
Yes I know this...

But it is also nothing impossible. Understanding lua driven scripts is quite easy once you get enough information. I would not consider myself even a noob programmer and I have my WIP mod with clickable cockpit, SFM and all lua driven. SFM is not the best model, but on the other hand, lua driven devices provides a lot of possibilities. Try to find as many code samples you can. It helps a lot.

 

Your gear up/down code will work as you mentioned, but will not draw animation. You will need to add animation loop like

gear_state = gear_state+0.2

SetCommand function and if scripts in --notes can be used.

 

I will send you some sample in PM, if I won't forget. You probably just have some mistake in clickable code.

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

Hi.

 

I'm having trouble adding a custom command to my airplane...

 

I've added TestCommand into the device_commands structure in command_defs.lua, and given the value 3001 (start_command + 1 as per other examples in the DCS source tree)

 

I've added dev:listen_command(3001) to my management code, which is attached to devices.TESTDEV of type avLuaDevice in device_init.lua, and loads testdev.lua in Cockpit/Scripts/Systems.

 

My default.lua for keyboard has the following:

 

{down = device_commands.TestCommand, name = _('Test Command'), category = _('Systems')}

 

I get no parsing errors on any of my lua, and there's no errors in the log related to my changes.

 

However, even when I bind "Test Command" to a key, I don't seem to get any input when pressing that key.

 

When I parse a built-in command in like iCommandFlaps with a custom value of -1 (by changing default.lua to match) then I have no problem catching the input, but it doesn't seem as if my custom command (3001) is being caught.

 

This leads me to the following questions:

 

  • Is it possible to define custom commands and systems for an SFM+SSM model in lua? Or do I have to use an EFM/ASM with C++?
  • Is it required to define a paired cockpit device in clickabledata.lua to have custom commands?
  • Is there a published list of all internal commands? (e.g. iCommandXY)

 

my TESTDEV object behaves correctly and cycles through its states as expected, and the model animates correctly based on the state changes, I just can't seem to hook up the command properly.

 

Any help would be greatly appreciated, thanks!

Link to comment
Share on other sites

  • 1 month later...

One of the reasons you haven't seen an update for months (other than I'm busy) is that custom cockpit models are an order of magnitude more difficult than a custom aircraft model.

 

Aircraft models are relatively simple models with animated parts and table value plugins to get the aircraft in a flyable shape.

 

Cockpits tend to require custom logic. Every gauge needle, light, toggle switch, etc. is an animated item, but it is only the visual representation of a system of logic behind it.

 

You want to control the landing gear? That's really a combination of an electrical or engine driven hydraulic pump feeding pressure to a bunch of hydraulic lines, which are governed by hydraulic valves, which, when open, push on actuators, which force the gear struts in/out, while opposing and including wind forces. All these systems must work together to get an appropriate behavior of state, but in addition, they must work with the visual model as well.

 

In software development, we usually call this separation a Model-View-Controller architecture. In this case, the Model is the logic implementation of the hydraulic, electrical, and engine systems, the View is the 3DS Max model with animated parts, and the Controller is the bit of LUA code that governs how the logic Model is manipulated based on our interactions with the View (i.e. clickable switch).

 

I expect most everyone who is looking for help here couldn't care less about MVC or what it means, but if you are truly going to build a custom cockpit, you need to start thinking like this. The logic model is going to represent the state of the entire aircraft (e.g. gauge values, switch positions, control stick position, and yes, even control surface positions such as flaps and ailerons).

 

This becomes important as you progress beyond basic flight. For example, suppose you have a hydraulic systems failure. If you push the stick to the left, should the ailerons deflect with the stick position? Should the aircraft roll? Should placing the gear handle in the down position lower the gear? How long should it take to lower the gear?

 

The answers to these questions are determined by the logic of the systems in the aircraft and their interaction. The visual representation (e.g. gear dropping, stick deflection, ailerons deflecting) are only the visual representation of the logic model state at any given moment.

 

So, anyone wanting to build custom clickable cockpits needs to think about more than just a switch is something that translates into a LUA function call and I'm done. Yes, ED does provide some simplified systems implementations, but it's not exactly easy to figure out what all they do and how to use them.

 

I have to learn all of this myself prior to being able to boil it down into simple enough chunks for inclusion in a beginners guide. The guide will be updated eventually, but in the meantime, the forums are what we have for Q&A.

 

Red Beard

Link to comment
Share on other sites

  • 2 months later...
Hi.

 

I'm having trouble adding a custom command to my airplane...

 

I've added TestCommand into the device_commands structure in command_defs.lua, and given the value 3001 (start_command + 1 as per other examples in the DCS source tree)

 

I've added dev:listen_command(3001) to my management code, which is attached to devices.TESTDEV of type avLuaDevice in device_init.lua, and loads testdev.lua in Cockpit/Scripts/Systems.

 

My default.lua for keyboard has the following:

 

{down = device_commands.TestCommand, name = _('Test Command'), category = _('Systems')}

 

I get no parsing errors on any of my lua, and there's no errors in the log related to my changes.

 

However, even when I bind "Test Command" to a key, I don't seem to get any input when pressing that key.

 

When I parse a built-in command in like iCommandFlaps with a custom value of -1 (by changing default.lua to match) then I have no problem catching the input, but it doesn't seem as if my custom command (3001) is being caught.

 

This leads me to the following questions:

 

  • Is it possible to define custom commands and systems for an SFM+SSM model in lua? Or do I have to use an EFM/ASM with C++?
  • Is it required to define a paired cockpit device in clickabledata.lua to have custom commands?
  • Is there a published list of all internal commands? (e.g. iCommandXY)

 

my TESTDEV object behaves correctly and cycles through its states as expected, and the model animates correctly based on the state changes, I just can't seem to hook up the command properly.

 

Any help would be greatly appreciated, thanks!

 

Perhaps someone with more experience can actually comment for sure, but in all of the tests I have done AFM vs SFM, to make custom commands you have to use an AFM that calls functions from a .dll. No matter what I tried I could not get any commands to work that were not already lock-on commands used in the simple cockpits like the f15. Soon as I put them into a .dll and used that they all worked beautifully.

 

Basically anything that can be written as a "gauge" will work, but as far as I could find actual clickable buttons with custom commands don't work.

 

However, somehow the Hawk(I tested this pre-AFM) works without a .dll and so does the C101 as far as I can tell and they both have clickable devices....but they are both third parties with access to the SDK so they are unlikely to tell us how it works-----plus it could be their commands are hard-coded into the game.

Link to comment
Share on other sites

  • 2 months later...

Silver_Dragon bumped this thread, and it was a great one to start with.

 

Whatever my problems were in the past, we definitely have solved them and have dozens of custom commands to go with our cockpit. We (A-4E) were thinking of helping to update the documentation for the beginner's guide, because there's definitely more things we learned that don't seem to be covered or written down anywhere.

  • Like 1
Link to comment
Share on other sites

Silver_Dragon bumped this thread, and it was a great one to start with.

 

Whatever my problems were in the past, we definitely have solved them and have dozens of custom commands to go with our cockpit. We (A-4E) were thinking of helping to update the documentation for the beginner's guide, because there's definitely more things we learned that don't seem to be covered or written down anywhere.

 

 

 

Have you guys contacted RedBeard2, maybe you guys could compare notes and both move ahead.

 

Really appreciate the willingness to share. :thumbup:

Link to comment
Share on other sites

  • 3 months later...
  • 2 weeks later...
Perhaps someone with more experience can actually comment for sure, but in all of the tests I have done AFM vs SFM, to make custom commands you have to use an AFM that calls functions from a .dll. No matter what I tried I could not get any commands to work that were not already lock-on commands used in the simple cockpits like the f15. Soon as I put them into a .dll and used that they all worked beautifully.

 

Basically anything that can be written as a "gauge" will work, but as far as I could find actual clickable buttons with custom commands don't work.

 

However, somehow the Hawk(I tested this pre-AFM) works without a .dll and so does the C101 as far as I can tell and they both have clickable devices....but they are both third parties with access to the SDK so they are unlikely to tell us how it works-----plus it could be their commands are hard-coded into the game.

 

Clickable buttons are definitely possible with Lua only, with no dll at all. We have many custom controls in our A-4E mod, both for keyboard/joystick bindings as well as clickable (animated) cockpit buttons/dials/levers etc. If you are still stuck, I can try to post some minimal distilled example code of what is needed. It is not difficult, but does require a few things to all be correct for it to work.

____________

Heatblur Simulations

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

Clickable buttons are definitely possible with Lua only, with no dll at all. We have many custom controls in our A-4E mod, both for keyboard/joystick bindings as well as clickable (animated) cockpit buttons/dials/levers etc. If you are still stuck, I can try to post some minimal distilled example code of what is needed. It is not difficult, but does require a few things to all be correct for it to work.

 

Yeah I have since discovered exactly that. We really need a DCS modding Wiki badly so all of the information about modding is in one place.

Link to comment
Share on other sites

  • 2 weeks later...
Yeah I have since discovered exactly that. We really need a DCS modding Wiki badly so all of the information about modding is in one place.

 

As someone who's coming into DCS new, the information for this sort of stuff is extremely sparse and it would certainly be appreciated if those who know how do do stuff could share with those who want to learn.

Link to comment
Share on other sites

As someone who's coming into DCS new, the information for this sort of stuff is extremely sparse and it would certainly be appreciated if those who know how do do stuff could share with those who want to learn.

 

guides at building mods? cockpits,3d models? or just base game? cuss there are a few guides out there to help us get into making our own aircraft in game and how to texture them and much more.

 

you should try Begginers guide to DCS WORLD aircraft mods version 0.5.1 it has helped me in a great way with both 3dx max and dcs world modding.

Link to comment
Share on other sites

guides at building mods? cockpits,3d models? or just base game? cuss there are a few guides out there to help us get into making our own aircraft in game and how to texture them and much more.

 

you should try Begginers guide to DCS WORLD aircraft mods version 0.5.1 it has helped me in a great way with both 3dx max and dcs world modding.

 

You mean the guide thats in this very thread? I'd never have thought of that!

Link to comment
Share on other sites

Keep In Mind,

Most of the Guides/Docs Available Assume the User has some General to Advanced Knowledge of the Software in Use, whether that be 3DS Max, Adobe, dDo, Visual Studio, LUA, etc etc.

Windows 10 Pro, Ryzen 2700X @ 4.6Ghz, 32GB DDR4-3200 GSkill (F4-3200C16D-16GTZR x2),

ASRock X470 Taichi Ultimate, XFX RX6800XT Merc 310 (RX-68XTALFD9)

3x ASUS VS248HP + Oculus HMD, Thrustmaster Warthog HOTAS + MFDs

Link to comment
Share on other sites

Yes, I've seen a lot of requests for guides too, but really, the information was all there, albeit scattered. The bit that people miss is having a background in the relevant skill to be able to understand what they are seeing. Especially important in the case of modelling and texturing, which from a point of view of someone that hasn't created a model before in 3DS, seems ridiculously difficult. The LUA part, well, its LUA, in the main you can get by with copy and paste.

 

We contemplated putting together the information we found when we did our first very basic ship mod. And you know what, it's just a different type of 3DS tutorial which has been overdone on the internet. When we get to the advanced stuff, then again, its having a relevant background, i'd never make sense of applied maths either.

___________________________________________________________________________

SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING *

Link to comment
Share on other sites

You mean the guide thats in this very thread? I'd never have thought of that!

 

yes that guide,but be aware just like Skatezilla said is hard for those who do not have the experience in modeling and coding, i learned that the hard way, but i like the challange and the guide has really helped me a lot,same goes with other people of this community they all have been of great help.

Link to comment
Share on other sites

  • 4 weeks later...

I am just trying to prove that it is possible for me to get something into game, before I waste time trying to do something serious.

 

I'm trying to follow this guide as a very crash course in modding. I've managed to make my 3d shape (lets not call it a plane although it's roughly plane shaped - I am not a 3d modeller!). I've got the EDM plugin installed, and finally found a ModelViewer that worked.

 

I've made a single 512*512 bitmap of a red colour and attempted to apply that to the shape.

 

However, when I apply it, 1 the shape doesn't go red but grey? (Is that normal?)

 

Then when I try to "Make it Cool", I don't seem to get the special properties the guide mentions, and it doesn't elaborate on what I should be seeing. So I'm a bit confused.

 

When I export to ModelViewer, I see no object at all.

 

Appreciate any help or pointers.

Link to comment
Share on other sites

I am just trying to prove that it is possible for me to get something into game, before I waste time trying to do something serious.

 

I'm trying to follow this guide as a very crash course in modding. I've managed to make my 3d shape (lets not call it a plane although it's roughly plane shaped - I am not a 3d modeller!). I've got the EDM plugin installed, and finally found a ModelViewer that worked.

 

I've made a single 512*512 bitmap of a red colour and attempted to apply that to the shape.

 

However, when I apply it, 1 the shape doesn't go red but grey? (Is that normal?)

 

Then when I try to "Make it Cool", I don't seem to get the special properties the guide mentions, and it doesn't elaborate on what I should be seeing. So I'm a bit confused.

 

When I export to ModelViewer, I see no object at all.

 

Appreciate any help or pointers.

To be able to see an object in modelviewer Make sure you also put the textures of that object in dcs world folder or modelviewer standalone,with out textures you cant see anything or it shows up black,did you add textures to your modelviewer? you need both,EDM object and texture oh and make sure the textures are ether BipMap 24 or DDS.


Edited by cubanace
Link to comment
Share on other sites

  • 1 month later...

Hey guys, i'm trying to make a copy of the Su33 for further EFM modifications and i can't get some animations to work. Everything is showing up in the modelviewer provided by ED when i press enable animations but in game there's only cannons,afterburner's,ejection and shock absorbers animations working. Right now i'm following the guide and i can't find any part talking about lua to link the animations to the mod ? How does it work exactly ?


Edited by ked
Link to comment
Share on other sites

  • 2 months later...
Hey guys, i'm trying to make a copy of the Su33 for further EFM modifications and i can't get some animations to work. Everything is showing up in the modelviewer provided by ED when i press enable animations but in game there's only cannons,afterburner's,ejection and shock absorbers animations working. Right now i'm following the guide and i can't find any part talking about lua to link the animations to the mod ? How does it work exactly ?

 

The "Enable Animations" in model viewer is just a while loop that increments argument number from i=1 through i=1000 (i.e., it just cycles every possible argument from -1 to 1).

 

The default script itself is located in config/modelviewer/defaultanimations.lua

 

I imagine you could replace that code with your own custom code.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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