Jump to content

[Mod] Detailed Turret Tooltips


lyravega

Recommended Posts

Hey Lyravega, thanks for your comments. 

 

I eventually got that about Fire Rate.  I asked that question before I had yet looked at any code.  :)

 

"adding more components to a turret should never decrease the DPS..." I specifically saw the eDPS going *down* when adding additional parts to a launcher.  I couldn't understand why it was happening due to the limited amount of data present in the UI.  That was my original reason for looking into the code anyway, but while digging through that reason became less important to me than all the other cool things that could be done.  At one point I did notice the same thing happening in my code.  In my case it was being caused by not capping generated heat to max heat.  If a weapon can actually get hotter than max heat then I do indeed need to revisit that. 

 

That brings me to the Entity:getTurret()/getTurrets() API.  I was trying to call those today from another script so that I could query the current heat of a weapon.  For some reason all I get back is another Entity object from either of those calls.  Is this a bug or am I supposed to be casting/converting the returned object somehow?  Sorry, I'm new to this.

 

So, regarding your three points.  (Thank you very much, by the way!)

1) So one thing I noticed is that there's turret totals and weapon totals.  The turret shots per second value already seems to take into account the total of the weapons.  This led me to the conclusion that the turret data can be used rather than calculating out the totals via active weapons, and individual barrel damage.  (At least for the weapons I looked at it was correct and it matched 100% with the developer's DPS calculations.).  As for simultaneous weapons, it appears to me as if that may not affects DPS.  My understanding is that it just means all of the weapons fire at the same time and the same rate, but they don't actually fire faster.  So 4 barrels with 3 shots/per second each will still fire at a total of 12 shots per second regardless of whether they are coordinated to shoot simultaneously or not.

 

2) I'm trying to dig further into max heat, but having trouble verifying it one way or the other due to the API problem that I mentioned earlier.  You're correct in that I made the assumption that a weapon couldn't get hotter than max heat.

 

3) In this case my calculations appear to be correct.  Where a weapon cools down faster than it heats up then my script sets the heatCoolRatio to 1.  So anything that doesn't accumulate heat has no impact on DPS.

 

Hey, I like this collaboration thing!  I didn't really want to go into competition with your script, but I also did want a few things slightly different.  One thing that I realize now is that I really liked how your script highlighted Independent Targeting at the bottom.  I missed that when I went back to playing the game.

 

Link to comment
Share on other sites

  • Replies 132
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

*snip*

 

You can notice the max heat thing if you have a super-heat-generating turret that generates like 90% heat with one shot. The 2nd shot will take it beyond 100%, lets assume it has a 10% cooling between shots, the next shot will take it to 170% heat. If you can get the turretfactory seed for that particular example where adding components decreases DPS, I'd like to check that out though.

 

Entity() differs from script to script, I think the best way to find the turrets is to get player, then player's ship and so on. Never used those though, at one time I tried to so that I could provide better stats for energy weapons, but I wasn't able to access to the player ship stats. As I've said though, after failing to access those stuff, I didn't try again. Be cautious about where/when you execute your script though, you don't want to execute stuff unnecessarily.

 

You probably have noticed, instead of "obj" (turret or fighter) I use "wpn" in some cases (wpn is obj:getWeapons(), I only need the first weapon as all weapons are identical on a turret). The reason for this is to simplify some stuff for me, and I had a case once when a turret spawned without any weapons. Then I realized I could use it instead of obj for most cases. Anyway, back to the point...

 

If a multi-weapon (multi-barrel) turret doesn't have anything special on it, the weapons take turns actually, except the continuous stuff which gave me a headache back in the day. Lets say it is a turret with 4 barrels, and the turret states 1/s for its fire rate, the individual weapons actually has 0.25s fire rate. But if the turret has "simultaneousShooting", when you fire, all of the weapons fire at the same time. This is shown on the vanilla UI as well, however there is another type of multi-shot.

 

