Fractal Softworks Forum

Starsector => Mods => Modding Resources => Topic started by: Tartiflette on October 26, 2018, 01:15:15 AM

Title: [0.9.1] MagicLib v0.28 (2019/11/09)
Post by: Tartiflette on October 26, 2018, 01:15:15 AM
(https://i.imgur.com/OR5wYZM.jpg)


 The goal of MagicLib is to create an Open Source, community driven "library" of useful (and well documented) scripts and plugins that can be leveraged and contributed to by every modder.

All contributions are welcome!

(https://i.imgur.com/GMCkkky.png) (https://bitbucket.org/CodingTartiflette/magiclib/downloads/MagicLib_0.28.zip)
NexusMods mirror (https://www.nexusmods.com/starsector/mods/10/)
Requires LazyLib (http://fractalsoftworks.com/forum/index.php?topic=5444.0)


(https://i.imgur.com/8EpNARt.png) (http://starsector.wikia.com/wiki/MagicLib)


(https://i.imgur.com/AnkilqL.png) (https://bitbucket.org/CodingTartiflette/magiclib)


 Fully usable release, if anyone wants to contribute you are more than welcome to do so as it is intended to be community tool. Do check the Wiki to get a lot of details on the curent content.

Curent content:

Functions

    MagicAnim
A collection of functions to make smooth animations.

    MagicFakeBeam
Creates convincing ponctual beams from arbitrary coordinates.

    MagicLensFlare
Creates "cinematic" lensflares.

    MagicRender
Draw arbitrary sprites on screen with constraints to entities/camera when needed. (aka "SpriteRenderManager")

    MagicTargeting
Allows "smart" target selection for systems and missiles within distance and search cone parameters, plus it can use ship-class preferences.

    MagicTrails
Allows to create missile-style trails anywhere, from ships to bullets, with a lot of customization options. Also includes a CSV based manager that should be able to handle most projectile use cases with negligible overhead.

    MagicUI
Draws UI elements such as a system-like charge-bar/tick box next to the normal ship-system for special systems, or an extra status bar above the flux/hull bars.

Loose scripts
Scripts that can be used "as it is" or can be copied to individual mods to personalize the result.

    MagicVectorThruster
Manages vectoring or vernier-style attitude thrusters.

    MagicMissileAI
A very customizable and lightweight missile AI script usable without any java knowledge.

    MagicGuidedProjectileScript
A weapon script that allows regular projectiles to track their target.

Planned / considered content:

    MagicRotary
A loose script to make rotary weapons animations with smooth spin up and down.




Contributors:
Dark.Revenant (MagicUI)
Deathfly (MagicFakeBeam)
jtyotJOTJIPAEFVJ (MagicAnim.cycle)
Kitta Khan (bugfixes)
Nicke (MagicTrails, MagicGuidedProjectileScript)
Snrasha (MagicUI)
Tartiflette

(https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png) (http://creativecommons.org/licenses/by-nc-sa/4.0/)
MagicLib is licensed under a
Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License (http://creativecommons.org/licenses/by-nc-sa/4.0/).
Any derivative work must also comply with Starsector's EULA
Title: Re: [0.8.1] MagicLib v0.1 (2018/10/26)
Post by: Originem on October 26, 2018, 08:08:37 PM
I have a suggestion that,if you could provide a method that register the mod at the beginning of game, if there is no mod needs it, turn off all its plugins to prevent the possible waste of memory.
Title: Re: [0.8.1] MagicLib v0.1 (2018/10/26)
Post by: Midnight Kitsune on October 26, 2018, 08:29:43 PM
Why again do we need ANOTHER library? I'd rather not see SS turned into a version of minecraft with every mod having their own required library. This stuff could have been easily put into Graphics Lib...
Title: Re: [0.8.1] MagicLib v0.1 (2018/10/26)
Post by: Originem on October 26, 2018, 08:38:24 PM
Why again do we need ANOTHER library? I'd rather not see SS turned into a version of minecraft with every mod having their own required library. This stuff could have been easily put into Graphics Lib...
*Agree with you*
Title: Re: [0.8.1] MagicLib v0.1 (2018/10/26)
Post by: Tartiflette on October 27, 2018, 01:08:50 AM
Why again do we need ANOTHER library? I'd rather not see SS turned into a version of minecraft with every mod having their own required library. This stuff could have been easily put into Graphics Lib...
Because we have already several mods using stuf like direct sprite rendering or fake beams (including all of my owns) and incompatibility/versioning issues are already not uncomon. For example, for months all my mods had their visual effects removed due to another mod using an outdated version of the same plugin that overrode mine, leading to a waste of ressources because several instances of the same plugin with different names had to be run at the same time to avoid conflicts. Also this provides a whole bunch of methods that could improve new and existing mods.

And while some of this stuff could have been added to GraphicLib, a whole lot has no place in there. But be reassured: the intent is for this to be a community library, meaning that a-priori if it pickup no other library will ever be necessary. (Plus come on! That's just one thing to tick in your launcher for a lot of benefits on the modding side)

Is that a bad thing?
Title: Re: [0.8.1] MagicLib v0.1 (2018/10/26)
Post by: Tartiflette on October 27, 2018, 01:16:14 AM
I have a suggestion that,if you could provide a method that register the mod at the beginning of game, if there is no mod needs it, turn off all its plugins to prevent the possible waste of memory.
The two plugins currently present start with a check to see if something is using them or not, skipping them if that's not the case. They shouldn't have any performance impact if not used.
Title: Re: [0.8.1] MagicLib v0.1 (2018/10/26)
Post by: Takion Kasukedo on October 29, 2018, 11:55:10 AM
Why again do we need ANOTHER library? I'd rather not see SS turned into a version of minecraft with every mod having their own required library. This stuff could have been easily put into Graphics Lib...
Because we have already several mods using stuf like direct sprite rendering or fake beams (including all of my owns) and incompatibility/versioning issues are already not uncomon. For example, for months all my mods had their visual effects removed due to another mod using an outdated version of the same plugin that overrode mine, leading to a waste of ressources because several instances of the same plugin with different names had to be run at the same time to avoid conflicts. Also this provides a whole bunch of methods that could improve new and existing mods.

And while some of this stuff could have been added to GraphicLib, a whole lot has no place in there. But be reassured: the intent is for this to be a community library, meaning that a-priori if it pickup no other library will ever be necessary. (Plus come on! That's just one thing to tick in your launcher for a lot of benefits on the modding side)

Is that a bad thing?

When you put it that way, no it's not a bad thing, considering the benefits of having a -lib which other modders can contribute to.

This wouldn't come close to being some sort of Minecraft, mind. If it did, we'd be somewhere near square 1. This lib will, as stated, make it easier on others in the long run if successful.
Title: Re: [0.8.1] MagicLib v0.11 (2018/10/31)
Post by: Tartiflette on October 31, 2018, 01:13:29 AM
Micro update with proper Version Checker file (oops). On the other hand the Wiki documentation is now complete with all the current content.
Title: Re: [0.8.1] MagicLib v0.11 (2018/10/31)
Post by: TJJ on October 31, 2018, 03:00:35 AM
ponctual ?
Title: Re: [0.8.1] MagicLib v0.11 (2018/10/31)
Post by: Tartiflette on October 31, 2018, 03:01:30 AM
They deal all of their damage on their first frame., not over time like regular beams.
Title: Re: [0.8.1] MagicLib v0.11 (2018/10/31)
Post by: Nick XR on October 31, 2018, 08:34:55 AM
Any way this could be merged with lazy lib?  They seem like they encompass a similar mandate.
Title: Re: [0.8.1] MagicLib v0.11 (2018/10/31)
Post by: Tartiflette on October 31, 2018, 09:01:45 AM
Not really: LazyLib only provides passive and simple methods that are only used when called from a script and then return a result to that script. MagicLib on the other hand has multiple very complex plugins that do their own stuff over time when activated. Additionally LazyLib is an ubiquitous highly optimized precision tool that should not be tampered with lightly, thus not really suited for MagicLib's "Community Toybox" purpose.
Title: Re: [0.9.0] MagicLib v0.20 (2018/11/17)
Post by: Tartiflette on November 17, 2018, 01:37:55 AM
0.9.0 update! This library is now fully usable and contains quite a few very handy scripts. If a moderator can move this thread in modding ressources and add it to the mod index that would be great! Thanks.
Title: Re: [0.9.0] MagicLib v0.21 (2018/11/17)
Post by: Tartiflette on November 17, 2018, 09:03:38 AM
Oops, small update snafu, everything should work better now! Please redownload, sorry!
Title: Re: [0.9.0] MagicLib v0.23 (2019/03/03)
Post by: Tartiflette on March 03, 2019, 02:12:48 AM
Small update with a new trail render algorithm that should help a lot with trails that have a crisp texture, new UI elements functions to add proper status bars, and a CSV based plugin to efficiently manage projectile trails rather than having concurrent plugins in every mods.

Download available in the OP.
Title: Re: [0.9.0] MagicLib v0.24 (2019/03/07)
Post by: Tartiflette on March 07, 2019, 01:06:50 AM

0.24

MagicTrail CSV plugin:
   . Added a velocity randomization parameter.

MagicTargeting:
   . Fixed issue with random missile targeting only working in the front of the source ship.


Sorry for the frequent updates these days. This should be the final version for a while, I swear!
Download available in the OP.
Title: Re: [0.9.0] MagicLib v0.25 (2019/03/18)
Post by: Tartiflette on March 18, 2019, 02:02:19 AM
0.25

MagicTrail CSV plugin:
   . Added a bunch of default textures.
   . Fixed trail duplication bug on save reload from a battle.
   . Fixed trail_data corruption using Ron's editor

MagicFakeBeam:
   . Added spawnAdvancedFakeBeam that can use custom vanilla-like textures.


This one was meant for modders due to an issue with a popular editing program, but I added a few goodies to make it worthwhile for everyone.

This won't break saves obviously.
Title: Re: [0.9.0] MagicLib v0.25RC2 (2019/03/19)
Post by: Tartiflette on March 19, 2019, 12:06:52 AM
Once again I have to apologize for the multiple updates in a row, but I received help from more competent people and should have finally NAILED that string of bugs to the changelog.
Title: Re: [0.9.1] MagicLib v0.26 (2019/05/11)
Post by: Tartiflette on May 11, 2019, 09:55:37 AM
(https://i.imgur.com/OR5wYZMl.jpg)


0.9.1 update: Added render order overrides for MagicTrail and MagicRender, plus an optional override boolean for the CSV based Trail manager.

Download available in the OP (http://fractalsoftworks.com/forum/index.php?topic=13718.)
Title: Re: [0.9.1] MagicLib v0.26 (2019/05/11)
Post by: wolfraider on May 16, 2019, 10:52:41 AM
Hi, I have a problem on Linux:
https://ibb.co/vQYMYJ5 (https://ibb.co/vQYMYJ5)

Do you need a log file?
Title: Re: [0.9.1] MagicLib v0.26 (2019/05/11)
Post by: Snrasha on May 16, 2019, 01:07:21 PM
Hi, I have a problem on Linux:
https://ibb.co/vQYMYJ5 (https://ibb.co/vQYMYJ5)

Do you need a log file?

Just go on the path and rename the file "base_trail_fuzzy" per "BASE_trail_fuzzy", same for everything else, curse windows for that(He ignore lower/uppercase when he read pathname), i suppose. Tartiflette will out a fix probably soon, i think?
Title: Re: [0.9.1] MagicLib v0.26 (2019/05/11)
Post by: wolfraider on May 19, 2019, 06:38:17 AM
Thank you!
Title: Re: [0.9.1] MagicLib v0.26 (2019/05/11)
Post by: Glissa Ravidelle on May 23, 2019, 06:34:35 PM
Hi, I have a problem on Linux:
https://ibb.co/vQYMYJ5 (https://ibb.co/vQYMYJ5)

Do you need a log file?

Was just about to ask the same question on discord. Glad I checked here before bothering anyone.

Cheers Snrasha
Title: Re: [0.9.1] MagicLib v0.26 (2019/05/11)
Post by: silentsnack on May 25, 2019, 11:59:48 AM
Encountered a crash with ScyNation (whenever a SN ship enters combat) but the actual cause might be this error that appears when loading the game:

Spoiler
148451 [Thread-4] INFO  com.fs.starfarer.campaign.save.CampaignGameManager  - Loading stage 31
148451 [Thread-4] INFO  com.fs.starfarer.campaign.save.CampaignGameManager  - Loading stage 32
148451 [Thread-4] INFO  com.fs.starfarer.campaign.save.CampaignGameManager  - Loading stage 33
149043 [Thread-4] INFO  com.fs.starfarer.loading.LoadingUtils  - Loading CSV data from [DIRECTORY: C:\Program Files (x86)\Fractal Softworks\Starsector\starsector-core\..\mods\MagicLib]
149044 [Thread-4] ERROR data.scripts.plugins.MagicAutoTrails  - Invalid line, skipping
[close]
Title: Re: [0.9.1] MagicLib v0.26 (2019/05/11)
Post by: Tartiflette on May 25, 2019, 12:17:35 PM
Pretty sure that's your Scy mod that is outdated.
And even if it's not, that's not MagicLib that is at fault since this is just a debug line, not the actual line of the crash.
Title: Re: [0.9.1] MagicLib v0.26 (2019/05/11)
Post by: ShadowStalkar on May 28, 2019, 10:28:18 PM
I used only lazilib and magiclib to test does it work,and the game crashes,when i use only lazilib nothing happends,sadly lots of mods use magiclib so i have to fix this somehow
https://drive.google.com/file/d/10-7P61h5Mu9ot3rUYJwU-Y8jgQgm51dU/view?usp=sharing
If you need a log i can send one
Title: Re: [0.9.1] MagicLib v0.26 (2019/05/11)
Post by: Snrasha on May 29, 2019, 08:43:15 AM
I used only lazilib and magiclib to test does it work,and the game crashes,when i use only lazilib nothing happends,sadly lots of mods use magiclib so i have to fix this somehow
https://drive.google.com/file/d/10-7P61h5Mu9ot3rUYJwU-Y8jgQgm51dU/view?usp=sharing
If you need a log i can send one

You do not have the latest version of Starsector, maybe that?
Title: Re: [0.9.1] MagicLib v0.26 (2019/05/11)
Post by: ShadowStalkar on June 02, 2019, 11:15:28 AM
I used only lazilib and magiclib to test does it work,and the game crashes,when i use only lazilib nothing happends,sadly lots of mods use magiclib so i have to fix this somehow
https://drive.google.com/file/d/10-7P61h5Mu9ot3rUYJwU-Y8jgQgm51dU/view?usp=sharing
If you need a log i can send one

You do not have the latest version of Starsector, maybe that?
0.9a,wich is the latest,maybe i should check for updates but i dont think its that
Title: Re: [0.9.1] MagicLib v0.26 (2019/05/11)
Post by: Tartiflette on June 02, 2019, 01:37:25 PM
You should check because there has been an update.
Title: Re: [0.9.1] MagicLib v0.26 (2019/05/11)
Post by: atretador on August 01, 2019, 08:27:52 PM
So....had to rename all the files on ./MagicLib/graphics/magic/fx


Game wasnt been able to locate the correct file

Fatal: Error loadind [graphics/Magic/fx/BASE_trail_aura.png]

but the files on the fx folder were all on lower case....So, I renamed all the files and the game started normaly...after I fixed FDS and SCY.... xD

base_trail_aura -> BASE_trail_aura


Not sure if its a problem with my file manager, decompression method, or if the files are misnamed

I`m running the Linux version
Title: Re: [0.9.1] MagicLib v0.26 (2019/05/11)
Post by: Harmful Mechanic on August 01, 2019, 09:13:07 PM
It's just Linux case-sensitivity biting the rest of us, nothing you're doing.

I can't speak for anyone else, but these are some of the nicest, easiest bugfix requests I ever get, so I make a priority to fix themwhen someone points them out.
Title: Re: [0.9.1] MagicLib v0.27 (2019/08/07)
Post by: Tartiflette on August 07, 2019, 05:09:43 AM
(https://i.imgur.com/OR5wYZMl.jpg)

Small bugfixes update to solve the Linux case issue as well as the Screencheck culling function being too aggressive.

This won't break any saves or mods.

Download available in the OP (http://fractalsoftworks.com/forum/index.php?topic=13718.)
Title: Re: [0.9.1] MagicLib v0.27 (2019/08/07)
Post by: Shuhei on August 15, 2019, 02:19:15 AM
The mod crashes during the game loading phase. Updated Java to the newest version but it didn't solve the problem.

Quote
Code
[code]60965 [Thread-4] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(Unknown Source)
at java.util.ArrayList.get(Unknown Source)
at com.fs.starfarer.loading.scripts.ScriptStore.?00000(Unknown Source)
at com.fs.starfarer.settings.StarfarerSettings.o00000(Unknown Source)
at com.fs.starfarer.launcher.ModManager.getEnabledModPlugins(Unknown Source)
at com.fs.starfarer.loading.ResourceLoaderState.init(Unknown Source)
at com.fs.state.AppDriver.begin(Unknown Source)
at com.fs.starfarer.combat.CombatMain.main(Unknown Source)
at com.fs.starfarer.StarfarerLauncher$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
[/code]
Title: Re: [0.9.1] MagicLib v0.27 (2019/08/07)
Post by: Tartiflette on August 15, 2019, 05:02:55 AM
That's strange. Does it crashes with only MagicLib and LazyLib enabled?
Title: Re: [0.9.1] MagicLib v0.27 (2019/08/07)
Post by: Shuhei on August 15, 2019, 12:30:57 PM
Yeah, but I reinstalled the game and... well... it helped.
Title: Re: [0.9.1] MagicLib v0.27 (2019/08/07)
Post by: Dark on September 20, 2019, 05:33:53 PM
im getting a crash on startup from this mod, heres the log

47554 [Thread-4] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.RuntimeException: Error compiling [data.scripts.weapons.MagicVectorThruster]
java.lang.RuntimeException: Error compiling [data.scripts.weapons.MagicVectorThruster]
   at com.fs.starfarer.loading.scripts.ScriptStore$3.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: data.scripts.weapons.MagicVectorThruster
   at org.codehaus.janino.JavaSourceClassLoader.findClass(JavaSourceClassLoader.java:179)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   ... 2 more
Title: Re: [0.9.1] MagicLib v0.27 (2019/08/07)
Post by: Tartiflette on September 20, 2019, 11:28:18 PM
Are you sure you have the latest MagicLib mod ticked on in the launcher? That's all I can think of to cause that specific error.
Title: Re: [0.9.1] MagicLib v0.27 (2019/08/07)
Post by: Ed on September 26, 2019, 09:47:33 AM
Can objectspace() be used to simulate the effect of the phase cloak glow? Is there any code sample of this?
Title: Re: [0.9.1] MagicLib v0.27 (2019/08/07)
Post by: Tartiflette on September 26, 2019, 10:19:35 AM
It can but I think you'd be better off using a deco weapon.
Title: Re: [0.9.1] MagicLib v0.27 (2019/08/07)
Post by: Ed on September 26, 2019, 10:31:56 AM
It can but I think you'd be better off using a deco weapon.
You mean using the deco weapon with the glow sprite? I don't quite get how to simulate the effect, do you have a sample?
Title: Re: [0.9.1] MagicLib v0.27 (2019/08/07)
Post by: Tartiflette on September 26, 2019, 11:18:12 AM
Exactly that, there are many ships with deco weapons to simulate glow (Thalan comes to mind) and it requires only a little bit of code to get that running.
Title: Re: [0.9.1] MagicLib v0.27 (2019/08/07)
Post by: NoFoodAfterMidnight on October 18, 2019, 08:45:00 PM
When using magictrails, how do you make a trail texture not scroll and not move as it's generated the entire flight of the projectile? Currently the closest I can get it is to not scroll but then it stretches until the projectile disappears.

I'm trying to get a texture of some bubbles to look good, but if they're moving constantly or getting stretched it looks pretty bad.
Title: Re: [0.9.1] MagicLib v0.27 (2019/08/07)
Post by: Tartiflette on October 18, 2019, 10:05:43 PM
That's  a limitation of the current implementation. Static textures regardless of variable length is a tough nut to crack but you can talk to Nicke if you have ideas to solve it.
Title: Re: [0.9.1] MagicLib v0.27 (2019/08/07)
Post by: NoFoodAfterMidnight on October 18, 2019, 10:09:59 PM
Aww, RIP my dreams. Thanks though.
Title: Re: [0.9.1] MagicLib v0.28 (2019/11/09)
Post by: Tartiflette on November 09, 2019, 03:03:30 AM
(https://i.imgur.com/OR5wYZMl.jpg)

Added a couple new functionalities as per a few modder request:
MagicAnim.cycle (allows a variable to cycle within an arbitrary range)
MagicGuidedProjectileScript (allows projectiles to track their target)

This won't break any saves or mods.

Download available in the OP (http://fractalsoftworks.com/forum/index.php?topic=13718.)
Title: Re: [0.9.1] MagicLib v0.28 (2019/11/09)
Post by: Mongreal on December 15, 2019, 04:28:47 AM
Quote
MagicGuidedProjectileScript (allows projectiles to track their target)
What could prevent this script from working ?

Does this (well, it's not the complete script I'm using but it's the part used with projectile that use the MagicGuidedProjectileScript) should work ? :
Spoiler
Code
List<DamagingProjectileAPI> projectiles = engine.getProjectiles();
            int size = projectiles.size();
            for (int i = 0; i < size; i++) {
                proj = projectiles.get(i);
                String spec = proj.getProjectileSpecId();
                WeaponAPI mainWeapon = proj.getWeapon();

                if (mainWeapon.getShip().getShipTarget() != null) {
                    target = mainWeapon.getShip().getShipTarget();
                } else {
                    target = AIUtils.getNearestEnemy(proj);
                }

                switch (spec) {
                       case LIGHT_PLASMA_DART_PROJECTILE_ID:
                              isGuided = true;
                       break;

             if (isGuided) {
                  engine.addPlugin(MagicGuidedProjectileScript(proj, target));
             }
[close]