Fractal Softworks Forum

Please login or register.

Login with username, password and session length

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Ava_N

Pages: [1]
1
Modding / Re: API for events in combat?
« on: October 03, 2017, 09:34:06 PM »
So I'd probably build something like this and pitch for it to be included in LazyLib, since that's the only semi-mandatory code repo that the modders here are willing to adopt in large numbers :)

Good point, it's also easier for end-users to install one thing instead of five different things.

2
For breakpoint debugging, you can make a run configuration to attach a remote debugger:

1. Make a copy of your starsector-core/starsector.bat file and call it "debug-starsector.bat" (replace .bat with .sh for linux). This is not strictly necessary but highly recommended in case the bat file gets messed up.

2. Open the bat file and configure Java to start in a new process and open a debugger port. The "suspend=y" arg in there makes the JVM not run until a debugger actually connects.

Windows:
Code
start ..\jre\bin\java.exe -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005 <everything that comes after "java.exe" in the original file>

Linux:
Code
..\jre\bin\java.exe -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005 <everything that comes after "java.exe" in the original file> &
Don't forget the & at the end, it's what makes the command run in a separate process.

3. Create a run configuration that points to the new bat file, following kazi's original directions. Alternately, you can just change your existing configuration to point to the new file, but this will mess up the console.

4. Create a new remote debugging run configuration.
  a) Run -> Edit Configurations -> click "Remote" in the top left -> click "+"
  b) Name it "Debug Starsector"
  c) In the "Configuration" tab, in the "Before Launch" tab at the bottom, click "+" and add the configuration from step 3. This will make IntelliJ actually start StarSector before trying to connect to it.
  d) In the Logs tab, hit "+" in the top right and browse to your starsector.log file (should be in starsector-core). Alias it whatever you want, but "starsector.log" is probably a good idea.
  e) Hit "ok" on everything.

5. Set some breakpoints and run the new configuration by clicking the Debug (green bug) button next to the Run button. Easiest way to test if you've done it right is to set a breakpoint in an advance(), init(), or onApplicationLoad() methods in your mod.

Notes:
 - You may get a windows firewall popup when you first run the debugger. Click through it. You don't need to open any ports because it's all going through localhost, but windows firewall will still cry about it.
 - You'll notice that your normal console just says "Connected to the target VM, address: 'localhost:5005', transport: 'socket'". To see StarSector log output, switch to the starsector.log tab next to the console that should conveniently pop up for you.
 - If you see weird cut off logs, there's a drop-down in the top right of that window that lets you pick between "all", "infos","warnings", and "errors". Change to "all" to see the normal log you always see.
 - The StarSector process won't close when you disconnect the debugger.

3
Modding / API for events in combat?
« on: September 27, 2017, 07:26:17 PM »
Hi forum people!

Is there an API or library that gives access to combat events? Things like "ship got new target", "ship fired missile", "ship destroyed", etc. I was trying to add more events to Combat Chatter, and there seems to be no easy way of doing it.
 I've also looked at the source for a few other mods that have things trigger on combat stuff (Combat Alarms and Combat Analytics). Looks like everyone is saving values they want every frame and checking them the next frame to catch the edge signal.

So I'm guessing the answer is probably "no", but it doesn't hurt to ask.

If the answer is in fact "no", would people be interested in a library that made this easy?

Pages: [1]