"shotsFired" is normally 1 for most weapons, but for some it can be 2 or 3. For these turrets, when you fire, you fire multiple projectiles at the same time. So a damage value of 1000 actually becomes 2x1000. This was missing in the vanilla UI I think. I really can't remember right now but I think simultaneousShooting is included in the vanilla calculations, but this multi-shot is not. Heat generation stays the same since it is still just one weapon shooting (multiple at once). For simultaneousShooting it is a different case though; if a turret's heatPerShot is 0.2, and the turret has simultaneousShooting, the actual heat generation is 0.2*weaponAmount.

 

If you want to test max heat properly, I suggest you to find a weapon with massive heat generation. I was a hoarder, I had hundreds of loot when I was writing this mod, and some of the weapons surprised me. I've seen weapons that overheat with just one shot, simultaneous+multishot weapons that fired 12 projectiles with one shot, and so on. Unless the developers hard-capped it to 100%, I'm pretty sure they go beyond 100% as I've stated earlier.

 

Also, don't think it as a competition or anything like that. This is perhaps my 15th game that I've made mods for, and for any game that I worked on, whenever I or someone else made a mod that had similar functionality to another, I have always seen it as an opportunity to learn or to teach or just to work together.

 

You want to provide extra information in your mod for example, my first iterations of the mod was a colossal wall of text per tooltip believe me :) I had to dilute the information somehow, and compress it in a way. I used to use heat:cooling ratio as well but decided not to use it as shooting faster meant overheating sooner, and some weapons have way long cooldown periods. eDPS staying the same looks funny and incorrect till you include those cooldown periods and it surprises you.

 

Still, it's much better and correct than what vanilla offers though. At the very least, you get to see heat/cooldown stuff, which was the main point of the mod :) I'll go over all of my calculations someday, but thinking of the headaches I've suffered trying to figure out some stuff, it's not any day soon!

Link to comment
Share on other sites

*snip*

 

Entity() differs from script to script, I think the best way to find the turrets is to get player, then player's ship and so on. Never used those though, at one time I tried to so that I could provide better stats for energy weapons, but I wasn't able to access to the player ship stats. As I've said though, after failing to access those stuff, I didn't try again. Be cautious about where/when you execute your script though, you don't want to execute stuff unnecessarily.

 

I wrote a different small mod to create a "Watch Window" for debugging purposes in which I intended to view certain variables such as heat.  For heat, I actually did exactly what you're suggesting here which is to get the player then his craft then the array of turrets.  Both getTurret() and getTurrets() returned a single entity rather than a TurretTemplate. 

 

Link to comment
Share on other sites

*snip*

 

Entity() differs from script to script, I think the best way to find the turrets is to get player, then player's ship and so on. Never used those though, at one time I tried to so that I could provide better stats for energy weapons, but I wasn't able to access to the player ship stats. As I've said though, after failing to access those stuff, I didn't try again. Be cautious about where/when you execute your script though, you don't want to execute stuff unnecessarily.

 

I wrote a different small mod to create a "Watch Window" for debugging purposes in which I intended to view certain variables such as heat.  For heat, I actually did exactly what you're suggesting here which is to get the player then his craft then the array of turrets.  Both getTurret() and getTurrets() returned a single entity rather than a TurretTemplate.

 

getTurrets() should return multiple stuff, but if the assignment is like "turrets = X:getTurrets()" only the first entity will be assigned, "turrets = {X:getTurrets()}" should work. That might be what you are experiencing.

Link to comment
Share on other sites

That's an excellent tip, thanks!

 

Here's the problem though, the getTurret() and getTurrets() functions both return an Entity (as documented), not a TurretTemplate which is what I was hoping for.  I can't seem to find any way to retrieve the run-time data from a turret.  Once I retrieve the turret's entity I don't know how to dig any further.

 

function test()
print("player is " .. player.name)
    local craft = player.craft

    if not craft then return end	
print("craft is " .. craft.name)
local numTurrets = craft.numTurrets	
if (numTurrets < 1) then return end
    
