Author Topic: [Mod] Detailed Turret Tooltips  (Read 73046 times)

sebyg666

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    2
    • View Profile
on: December 01, 2017, 12:38:09 AM
the version 0.024 brakes the fighter creation UI for me. i can add craft, i click a turret and the UI locks up. cannot create fighter, change turret, increase or decrease stats, when i exit the station i cannot re-entre and have to reload game. i tested it isnt another mod, its the only one i have loaded, ran game vanilla and was able to make the fighter.

edit
the other version fixes the issue
« Last Edit: December 01, 2017, 12:43:03 AM by sebyg666 »



lyravega

  • Jr. Member
  • **
  • Status:
    Offline
    Posts:
    85
    • View Profile
    • Steam
on: December 03, 2017, 06:11:13 PM
the version 0.024 brakes the fighter creation UI for me. i can add craft, i click a turret and the UI locks up. cannot create fighter, change turret, increase or decrease stats, when i exit the station i cannot re-entre and have to reload game. i tested it isnt another mod, its the only one i have loaded, ran game vanilla and was able to make the fighter.

edit
the other version fixes the issue

Can you take a screenshot of the weapon you are trying to create a fighter from? Or is it any turret? More importantly, after that happens, it should say something in the logs; after it happens, can you close the game, and go to %appdata%\avorion\ and grab the latest log file, and then upload it over here so I can take a look at it?

I've tried to replicate the issue, but on my end it seems all fine so I have no clue.
« Last Edit: December 03, 2017, 06:44:01 PM by lyravega »
Detailed Turret Tooltips - mod for all your turret info needs
Compass-like Gate Pixel Icons - unnecessary quality of life improvement

Poke me on Steam for updates



klush

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    1
    • View Profile
on: December 04, 2017, 02:19:34 PM
Great mod, but i have the same problem, I cant build any fighters, I cant buy them too, and when i exit the equipament dock, the "press F to interact" disapears



lyravega

  • Jr. Member
  • **
  • Status:
    Offline
    Posts:
    85
    • View Profile
    • Steam
on: December 04, 2017, 06:52:52 PM
Great mod, but i have the same problem, I cant build any fighters, I cant buy them too, and when i exit the equipament dock, the "press F to interact" disapears

Yep, it's a sign that the mod is broken due to something, but I cannot reproduce it on my own, I've visited several docks, boughts tens of weapons, etc... but wasn't able to reproduce it.

When that happens, it should say something in the logs; after it happens, can you close the game, and go to %appdata%\avorion\ and grab the latest log file, and then upload it over here so I can take a look at it?
Detailed Turret Tooltips - mod for all your turret info needs
Compass-like Gate Pixel Icons - unnecessary quality of life improvement

Poke me on Steam for updates



lyravega

  • Jr. Member
  • **
  • Status:
    Offline
    Posts:
    85
    • View Profile
    • Steam
on: December 04, 2017, 09:53:24 PM
Ok, I've PM'd the folks experiencing the fighter creation UI lock-up, and it turns out one of them was using the wrong version :) If you are on stable (default) branch, use the older version of the mod, if you are on beta branch, use the latest version.

But as always, if you are experiencing any issues and suspect my mods are the issue, after closing the game, navigate to %Appdata%\Avorion folder, and upload the latest log here and I can check it out and locate the issue. Any help & suggestions are welcome!
« Last Edit: December 04, 2017, 10:01:11 PM by lyravega »
Detailed Turret Tooltips - mod for all your turret info needs
Compass-like Gate Pixel Icons - unnecessary quality of life improvement

Poke me on Steam for updates



multox

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    16
    • View Profile
on: December 06, 2017, 04:44:55 AM
Is the "Guided Missiles" trait at the bottom the same as Seeker or is there some difference?



multox

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    16
    • View Profile
on: December 06, 2017, 04:51:49 AM
Does this mod calculate correctly in Turret Factories?  I'm looking at a turret factory right now and the numbers don't look right to me.

-------------------------------
According to the mod:
Double Launcher Turret
DPS: 83.8
Damage: 2x138.4
Fire Rate: 0.3/s
(No heat build up)
+64% Fire Rate
Synchronized Weapons
Guided Missiles
---------------------------------

So 2 x 138.4 * 0.3 = 83.04  (close)
But the +64% Fire Rate would bring it up to 136.2 DPS, not the stated 83.8. 
What am I missing?



Ravien

  • Sr. Member
  • ****
  • Status:
    Offline
    Posts:
    256
    • View Profile
on: December 06, 2017, 08:23:32 AM
Does this mod calculate correctly in Turret Factories?  I'm looking at a turret factory right now and the numbers don't look right to me.

-------------------------------
According to the mod:
Double Launcher Turret
DPS: 83.8
Damage: 2x138.4
Fire Rate: 0.3/s
(No heat build up)
+64% Fire Rate
Synchronized Weapons
Guided Missiles
---------------------------------

