Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.95a is out! (03/26/21)

Pages: 1 2 [3] 4 5 ... 14

Author Topic: [0.95a] LazyLib v2.6 (released 2021-03-26)  (Read 488566 times)

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1349
    • View Profile
    • GitHub Profile
Re: LazyLib v1.5 (.54.1a/.6a, released 2013-08-01)
« Reply #30 on: August 01, 2013, 01:34:13 PM »

1.5 is up, get it here (mirror).

Aside from some important bugfixes, the big additions are DefenseUtils (lets you check what defense is present at a location, or convert between armor grid and world coordinates) and AnchoredEntity (which allows for things like incendiary/acid weapons that stick to a target). There's also a few new methods in WeaponUtils to calculate how much damage a specific weapon would do to a specific target after all MutableStats are factored in. These methods aren't 100% accurate yet (I must be missing a stat somewhere), but they should be much closer than what you'd get through DerivedWeaponStatsAPI.

Regarding world coordinate -> armor grid conversions: if a modded ship has a center point that's not the center of the sprite there might be problems. There's no method in the current API that would allow me to compensate for this, unfortunately.

Changelog:
Quote
1.5 (August 01, 2013)
=======================
Re-added DefenseType enumeration (contains HULL, ARMOR, SHIELD, PHASE_OR_MISS)
Added AnchoredEntity:
 - Alternative implementation of CombatEntityAPI that follows and rotates
   alongside another CombatEntityAPI (the 'anchor')
 - Includes a working getVelocity() implementation, unlike SimpleEntity
Added DefenseUtils:
 - Contains methods to convert between world and armor grid coordinates
 - Can check what DefenseType is present at a specific point on a ship
Changes to AIUtils:
 - Fixed bug with canUseSystemThisFrame() always returning false for
   active toggleable systems that have a cooldown
Changes to CollisionUtils:
 - Fixed bug with isPointInBounds() and points exactly on the boundary edges
Changes to CombatUtils:
 - Added getFleetMember(ShipAPI ship), returns the FleetMemberAPI whose
   id matches this ship (or null if no match was found)
Changes to MathUtils:
 - Added equals(float a, float b), tests for 99.99999+% equality of floats
 - Added getRandom(), returns an instance of java.util.Random
   (this is the RNG used by LazyLib if you wanted to do seed manipulation)
Changes to WeaponUtils:
 - New methods to check how much damage you would deal to a specific target:
 - Added calculateActualDamage(float baseDamage, WeaponAPI weapon,
   ShipAPI target, DefenseType defense)
 - Added calculateDamagePerShot(WeaponAPI weapon, ShipAPI target,
   DefenseType defense)
 - Added calculateDamagePerSecond(WeaponAPI weapon, ShipAPI target,
   DefenseType defense)
 - Added calculateDamagePerBurst(WeaponAPI weapon, ShipAPI target,
   DefenseType defense)
 - These methods are not 100% accurate yet, still tracking down some oddities
« Last Edit: September 25, 2013, 02:11:28 AM by LazyWizard »
Logged

xenoargh

  • Admiral
  • *****
  • Posts: 4912
  • naively breaking things!
    • View Profile
Re: LazyLib v1.5 (.54.1a, released 2013-08-01)
« Reply #31 on: August 02, 2013, 01:23:49 AM »

Quote
getFleetMember(ShipAPI ship)
I don't suppose that means we can get the Variant id from the FleetMember then???  You know why, and I'm like, on the last 1% of the Rest of It :D

Quote
Re-added DefenseType enumeration (contains HULL, ARMOR, SHIELD, PHASE_OR_MISS)
Help me out- what is this good for?  I take it you use it with a Vector2f and this:
Quote
Can check what DefenseType is present at a specific point on a ship

Quote
Regarding world coordinate -> armor grid conversions: if a modded ship has a center point that's not the center of the sprite there might be problems. There's no method in the current API that would allow me to compensate for this, unfortunately.
Is it just going to be off the pixels of offset, or have more serious problems?  I often have centers offset on Y... if yes, guess I can just live with some inconsistencies.

Also, can we get a random armor grid and the location?  Sorry, that's probably really silly to ask, and if you've managed to solve this already, it's probably too trivial to ask, but I wanted to do something with ships occasionally catching on fire and stuff and taking long-term damage with some FX.