local turrets = { craft:getTurrets() }
for k,turret in pairs(turrets) do
	if (turret.isTurret) then
		print("This IS a turret.")
	end
	ShowMetaTable(turret)               <--- Inspecting this shows it is an Entity
end
end

Link to comment
Share on other sites

*snip*

 

I remember that I was trying to access the ship power generation and battery size, but I didn't find a way to dig further either. There is a chance that some stuff might not be exposed to the modders. I didn't dig it that much though, there can be a way but I wasn't able to find it.

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

I'm getting a bunch of these in the clientlog:

 

2018-01-06 20-30-30| could not execute function 'FighterMerchant.renderUI' in '"data/scripts/entity/merchants/fightermerchant.lua"':
2018-01-06 20-30-30| data/scripts/lib/tooltipmaker.lua:29: attempt to index local 'wpn' (a nil value)
2018-01-06 20-30-30| stack traceback:
2018-01-06 20-30-30| 	data/scripts/lib/tooltipmaker.lua:29: in function 'fillWeaponTooltipData'
2018-01-06 20-30-30| 	data/scripts/lib/tooltipmaker.lua:651: in function 'makeFighterTooltip'
2018-01-06 20-30-30| 	data/scripts/lib/sellablefighter.lua:37: in function 'getTooltip'
2018-01-06 20-30-30| 	data/scripts/lib/shop.lua:844: in function <data/scripts/lib/shop.lua:829>
2018-01-06 20-30-30| 	(...tail calls...)

 

Everything seems to be working, but i don't really know. Just saw them accidentally. I added the mod just less than week ago.

Link to comment
Share on other sites

I'm getting a bunch of these in the clientlog:

 

2018-01-06 20-30-30| could not execute function 'FighterMerchant.renderUI' in '"data/scripts/entity/merchants/fightermerchant.lua"':
2018-01-06 20-30-30| data/scripts/lib/tooltipmaker.lua:29: attempt to index local 'wpn' (a nil value)
2018-01-06 20-30-30| stack traceback:
2018-01-06 20-30-30| 	data/scripts/lib/tooltipmaker.lua:29: in function 'fillWeaponTooltipData'
2018-01-06 20-30-30| 	data/scripts/lib/tooltipmaker.lua:651: in function 'makeFighterTooltip'
2018-01-06 20-30-30| 	data/scripts/lib/sellablefighter.lua:37: in function 'getTooltip'
2018-01-06 20-30-30| 	data/scripts/lib/shop.lua:844: in function <data/scripts/lib/shop.lua:829>
2018-01-06 20-30-30| 	(...tail calls...)

 

Everything seems to be working, but i don't really know. Just saw them accidentally. I added the mod just less than week ago.

 

Seems like a fighter had no weapons on it. I'll fix it soon.

Link to comment
Share on other sites

Very nice mod I gave it a try yesterday and will keep it

There is just a little bug that prevent to view the tooltip for the new cargo "fighter" that has no turret

The mod detects it and the tooltip just show a invalidity warning so we loose the non turret related information (speed size ...)

Link to comment
Share on other sites

  • 2 months later...

I guess this mod would need a complete rewrite now that update added dps in tooltips. What devs didn't add though is "dps per slot". Even if you find an awesome turret with 3000 dps with 4 slots, it is worse than 2 turrets of 2000 dps and 2 slots each.

Link to comment
Share on other sites

  • 4 weeks later...

I guess this mod would need a complete rewrite now that update added dps in tooltips. What devs didn't add though is "dps per slot". Even if you find an awesome turret with 3000 dps with 4 slots, it is worse than 2 turrets of 2000 dps and 2 slots each.

 

The official turret tooltip is still not offering separate shield/hull DPS for weapons with shield/hull bonuses, or effective DPS for overheating weapons either.

Link to comment
Share on other sites

The official turret tooltip is still not offering separate shield/hull DPS for weapons with shield/hull bonuses, or effective DPS for overheating weapons either.