So 2 x 138.4 * 0.3 = 83.04  (close)
But the +64% Fire Rate would bring it up to 136.2 DPS, not the stated 83.8. 
What am I missing?

The weapon damage and fire rates shown on tooltips is after any damage and fire rate bonuses. The +64% fire rate just means that this particular turrets shoots that much faster than the "base" version of the same turret normally would.



multox

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    16
    • View Profile
on: December 07, 2017, 01:33:11 AM
So I dug into the modding docs and took a look at this mod.  There were a few things that bothered me in that the calculations didn't seem correct.  For example, there were times that adding more components to a turret in the Turret Builder would actually decrease the DPS.  In the process of investigating these issues I ended up building an entirely new mod. 

This isn't meant to imply that the OP's work isn't excellent!  I thank him very much for his mod.  However, the mod that I've attached is more tuned to my personal tastes and resolves the issues that I noticed.  Please feel free to include in the original mod or not.
« Last Edit: December 07, 2017, 01:39:12 AM by multox »



lyravega

  • Jr. Member
  • **
  • Status:
    Offline
    Posts:
    85
    • View Profile
    • Steam
on: December 08, 2017, 06:42:44 AM
Does this mod calculate correctly in Turret Factories?  I'm looking at a turret factory right now and the numbers don't look right to me.

-------------------------------
According to the mod:
Double Launcher Turret
DPS: 83.8
Damage: 2x138.4
Fire Rate: 0.3/s
(No heat build up)
+64% Fire Rate
Synchronized Weapons
Guided Missiles
---------------------------------

So 2 x 138.4 * 0.3 = 83.04  (close)
But the +64% Fire Rate would bring it up to 136.2 DPS, not the stated 83.8. 
What am I missing?

The bonus to fire rate is already included in that fire rate you see, as it is in the vanilla. The little deviation is caused by numbers getting rolled up or down; either the fire rate, or the damage. Fire rate could be something between 0.296 and 0.304 and ends up being displayed as 0.3.

And adding more components to a turret should never decrease the DPS unless turret factories are still bugged; there was a time increasing/decreasing components had the opposite effect but I don't think that's the case. For eDPS, it should stay as it is as eDPS always takes cooldown and heat-up times into calculation. eDPS always assumes you keep firing without stopping, and firing faster in a cycle (from 0 to 100 and then back to firing again) actually doesn't make any difference due to a few factors.

It looks weird I admit, you see fire rate going up but eDPS staying as it is, however when you consider some other stuff it is like that. To be honest, when I first saw that value not changing, I thought I had a miscalculation somewhere, but when I looked at it with some examples, seeing that not changing at all was actually surprising for a bit.

Also, a few things for your mod, if you'd like to develop it more:
• The heat is generated per weapon, and some turrets fire all weapons at once. Unless you factor that in, you'll have wrong stats for such turrets
• You should pay attention to heatPerShot more, as a weapon can go beyond 100% heat, instead of capping at 100% unless a patch has changed it. Otherwise you'll have incorrect stats for anything that can heat
• I think you are incorrectly showing the DPS of a weapon if it is one of those that can cooldown faster than it can heat-up. If obj.coolingRate is 1 and stats.heatPerSecond is 0.5, then the overall DPS you have shows 2x the amount

Keep it up!
« Last Edit: December 08, 2017, 06:58:47 AM by lyravega »
Detailed Turret Tooltips - mod for all your turret info needs
Compass-like Gate Pixel Icons - unnecessary quality of life improvement

Poke me on Steam for updates



multox

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    16
    • View Profile
on: December 09, 2017, 05:54:46 AM
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.
« Last Edit: December 09, 2017, 05:57:41 AM by multox »



lyravega

  • Jr. Member
  • **
  • Status:
    Offline
    Posts:
    85
    • View Profile
    • Steam
on: December 09, 2017, 10:31:36 AM
*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!
« Last Edit: December 09, 2017, 10:42:45 AM by lyravega »
Detailed Turret Tooltips - mod for all your turret info needs
Compass-like Gate Pixel Icons - unnecessary quality of life improvement

Poke me on Steam for updates



multox

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    16
    • View Profile
on: December 09, 2017, 06:59:31 PM
*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. 



lyravega

  • Jr. Member
  • **
  • Status:
    Offline
    Posts:
    85
    • View Profile
    • Steam
on: December 09, 2017, 07:36:24 PM
*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.
« Last Edit: December 10, 2017, 10:08:40 AM by lyravega »
Detailed Turret Tooltips - mod for all your turret info needs
Compass-like Gate Pixel Icons - unnecessary quality of life improvement

Poke me on Steam for updates



multox

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    16
    • View Profile
on: December 10, 2017, 11:02:13 PM
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.

Code: [Select]
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