Quote
Fixed bug with isPointInBounds() and points exactly on the boundary edges
I forgot to mention I've been using CollisionUtils.getCollisionPoint() a lot, but I'm seeing a lot of null results even though the target is a valid CombatEntity.  This happens most often with little things like drones.  Any idea?

Oh, and I have a few requests, hopefully not stupid / too hard:

1.  Vector2f RandomPointOnLineSegment(Vector2f start, Vector2f end) - self-explanatory, want to use it for various FX things.
2.  Boolean ShipDeadThisFrame() - I've found that while I can get the hull and if < threshold I get a good result... but with Hulks I am not seeing them return any values as to hitpoints and suchlike.  They're also no longer reporting isFighter() etc., as normal.  Probably need to direct that at Alex.
3.  Vector2f RandomConeVector(Vector2f startingVector, degrees) - would return a new Vector2f that randomly differs from the startingVector (for example, the vector pointing from a weapon's point location along the current velocity) by degrees +/-.  Would be very useful for impact FX stuff, etc., etc.
4.  Vector2f RandomCircularVelocity(Vector2f point, minMagnitude, maxMagnitude) - a nice, newbie-friendly method for making dispersion patterns that use circles for random distribution.
5.  Vector2f nextPointonVector(Vector2f start, amount) A way to translate something's velocity vector into a point +/- along the Y.  For example, that cannon that shoots "through" things uses a method like that, where it extended the line and then backtracked to a collision and so forth.  It'd be nice to have that consolidated in a LazyLib routine- just put 10000f into amount, then CollisionUtils.getCollisionPoint()...

Anyhow, very sorry if any of this is too stupid to bother with, I need some sleep and I'm very excited about what's going to be possible with all of this :)
Logged
Please check out my SS projects :)
Xeno's Mod Pack

xenoargh

  • Admiral
  • *****
  • Posts: 4912
  • naively breaking things!
    • View Profile
Re: LazyLib v1.5 (.54.1a, released 2013-08-01)
« Reply #32 on: August 02, 2013, 07:52:03 PM »

Quote
I don't suppose that means we can get the Variant id from the FleetMember then???  You know why, and I'm like, on the last 1% of the Rest of It
Nevermind about all that- I got the problem solved  :D
Logged
Please check out my SS projects :)
Xeno's Mod Pack

xenoargh

  • Admiral
  • *****
  • Posts: 4912
  • naively breaking things!
    • View Profile
Re: LazyLib v1.5 (.54.1a, released 2013-08-01)
« Reply #33 on: August 03, 2013, 12:08:06 AM »

Sorry for the triple-post.  Here is a solution for the random velocity vector pointing away from a given point (generally, we need this for random velocities in special effects, where this comes up a lot, because square distributions are ugly and circular distributions may not be what we need, because we need precise control over speeds).  Feel free to use it, I know it was fairly trivial but it's probably something a lot of people are going to need :)

Code
		
/**
* Returns a {@link Vector2f} velocity vector pointing from {@code position}
*
* @param position -- The origin of the vector.
* @param velocity -- the velocity we wish to have going randomly away from the origin.
* @return newVel -- A {@link Vector2f} pointing at {@code destination} that is the velocity.
*/
public static Vector2f randomCircularVelocity(Vector2f position,float velocity)
{
Vector2f velPos = MathUtils.getRandomPointOnCircumference(position, velocity);
Vector2f newVel = Vector2f.sub(velPos,position,null);
return newVel;
}
« Last Edit: August 03, 2013, 12:10:05 AM by xenoargh »
Logged
Please check out my SS projects :)
Xeno's Mod Pack

Okim

  • Admiral
  • *****
  • Posts: 2146
    • View Profile
    • Okim`s Modelling stuff
Re: LazyLib v1.5 (.54.1a, released 2013-08-01)
« Reply #34 on: September 14, 2013, 12:23:31 AM »

Hi.

Just informing you that LazyLib causes problems with the new 0.6a. The issue is in missing sound files and their new IDs.

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1349
    • View Profile
    • GitHub Profile
Re: LazyLib v1.5 (.54.1a, released 2013-08-01)
« Reply #35 on: September 14, 2013, 12:36:14 AM »

LazyLib doesn't use any sounds. The problem would have to be with another mod you're running - sounds.json changed a lot in .6a, and most mods that used vanilla sounds will need an update to be compatible.
Logged

Okim

  • Admiral
  • *****
  • Posts: 2146
    • View Profile
    • Okim`s Modelling stuff
