Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.95.1a is out! (12/10/21); Blog post: Uniquifying the Factions, Part 2 (04/30/22)

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 - Kolokol

Pages: [1]
1
Hello!

I was wondering, maybe someone has done or has attempted to do a mod, that lets you visually change the paint job on a ship?
Like change the sprite of your Paragon to Ludic colours or Hegemony. Add in stripe/fractal/tribal effects to mix it a bit.

2
Modding / Re: [0.95a] Sensors - mod/utility for event popups on WIN 7/10
« on: September 23, 2021, 09:41:43 AM »
Do you have source code for this published somewhere? Some of us might be a little bit hesitant grabbing loose executables off the forums. Not that I don't trust you specifically or anything, just good practices and all that.

Hi!

No, not really. I understand your concern.
If you have reservations you can always inspect notification app executables with ILSpy as I do not obfuscate my code and it's written in C#.

log4net is a lib to help with data logging. Notifications app outputs log into "log" folder where you can monitor different events and add them at your leisure to "listenTo.xml" ruleset for more popups.

If app asks for internet connection, just set it to private, as mod and app share data via network.
Settings are set in:
Sensors.exe.config (app)
sensors_settings.json (mod)
You can change the port, localhost (127...) should remain.
"Tick" corresponds to data sharing intervals.

You can ask any questions you wish, or just check the insides by yourself.
Spoiler
[close]

3
Modding / Hi
« on: September 21, 2021, 01:13:00 PM »
Hello,

I have this mod idea, about fight simulation as I am not entirely sure how "Order your second in-command" works.

Would it be possible to make combat run REALLY fast? We do have with "SpeedUp" addon, but the idea would be to disable rendering, for faster processing, and run multiple simulations of fight at high speeds and provide a player an option to skip fight if the average of simulations satisfies him.

Maybe someone has done it already?

4
Modding / Re: [0.95a] Sensors - mod/utility for event popups on WIN 7/10
« on: September 18, 2021, 04:58:41 AM »
Got back to Starsector.
Updated the mod file for it to work with 0.95a.
Tested if everything works.
Updated the links.

5
This is experimental tool I've made to ease up AFK farming the cores whilst working on work stuff, due to recent "illnesses".

How probable your boss reading this right now?  ;D

Not sure, but if he would read it here, I would probably get a bonus payment  8)
Imagine him being able to farm cores and babysit planets, whilst working at the same time  8)

6
Modding / [0.95a] Sensors - mod/utility for event popups on WIN 7/10
« on: August 17, 2020, 11:13:25 AM »
Hello!

Do you like babysitting star system while planets are building stuff?
Do you like watching your AFK fleet decimate [REDACTED] for them sweet cores, 9 times in a row?
Do you like missing those Expeditions and AI Inspections?

No? Well, neither do I!

Sensors to the rescue!

This is a two component mod/utility made for Windows platform.

(SensorsAddon) Mod listens to the events and sends them over to notification utility. It is installed the same way the other mods are.
(SensorsNotifications) Notification utility shows popups in bottom right corner. Tested on both Win 10 and Win 7. You have to run it separately from the game. Its best to launch it first. (Sensors.exe)

Upon successful connection "Connected" popup should appear.
Spoiler


[close]

Another VERY important thing is "mute" option. In case you want to play the game normally. It is achieved by right clicking on "Sensors" icon in icon tray and clicking "Mute". Unmuting is done the same way.
Spoiler

[close]

Types of popups are:
Inspections
Expeditions
Pirate Activity
Combat results
Spoiler






[close]

This is experimental tool I've made to ease up AFK farming the cores whilst working on work stuff, due to recent "illnesses".
Please test it out on a new save file to see if it works for you, before using it on your pristine progression save.
Tests have been done on two machines, so if anyone encounters any issue, please post it.

If you have any questions, please post them here.

Download links are these:
Addon
Notifications application

7
I thought you were saying the default constructor wasn't getting called at all on load, which is why you needed something like readResolve() in the first place?

No no. It was getting called, but i did not understand why values where not being set. But now i understand.
First time object was created without any class fields and the game was saved.
On my next run, i added some fields to the class and run the debugger and was confused, as to why fields had no values on "active()", even tho constructor was clearly setting them.
Now i understand that the object from the first run, that had no class fields, was being loaded and that's why fields where null, even tho class constructor set them.
I had it tested by adding additional fields to class. After load old fields where set and new ones where null (even tho constructor was setting them).

But what confuses me a little is that object is restored and used, but the new object is also created and added to "sectorAPI.addScript(testEveryFrameScript);" yet it never fires or doesn't fire twice.

Also another thing that confuses me - if i create a different constructor, that sets additional data, that data won't be set for an already loaded object from a safe file as it will ignore whatever constructor does.

Correct. But: don't use static fields to put any data into! They will cause a giant memory leak when another game is loaded, since they'll still point at the previous game's data. Even if you think you might have some way of handling it, really, just don't :)

