Debugging with VS Code

A place for discussion of making game modifications.
User avatar
sven
Site Admin
Posts: 1620
Joined: Sat Jan 31, 2015 10:24 pm
Location: British Columbia, Canada
Contact:

Debugging with VS Code

Postby sven » Fri May 11, 2018 11:33 pm

Recently, I've been playing with VS Code as an IDE for Stars in Shadow development. Some Korean game devs have written a very nice Lua debugger for it, and that means VS Code is now actually in many cases a better IDE for SiS than Visual Studio. It's also far easier to download and setup. If you're a modder, I'd suggest taking a look.

As of r37523 (which is currently "live" on Steam/GoG) you should be able to get setup as follows:

Install VS Code.
From your VS Code extensions tab, install the devCAT Lua Debugger.
From your VS Code extensions tab, Install sven2718's openhintvc extension.

Image

Go to File->Open Folder and open your "Lua state" dir.
In the VS Code debug pane, select launch-sis, and hit the green arrow.

Image

Now, if everything is working, the game should start in debug mode, and you should have access to both CTRL+click hotkeys and the ability to set breakpoints / view stack traces.

User avatar
siyoa
Posts: 182
Joined: Fri Apr 21, 2017 3:19 pm

Re: Debugging with VS Code

Postby siyoa » Sat May 12, 2018 2:46 am

works so far :)

now, when I click "New Game" and ctrl-click on race description file RACES.lua opens, but ctrl-clicking anywhere else (race picture, home world) nothing happens :?:
How did YOU get a key? All right, go in.

User avatar
sven
Site Admin
Posts: 1620
Joined: Sat Jan 31, 2015 10:24 pm
Location: British Columbia, Canada
Contact:

Re: Debugging with VS Code

Postby sven » Sat May 12, 2018 3:07 am

siyoa wrote:works so far :)

now, when I click "New Game" and ctrl-click on race description file RACES.lua opens, but ctrl-clicking anywhere else (race picture, home world) nothing happens :?:


the ctrl-click feature is not implemented everywhere in the game -- basically, trying to use it on a given text block will give you a hint how old the underlying sources are (the ctrl-click feature is /relatively/ new).

User avatar
siyoa
Posts: 182
Joined: Fri Apr 21, 2017 3:19 pm

Re: Debugging with VS Code

Postby siyoa » Sat May 12, 2018 4:43 am

ah, ok

I thought that that functionality is some kind of overlay, that brings the file up that contains the element
How did YOU get a key? All right, go in.

User avatar
sven
Site Admin
Posts: 1620
Joined: Sat Jan 31, 2015 10:24 pm
Location: British Columbia, Canada
Contact:

Re: Debugging with VS Code

Postby sven » Sun May 13, 2018 10:25 pm

Hmm. Apparently, most of the source files in SiS are encoded in Windows-1252, which VSCode will, by default, mis-label as UTF-8. This leads to text formatting glitches when VSCode re-saves any files that use extended characters, like '’' or '©'. There's a pretty simple fix though, which is to go to File->Settings and add the user settings overrides:

Code: Select all

    "files.encoding": "utf8bom",
    "files.autoGuessEncoding": true,

akkamaddi
Posts: 147
Joined: Tue Sep 26, 2017 5:11 am

Re: Debugging with VS Code

Postby akkamaddi » Sun Jul 21, 2019 3:21 am

I've just installed this, but the control click does not seem to be opening anything in VS Code. Does this still work? I'm trying to track down where "Capricious" is applied to morale.

User avatar
sven
Site Admin
Posts: 1620
Joined: Sat Jan 31, 2015 10:24 pm
Location: British Columbia, Canada
Contact:

Re: Debugging with VS Code

Postby sven » Mon Jul 22, 2019 10:00 pm

akkamaddi wrote:I've just installed this, but the control click does not seem to be opening anything in VS Code. Does this still work?


It should still work. I just installed it on a new computer, tested things out, and ctrl-click does work for me. But note that to enable debugging, you need to launch SiS from the VS-code debugger tab, not via Steam. (That "launch" configuration sets up some command-line switches and other things that are necessary to make the whole live coding system work.)

Also note that ctrl-click doesn't work everywhere in the game. One good place to test it is from the initial Race descriptions in the start-game menu.

User avatar
sven
Site Admin
Posts: 1620
Joined: Sat Jan 31, 2015 10:24 pm
Location: British Columbia, Canada
Contact:

Re: Debugging with VS Code

Postby sven » Mon Jul 22, 2019 10:15 pm

akkamaddi wrote:I'm trying to track down where "Capricious" is applied to morale.


As best as I can tell, implementing "Capricious" remains a "TODO". :oops:


Return to “Modding”

Who is online

Users browsing this forum: No registered users and 20 guests

cron