Re: LazyLib v1.5 (.54.1a, released 2013-08-01)
« Reply #36 on: September 14, 2013, 11:39:30 PM »

Hm. That`s odd as i got errors with LazyLib shown in it as  source.

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1349
    • View Profile
    • GitHub Profile
Re: LazyLib v1.5 (.54.1a, released 2013-08-01)
« Reply #37 on: September 14, 2013, 11:44:12 PM »

Did the error look something like this?

Code
21408 [Thread-5] ERROR com.fs.starfarer.combat.D  - java.lang.RuntimeException: Error loading [sounds/fx/beams/fire_beam_burst03.ogg] resource, not found in [C:\Users\Rob\Programs\Starfarer\starsector-core\..\mods\Exerelin,C:\Users\Rob\Programs\Starfarer\starsector-core\..\mods\LazyLib,../starfarer.res/res,CLASSPATH]
java.lang.RuntimeException: Error loading [sounds/fx/beams/fire_beam_burst03.ogg] resource, not found in [C:\Users\Rob\Programs\Starfarer\starsector-core\..\mods\Exerelin,C:\Users\Rob\Programs\Starfarer\starsector-core\..\mods\LazyLib,../starfarer.res/res,CLASSPATH]
at com.fs.util.C.Ò00000(Unknown Source)
at com.fs.util.C.Ó00000(Unknown Source)
at com.fs.starfarer.loading.OooO.super(Unknown Source)
at com.fs.oOOO.super.new(Unknown Source)
at com.fs.starfarer.combat.D.o00000(Unknown Source)
at com.fs.starfarer.StarfarerLauncher$2.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

If it does, LazyLib is listed because the game searches every mod folder for resources before giving up. All active mods should be included in that error message.
« Last Edit: September 14, 2013, 11:54:14 PM by LazyWizard »
Logged

Okim

  • Admiral
  • *****
  • Posts: 2146
    • View Profile
    • Okim`s Modelling stuff
Re: LazyLib v1.5 (.54.1a, released 2013-08-01)
« Reply #38 on: September 15, 2013, 02:34:16 AM »

Ah. I see. And due to LazyLib being the last in my list - it roars on it.

Sorry :)

x Daedalus

  • Ensign
  • *
  • Posts: 8
    • View Profile
    • Email
Re: LazyLib v1.5 (.54.1a, released 2013-08-01)
« Reply #39 on: September 23, 2013, 06:39:24 AM »

- About to start work on a mod of my very own

- Start looking into LazyLib

- Cry with joy.
Logged

redshiprader

  • Ensign
  • *
  • Posts: 2
    • View Profile
    • Email
Re: LazyLib v1.5 (.54.1a, released 2013-08-01)
« Reply #40 on: September 23, 2013, 07:21:13 PM »

When are u updating?
Logged

ValkyriaL

  • Admiral
  • *****
  • Posts: 2145
  • The Guru of Capital Ships.
    • View Profile
Re: LazyLib v1.5 (.54.1a, released 2013-08-01)
« Reply #41 on: September 23, 2013, 10:46:44 PM »

He just did... 1.5
Logged

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1349
    • View Profile
    • GitHub Profile
Re: LazyLib v1.5 (.54.1a/.6a, released 2013-08-01)
« Reply #42 on: September 25, 2013, 02:30:12 AM »

When are u updating?

I'll release the next version after .6.1a, as there's a bug in .6a that can cause crashes with some of the changes I've made. Luckily, 1.5 seems to be completely compatible with .6a. :)

The changes in 1.6 are mostly deprecating everything that is now included in the API, although there are a few changes that are important:
  • WeaponUtils' getDamage() methods will no longer be maintained.
  • AIUtil's methods will now filter out entities that aren't visible.
  • MathUtil's getDistance() methods involving SectorEntityTokens take interaction radius into account - meaning two fleets whose circles are overlapping are now considered at 0 distance from each other.

Here's the changelog so far:
Quote
1.6 (soon)
============
Updated the codebase to use the new .6a methods
Deprecated several methods whose functionality is now included within the API
Usage of deprecated methods is now reported in starsector.log
Changes to AIUtils:
 - All methods now only return entities that are visible on the battle map.
   Note: this change may alter the behavior of existing scripts!
   (use CombatUtils if you wish to find ships regardless of fog of war coverage)