I am not storing the game data, i am storing reference to a custom message stack that is used to send data over socket, saving it has no value, as it gets cleaned as soon as data is sent over. But from what i understand from your post, that it's okay to use it as long as i don't use it to store game state related data.


Thank you very much for your responses!
I am a little on vacation right now, i plan to finish up my mod and show it to the world afterwards, maybe then it will be clearer what my goals are :D

8
Thank you! It worked like a charm.
Tho the general behaviour looks interesting. "readResolve()" fires first, and then class constructor is called and "readResolve()" set value is null, but whenever "advance()" fires it already has the proper value from "readResolve()".

Didn't configure Eclipse properly yet, so going out of the scope of callee displays class not found error, so i can't track lifecycle properly :D

If i set static fields, they will not be saved in save state, right?
My mod itself does not keep any useful game data, just implements CampaignEventListener and EveryFrameScript to pool/listen for events and store them in a separate message stack, which then gets dumped over to separate application via socket.

9
So i finally figured the issue with the object fields after some heavy debugging.

If i create EveryFrameScript with my custom fields, constructor will set them at the first run.
Then i save the game.
If i add brand new object field to existing class and add initialization in constructor, it will not take effect as soon as i load the game, that already uses the addon. Old fields will have their values whilst new one will not. (As the post above mentioned objects being loaded from a savefile)

But i do wonder - how other modders go about it? If they need to update something in addon that's already being used? Is there a way to invalidate stored object instances?

10
You want IntervalUtil. Lots of vanilla EveryFrameScripts use it, so just copy them.

Thanks! Will check it out latter! I've already been using "Global.getSector().getClock()", it has all i need for now.

Hmm, that's strange. The base game sets some values for various scripts in their constructors, and that works fine.

Do you mean after a save/load cycle, or just immediately? And is there any chance you might, say, be calling a different constructor than the one you're looking at? I'm somewhere around 99.9% sure this is "user error" of some sort :)

One thing to note: when a savegame is loaded, the default constructor for an object is *not* going to be called as it's re-instantiated. That's only called when you explicitly create the object.

I see, that might be the issue. I think i attach EveryFrameScript at the wrong time in lifecycle.

Code
@Override
public void onGameLoad(boolean newGame)
{
SectorAPI sectorAPI = Global.getSector();
if (sectorAPI != null)
{
socketTest = new SocketTest();
TestEveryFrameScript testEveryFrameScript = new TestEveryFrameScript(socketTest);
sectorAPI.addScript(testEveryFrameScript);
}
}

Edit: Damn, i do not know how. But today, when debugging, all object fields seem to persist. I have no idea how so, but ill continue to check it from time to time.

Edit 2: Is okay to fire off additional thread in mod? Need it to pass data via socket, don't want to clog main pipeline. Haven't tested if script launcher allows that.

11
Edit: Removed previous post text. After some debugging i noticed that non static fields retain their value if set in "advance(...)" method. If i set them in constructor, they will have default values, when next time accessed in "advance(...)". I still have suspicion that some object cloning is at place and values are not copied :D But maybe its some JAVA niuanse i am not familiar with.

Is it okay to use network socket to send data from addon to another application? Game doesn't like me using java.io.* package but found a working workaround, wonder if it's not something that is going to be patched in future.

12
Thank you!

I've managed to do it, but i've encountered another issue.

I've implemented "EveryFrameScript" in my custom class and then add it via
"Global.getSector().addScript(...);"
or
"Global.getSector().addTransientScript(...);"

But i can't store anything in object fields. Are objects recreated each time and only class type is stored?

E.g.
Code
public class TestEveryFrameScript implements EveryFrameScript {

long timestamp = Long.MIN_VALUE;

public TestEveryFrameScript()
{
timestamp = Global.getSector().getClock().getTimestamp();
}

        // other mandatory method implementations
}
Field "timestamp" is always 0, on every "advance" call.

I want to store timestamps, so the code in "advance" wouldn't be executed every frame. Are there any workarounds or maybe i should simply slap on "static" and be done with it?

13
Hello!

I am trying to find a way to get feed of events, that occur on bottom left side of screen.

At first i hooked up "CampaignEventListener", but from what i gathered, it does not have events i need.

Then i've stumbled upon "RaidIntel" (http://www.fractalsoftworks.com/starfarer.api/index.html?com/fs/starfarer/api/impl/campaign/intel/raid/RaidIntel.html). I am more interested in raids and inspections.
Since it implements "IntelInfoPlugin", i thought i could pool for it. So i implemented my own "EveryFrameScript" to pool for new plugins in "Global.getSector().getGenericPlugins()", so i could check if any intel module appears in there, yet nothing appears.

Maybe someone had stumbled into this before and knows where to find it?
To be more precise on my goals:
I need to pool (or listen) for new game events that occur in game on bottom left screen. (Raid, invasion, new bounty, new mission, INSPECTION)

Pages: [1]