Jump to content

MOOSE - !!! Walk your LUA mission code using LDT debugger !!!


FlightControl

Recommended Posts

Dear DCS community!

 

I've written a complete manual now of the debug capability how to set it up properly...

 

The debugger capability has now been released to the master branch of the MOOSE repository.

 

From now on it has become an essential part of the framework.

 

Please consult the online documentation to setup the debugger here...

 

http://flightcontrol-master.github.i...bug_Guide.html

 

I'll make later some MOOSE for Dummies videos to go in depth on debugging and the various stuff that you can do.

 

Enjoy!

FC


Edited by FlightControl
  • Like 5

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

Great stuff! This will be very handy :thumbup:

A warrior's mission is to foster the success of others.

i9-12900K | MSI RTX 3080Ti Suprim X | 128 GB Ram 3200 MHz DDR-4 | MSI MPG Edge Z690 | Samung EVO 980 Pro SSD | Virpil Stick, Throttle and Collective | MFG Crosswind | HP Reverb G2

RAT - On the Range - Rescue Helo - Recovery Tanker - Warehouse - Airboss

Link to comment
Share on other sites

There is still a whole lot of things to sort out on this stuff...

 

1. Why is it that when white spaces are contained in folders, it results in strange path strings in the debugger.lua process? This kills the debugger.lua workings. I need to do research on this.

 

2. How to deal with "debug mode" and "run mode". It is very complicated. Loading a script dynamically from the .miz versus embedding a script in the .miz. This really needs to be given a big thought. There will be a change required in each test mission to allow for debug mode or test mode. Each mission designer will have to follow a process to accomodate this. So the process needs to be as simple as possible. Or 10000 questions will arise and the forums will be full of discussing people (again).

 

3. Documentation. Videos are nice, but the setup process should be written down. The LDT should be further explained. Q&A will come.

 

4. What about missions you get from somebody else, how to debug those... Needs to be thought about.

 

5. Is debug really working correctly? Are there no crashes?

 

The biggest challenge will be to EXPLAIN this to noob users who will really benefit from the debugger.

 

People see MOOSE as a wall of code and complexity. While in essence, it helps them to have more fun of the sim.

 

So, some homework is to be done to get this finished.

 

That being said, you are all welcome to "alpha" test with me this debugging capability. If you have questions, please ask.

 

The debugger is already helping me now to resolve issues of other people questions to give help.

 

FC

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

Yay! This is awesome! I'll give this a spin as soon as it's a bit more mature! (Just starting out with MOOSE and LUA, but I'm used to this from when I coded Java and it's super useful!)

  • Like 1

ASUS Z170-P w/ Intel i7-7700, 32GB DDR4 RAM, SSDs out the wazoo and a GTX 1080Ti,

Oculus Rift CV1, TM Warthog stick and throttle, TM Cougar MFDs, MFG Crosswind pedals and WheelStandPro Warthog (w/ the custom small Warthog plate)

 

Former F-16 Ground Crew @ RNoAF

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

This is fantastic - is there a link i can download and try this out?

 

How does this fare with scheduled functions setup with timer.scheduleFunction()?

 

Often times I find any errors that happen here are not reported in dcs log.

  • Like 1

Developer of Kaukasus Insurgency - a customizable Dynamic PvE Campaign with cloud hosting and stats tracking. (Alpha)

 

http://kaukasusinsurgency.com/

Link to comment
Share on other sites

This is fantastic - is there a link i can download and try this out?

 

How does this fare with scheduled functions setup with timer.scheduleFunction()?

 

Often times I find any errors that happen here are not reported in dcs log.

Scheduled functions can also be breakpoint and debugged. Check the first video on the moose YouTube channel. The one posted earlier. And follow the instructions.

 

Sent from my SM-N950F using Tapatalk

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

Awesome thank you so much for this, I have a massive project im working on with many files and many things going on at once, being able to debug in game when the logging fails is such a great feature to have.

 

Do you know if this also lets you step into the DCS libraries? Like what happens if you try to step into coalition.addGroup() for example?

Developer of Kaukasus Insurgency - a customizable Dynamic PvE Campaign with cloud hosting and stats tracking. (Alpha)

 

http://kaukasusinsurgency.com/

Link to comment
Share on other sites

If I wanted to learn more about coding LUA in general. Where would you recommend I look first. I'm starting down the rabbit hole of learning. I'm not ready to use a tool like this. What do I need to learn 1st? I know only enough that the breakdowns would be very helpful.

 

I can understand the syntax somewhat. But it's like reading a language where you don't know the vocabulary. I'm starting with reading your moose site.

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

If I wanted to learn more about coding LUA in general. Where would you recommend I look first. I'm starting down the rabbit hole of learning. I'm not ready to use a tool like this. What do I need to learn 1st? I know only enough that the breakdowns would be very helpful.

 

I can understand the syntax somewhat. But it's like reading a language where you don't know the vocabulary. I'm starting with reading your moose site.

There are many sources.

 

There are some great tutorials on the web regarding lua. The best I can recommend is lua Tutorialspoint.

 

https://www.tutorialspoint.com/lua/

 

Regarding moose and DCS world lua, I've created a series of lua tutorials for the DCS community...

 

 

And indeed, there is a web site with links to various places on moose too. Links are in my signature.

 