As far as I know, official tooltip calculates eDPS. Still not usefull enough w/o eDPS per slot.

Link to comment
Share on other sites

This is for anyone missing their torpedo tooltips.

 

Edit: You just throw this into the tooltipmaker.lua, at the very bottom.

 

function makeTorpedoTooltip(torpedo)
    -- create tool tip
    local tooltip = Tooltip()
    tooltip.icon = torpedo.icon

    -- title
    local title

    local line = TooltipLine(25, 15)
    line.ctext = torpedo.name
    line.ccolor = torpedo.rarity.color
    tooltip:addLine(line)

    -- primary stats, one by one
    local fontSize = 14
    local lineHeight = 20

    -- rarity name
    local line = TooltipLine(5, 12)
    line.ctext = tostring(torpedo.rarity)
    line.ccolor = torpedo.rarity.color
    tooltip:addLine(line)

    -- primary stats, one by one
    local fontSize = 14
    local lineHeight = 20

    local line = TooltipLine(lineHeight, fontSize)
    line.ltext = "Tech"%_t
    line.rtext = torpedo.tech
    line.icon = "data/textures/icons/circuitry.png";
    line.iconColor = iconColor
    tooltip:addLine(line)

    -- empty line
    tooltip:addLine(TooltipLine(15, 15))

    if torpedo.hullDamage > 0 and torpedo.damageVelocityFactor == 0 then
        local line = TooltipLine(lineHeight, fontSize)
        line.ltext = "Damage"%_t
        line.rtext = toReadableValue(round(torpedo.hullDamage), "")
        line.icon = "data/textures/icons/screen-impact.png";
        line.iconColor = iconColor
        tooltip:addLine(line)
    elseif torpedo.damageVelocityFactor > 0 then
        local line = TooltipLine(lineHeight, fontSize)
        line.ltext = "Hull Damage"%_t
        line.rtext = "up to ${damage}"%_t % {damage = toReadableValue(round(torpedo.maxVelocity * torpedo.damageVelocityFactor), "")}
        line.icon = "data/textures/icons/screen-impact.png";
        line.iconColor = iconColor
        tooltip:addLine(line)
    end

    if torpedo.shieldDamage > 0 and torpedo.shieldDamage ~= torpedo.hullDamage then
        local line = TooltipLine(lineHeight, fontSize)
        line.ltext = "Shield Damage"%_t
        line.rtext = toReadableValue(round(torpedo.shieldDamage), "")
        line.icon = "data/textures/icons/screen-impact.png";
        line.iconColor = iconColor
        tooltip:addLine(line)
    end

    -- empty line
    tooltip:addLine(TooltipLine(15, 15))

    -- maneuverability
    local line = TooltipLine(lineHeight, fontSize)
    line.ltext = "Maneuverability"%_t
    line.rtext = round(torpedo.turningSpeed, 2)
    line.icon = "data/textures/icons/dodge.png";
    line.iconColor = iconColor
    tooltip:addLine(line)

    local line = TooltipLine(lineHeight, fontSize)
    line.ltext = "Speed"%_t
    line.rtext = round(torpedo.maxVelocity * 10.0)
    line.icon = "data/textures/icons/afterburn.png";
    line.iconColor = iconColor
    tooltip:addLine(line)

    if torpedo.acceleration > 0 then
        local line = TooltipLine(lineHeight, fontSize)
        line.ltext = "Acceleration"%_t
        line.rtext = round(torpedo.acceleration * 10.0)
        line.icon = "data/textures/icons/blaster.png";
        line.iconColor = iconColor
        tooltip:addLine(line)
    end

    local line = TooltipLine(lineHeight, fontSize)
    line.ltext = "Range"%_t
    line.rtext = "${range} km" % {range = round(torpedo.reach * 10 / 1000, 2)}
    line.icon = "data/textures/icons/target-shot.png";
    line.iconColor = iconColor
    tooltip:addLine(line)

    if torpedo.storageEnergyDrain > 0 then
        local line = TooltipLine(lineHeight, fontSize)
        line.ltext = "Storage Energy"%_t
        line.rtext = toReadableValue(round(torpedo.storageEnergyDrain), "W")
        line.icon = "data/textures/icons/electric.png";
        line.iconColor = iconColor
        tooltip:addLine(line)
    end

    -- empty line
    tooltip:addLine(TooltipLine(15, 15))

    -- size
    local line = TooltipLine(lineHeight, fontSize)
    line.ltext = "Size"%_t
    line.rtext = round(torpedo.size, 1)
    line.icon = "data/textures/icons/missile-pod.png";
    line.iconColor = iconColor
    tooltip:addLine(line)

    -- durability
    local line = TooltipLine(lineHeight, fontSize)
    line.ltext = "Durability"%_t
    line.rtext = round(torpedo.durability)
    line.icon = "data/textures/icons/health-normal.png";
    line.iconColor = iconColor
    tooltip:addLine(line)

    -- empty line
    tooltip:addLine(TooltipLine(15, 15))
    tooltip:addLine(TooltipLine(15, 15))

    -- specialties
    local extraLines = 0

    if torpedo.damageVelocityFactor > 0 then
        local line = TooltipLine(lineHeight, fontSize)
        line.ltext = "Damage Dependent on Velocity"%_t
        tooltip:addLine(line)

        extraLines = extraLines + 1
    end

    if torpedo.shieldDeactivation then
        local line = TooltipLine(lineHeight, fontSize)
        line.ltext = "Briefly Deactivates Shields"%_t
        tooltip:addLine(line)

        extraLines = extraLines + 1
    end

    if torpedo.energyDrain then
        local line = TooltipLine(lineHeight, fontSize)
        line.ltext = "Drains Target's Energy"%_t
        tooltip:addLine(line)

        extraLines = extraLines + 1
    end

    if torpedo.shieldPenetration then
        local line = TooltipLine(lineHeight, fontSize)
        line.ltext = "Penetrates Shields"%_t
        tooltip:addLine(line)

        extraLines = extraLines + 1
    end

    if torpedo.shieldAndHullDamage then
        local line = TooltipLine(lineHeight, fontSize)
        line.ltext = "Damages Both Shield and Hull"%_t
        tooltip:addLine(line)

        extraLines = extraLines + 1
    end

    if torpedo.storageEnergyDrain > 0 then
        local line = TooltipLine(lineHeight, fontSize)
        line.ltext = "Requires Energy in Storage"%_t
        tooltip:addLine(line)

        extraLines = extraLines + 1
    end

    for i = 1, 3 - extraLines do
        -- empty line
        tooltip:addLine(TooltipLine(15, 15))
    end


    return tooltip