Changes to CollectionUtils:
 - SortXByDistance constructors now have an optional includeRadius parameter
   that sets if collision/interaction radius is considered (defaults to true)
 - implode() works with any Collection, not just one containing Strings
 - Deprecated CollectionUtils.SortObjectivesByDistance as BattleObjectiveAPI
   now extends CombatEntityAPI (use SortEntitiesByDistance instead)
 - Deprecated weightedRandom(Map pickFrom) in favor of
   com.fs.starfarer.api.util.WeightedRandomPicker
 - Deprecated weightedRandom(Map pickFrom, int numToPick) in favor of
   com.fs.starfarer.api.util.WeightedRandomPicker (call pick() multiple times)
Changes to CombatUtils:
 - No longer implements EveryFrameCombatPlugin
 - Deprecated getCombatEngine() in favor of Global.getCombatEngine()
 - Deprecated getElapsedCombatTime() in favor of
   CombatEngineAPI,getTotalElapsedTime()
 - Deprecated getElapsedCombatTimeIncludingPaused() in favor of
   CombatEngineAPI,getTotalElapsedTime()
 - Deprecated getTimeSinceLastFrame() in favor of
   CombatEngineAPI.getElapsedInLastFrame()
Changes to DefenseUtils:
 - Deprecated getArmorCellAtWorldCoord(ShipAPI ship, Vector2f loc)
   in favor of ArmorGridAPI.getCellAtLocation(Vector2f loc)
Changes to MathUtils:
 - Added getRandomPointOnLine(Vector2f lineStart, Vector2f lineEnd)
 - Added isPointOnLine(Vector2f point, Vector2f lineStart, Vector2f lineEnd)
 - The various getDistance() methods involving SectorEntityTokens now
   take interaction radius into account. Note: this change may alter the
   behavior of existing scripts!
 - getDistanceSquared() methods incorporating a radius are no longer marked
   as deprecated, instead the documentation includes a warning that using
   getDistance() may be just as efficient
Changes to WeaponUtils:
 - All calculateDamage() methods are now marked as deprecated. There are just
   too many factors going into damage for this to be testable (26 MutableStats
   that affect damage dealt/taken as of .6a, let alone armor damage reduction).
« Last Edit: September 25, 2013, 03:23:33 AM by LazyWizard »
Logged

Zaphide

  • Admiral
  • *****
  • Posts: 799
    • View Profile
Re: LazyLib v1.5 (.54.1a/.6a, released 2013-08-01)
« Reply #43 on: September 25, 2013, 08:55:47 PM »

MathUtil's getDistance() methods involving SectorEntityTokens take interaction radius into account - meaning two fleets whose circles are overlapping are now considered at 0 distance from each other.

How much (or is it) more 'expensive' performance-wise is this over getDistanceSquared()?

It would be a great solution to the 'hover' on SectorEntityToken issue with my mining code :)
Logged

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1349
    • View Profile
    • GitHub Profile
Re: LazyLib v1.5 (.54.1a/.6a, released 2013-08-01)
« Reply #44 on: September 25, 2013, 09:04:24 PM »

MathUtil's getDistance() methods involving SectorEntityTokens take interaction radius into account - meaning two fleets whose circles are overlapping are now considered at 0 distance from each other.

How much (or is it) more 'expensive' performance-wise is this over getDistanceSquared()?

It would be a great solution to the 'hover' on SectorEntityToken issue with my mining code :)

The only major difference is that getDistance() has to calculate a square root. So while it's much slower than getDistanceSquared(), it's still not really _that_ expensive unless you go crazy with it.

getDistance():
Code
    public static float getDistance(SectorEntityToken token1, SectorEntityToken token2)
    {
        return Math.max(0f, getDistance(token1.getLocation(), token2.getLocation())
                - (token1.getRadius() + token2.getRadius()));
    }

    public static float getDistance(Vector2f vector1, Vector2f vector2)
    {
        float a = vector1.x - vector2.x;
        float b = vector1.y - vector2.y;
        return (float) Math.hypot(a, b);
    }

getDistanceSquared():
Code
    public static float getDistanceSquared(Vector2f vector1, Vector2f vector2)
    {
        float a = vector1.x - vector2.x, b = vector1.y - vector2.y;
        return (a * a) + (b * b);
    }
Logged
Pages: 1 2 [3] 4 5 ... 14