Suggest starters join our community at slack.com. it is great to share code and discuss stuff etc. But it is a closed community because slack works this way. Send me your email address in a private message and I'll join you up.

 

Fc

 

Sent from my SM-N950F using Tapatalk

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

I've made some progress today.

 

Finally white spaces are working. Sources are loading in the debugger.

 

I also changed the way how the debugger needs to be loaded.

Suggest you update MissionScripting.lua file in the Scripts folder of the DCS program files folder.

 

So here is a quick manual of the changes.

 

The LDT-Debug branch of the MOOSE repo on github has been added with a directory...

 

https://github.com/FlightControl-Master/MOOSE/tree/LDT-Debug/Moose%20Development/Debugger

 

This directory contains 2 files.

 

1. A revised debugger.lua file, which you need to copy into the dcs program root folder. (On my pc this is C:\Program Files\Eagle Dynamics\DCS World ).

 

2. A connection.lua file, which contains 3 lines of code that needs to be copied into the MissionScripting.lua file, at the place indicated in the comments of the file.

 

3. MissionScripting should not sanitize the io library. Comment that line out.

 

I've attached my MissionScripting.lua as an example in this thread.

 

So, when you have done this, and run a mission, if the debugger service is running, you'll run DCS World in debug mode ... (But you'll need to watch the first video and the second one).

 

But you need to load your sources dynamically, from the .miz file, no way around this. As explained in the video...

 

I've attached an example mission how to do this.

 

Ensure your baseline of the moose code on your pc is synched with branch LDT-Debug.

 

 

Also. Ensure that you setup the debugger configuration in LDT for the service to identify the sources in the workspace following "local" resolvement. (In LDT->Run->Debug Configurations...).

 

Then your sources will be loaded correctly while stepping through your mission logic and it will work.

 

You can setup breakpoints, watch variables, ... and debug my crappy moose code too ...

 

So these changes make the lua debugger available for ALL lua coders.

 

You can debug CTLD, MIST, MOOSE, your missions, you name it.

 

Enjoy!

 

FC

MissionScripting.lua

SPA-011 - Ground Ops - Simple Spawning.lua

SPA-011 - Ground Ops - Simple Spawning.miz

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

Dear DCS community!

 

I've written a complete manual now of the debug capability how to set it up properly...

 

The debugger capability has now been released to the master branch of the MOOSE repository.

 

From now on it has become an essential part of the framework.

 

Please consult the online documentation to setup the debugger here...

 

http://flightcontrol-master.github.i...bug_Guide.html

 

I'll make later some MOOSE for Dummies videos to go in depth on debugging and the various stuff that you can do.

 

(The previous videos will be deleted as they are confusing).

 

Enjoy!

FC


Edited by FlightControl

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

  • 7 months later...

Many thanks to FlightControl for his Herculean effort. Still, at the beginning of my journey in Moose space, I have Hummer spawning in a mission. This works nicely as FlightControl has described. However, if you try to load the mission dynamically nothing spawns. I've set up the debug facility according to the instruction video, which I've watched over and over again. The dynamic loading is done as follows: on mission start the following script is executed (DO SCRIPT): MOOSE.Include( "D:/LDTWorkspace/My_Missions/TestMission/","TestMisson.lua")

Does anyone have an idea what is wrong?

 

I found this in dcs.log:

2018-07-08 20:36:03.165 ERROR DCS: Mission script error: : [string "MOOSE.Include( "D:/LDTWorkspace/My_Missions/TestMission/","TestMisson.lua")"]:1: attempt to index global 'MOOSE' (a nil value)

stack traceback:

[C]: ?

[string "MOOSE.Include( "D:/LDTWorkspace/My_Missions/TestMission/","TestMisson.lua")"]:1: in main chunk

2018-07-08 20:36:03.200 INFO Lua: Lua CPU usage: metric: average mission execution: 50.1712 %


Edited by Hans Spaan
excerpt fromdcs.log added
Link to comment
Share on other sites

  • 1 year later...

I cant get the debugger to connect.

 

It gets to 70% in Eclipse but wont connect and debug the mission. Im not sure where Im missing out. Ill be happy to provide whatever info is needed to solve this. Its very frustrating.

 

This is what I get....

<terminated, exit value: 1>C:\Users\andyp\Documents\jre1.8.0_201\bin\java (Aug 13, 2019, 3:35:22 AM)

 

 

Along with this in the console:

 

Debugger v1.4.2

Debugger: Trying to connect to 127.0.0.1:10000 ...

Debugger: Connection succeed.

Exception in thread "main" com.naef.jnlua.LuaRuntimeException: ...in32.win32.x86_64\workspace\DCS MISSIONS\Border test.lua:9: attempt to index global 'SET_GROUP' (a nil value)

at com.naef.jnlua.LuaState.lua_pcall(Native Method)

at com.naef.jnlua.LuaState.call(LuaState.java:585)

at org.eclipse.ldt.support.lua52.internal.interpreter.JNLua52Launcher.run(JNLua52Launcher.java:128)

at org.eclipse.ldt.support.lua52.internal.interpreter.JNLua52DebugLauncher.main(JNLua52DebugLauncher.java:24)

Link to comment
Share on other sites

  • 2 months later...
  • Recently Browsing   0 members

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