end

Link to comment
Share on other sites

Love the mod however, any chance of adding stats for torpedoes? I know this is a beta feature but still, would be nice to know what I'm dealing with when using torpedoes.

 

Check this post by Raio_Verusia, he provided a small snippet in the meanwhile.

 

I guess this mod would need a complete rewrite now that update added dps in tooltips. What devs didn't add though is "dps per slot". Even if you find an awesome turret with 3000 dps with 4 slots, it is worse than 2 turrets of 2000 dps and 2 slots each.

 

From what I can tell, turret slots are more of a static value, and also a balancing factor for the devs. The more slots that a turret has, the more damage it deals and the higher reach it has. Everything related to the slots are already included in the calculations though. "DPS per slot" could be useful to decide what turret has highest DPS per slot though, I'll keep that in mind when I'm updating the mod.

 

The official turret tooltip is still not offering separate shield/hull DPS for weapons with shield/hull bonuses, or effective DPS for overheating weapons either.

 

Actually, the official tooltips show eDPS now. For like 95% of the weapons I checked out (thank you, debug menu), I'm proud to say that my calculations were right on spot. I'm also glad that developers chose to calculate eDPS off of a full cycle as well. However, there are some weird stuff going on which I'm trying to figure out. Such as this, the vanilla tooltip is reporting a DPS of 2218 while my calculations report a DPS of 554.5, and there is a pattern to this issue.

 

Certain weapons with "Independent Targeting" (such as Railguns and Bolters) multiply their DPS with their weapon count for some reason, and I think it is a bug for the vanilla. The screenshot I linked for example, it is a quad turret; it has 4 weapons and if you multiply my result with 4, you get the vanilla tooltip's result. But I bet it is a bug.

 

Also, the vanilla "Time until overheated" and "Cooling time" are still inaccurate. What I don't understand is, for a weapon like this for example, the difference between "time until overheated" and my "(Heat) Buildup" is quite different, yet the eDPS result is the same. There should've been a variance, because that difference is enough to push the vanilla eDPS to a much higher value. I think vanilla eDPS does its calculations like I do but for some reason it shows the wrong "time until overheated" values? Dunno, I never trusted that value and did things the hard way anyway :)

 

 

 

As for an official word on this mod, an update is coming, slowly. Since there are many changes, and additions, I'm trying to double check everything, go over my calculations and stuff which is taking time, but to be honest, it takes more time than usual because as my interest has shifted to other games. Still, don't just want to slap the torpedo additions and release an update, and then realize there is a bug that I could've avoided. I don't want to force people visiting this topic daily to see if there is an update, so to speak. If they add Steam Workshop support someday, I'll go with it, but as long as we're doing things on the forums, I'd rather avoid uploading updates as soon as I finish one.

 

When I have spare time, and not playing another game, I try to work on it. Also, I'm trying to decide whether or not to alter the way the tooltip looks, and leaning on something like a table to display the values and avoid adding more lines on top of more lines. But a table-like look with multiple rows & columns might not look that great, so a bit on the fence about it. Nevertheless, have been trying to learn more about the UI for that case.

Link to comment
Share on other sites

  • 3 weeks later...

I made some updates to the script. Due note that a majority of this script is still the same as v24 from lyravega

 

lyravega I hope you don't mind me re-posting this here. Feel free to incorporate any my changes into your next update.

 

v24.2 Updates

* Includes core game Torpedo code that Raio_Verusi posted earlier in thread.

* Includes Turret slot size info

* Includes Turret per slot size eDPS/DPS info

* Includes Fighter per volume size eDPS/DPS info

 

Notes:

* Still using same eDPS/DPS calculations as @lyravega, so concerns about calculations from his last post still exist.

Detailed_Turret_Tooltips_0.024.2.zip

Link to comment
Share on other sites

  • 3 weeks later...

I made some updates to the script. Due note that a majority of this script is still the same as v24 from lyravega

 

lyravega I hope you don't mind me re-posting this here. Feel free to incorporate any my changes into your next update.

 

v24.2 Updates

* Includes core game Torpedo code that Raio_Verusi posted earlier in thread.

* Includes Turret slot size info

* Includes Turret per slot size eDPS/DPS info

* Includes Fighter per volume size eDPS/DPS info

 

Notes:

* Still using same eDPS/DPS calculations as @lyravega, so concerns about calculations from his last post still exist.

 

let me throw in an idea/wish: how about adding per-slot-eDPS as sorting option in inventory? is this (im-)possible?

Link to comment
Share on other sites

  • 1 month later...

From what I can tell, turret slots are more of a static value, and also a balancing factor for the devs. The more slots that a turret has, the more damage it deals and the higher reach it has. Everything related to the slots are already included in the calculations though. "DPS per slot" could be useful to decide what turret has highest DPS per slot though, I'll keep that in mind when I'm updating the mod.

Slots are not static, especially now that they included low slot number in higher level sectors. In fact slot numbers is the single most important factor deciding (fighter) damage when creating from a turret, it divides by slots and multiplies by .3

I would highly suggest it to be included, you could have a 10k dps weapon producing 200dps fighters after burst fire calculations with a 2k dps weapon producing 600dps fighters.

As of now the DPS tooltip in vanilla only serves as a very inaccurate estimation.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...