[FIX][4.1 beta 4] Incorrect fire arcs output calculation

This forum provides information on obtaining access to Public Beta versions of X4: Foundations allowing people running those versions to provide feedback on their experiences.

Moderator: DevNet Public Moderators

Post Reply
User avatar
Shuulo
Posts: 1492
Joined: Mon, 14. Apr 08, 17:03
x4

[FIX][4.1 beta 4] Incorrect fire arcs output calculation

Post by Shuulo » Sat, 24. Jul 21, 18:11

Not sure if this is unique to 4.1 betas or happened in 4.0 as well, but it seems that in some cases output of firing arcs is not correct.

Link to save (only mod used is cheat menu to setup the scenario)

You can see that some ships in your possession have incorrect values for firepower, seems like aft, port and starboard are shuffled for some of them. All ships use same weapon types on all their sides, so port/starboard damage should be the same, but its not:
https://drive.google.com/file/d/1HXYzVZ ... sp=sharing
https://drive.google.com/file/d/1uCfUp4 ... sp=sharing
https://drive.google.com/file/d/1tvBvvN ... sp=sharing

Alan Phipps
Moderator (English)
Moderator (English)
Posts: 24959
Joined: Fri, 16. Apr 04, 19:21
x4

Re: [4.1 beta 4] Incorrect fire arcs output calculation

Post by Alan Phipps » Sat, 24. Jul 21, 18:38

Have you applied any in-game turret mods of any sort? They could cause different damage values for similar turrets.

I do see what you mean about the values perhaps being misordered in some cases though.
A dog has a master; a cat has domestic staff.

User avatar
Shuulo
Posts: 1492
Joined: Mon, 14. Apr 08, 17:03
x4

Re: [4.1 beta 4] Incorrect fire arcs output calculation

Post by Shuulo » Sat, 24. Jul 21, 19:27

Alan Phipps wrote:
Sat, 24. Jul 21, 18:38
Have you applied any in-game turret mods of any sort? They could cause different damage values for similar turrets.

I do see what you mean about the values perhaps being misordered in some cases though.
No, brand new from shipyards

User avatar
Dj_FRedy
Posts: 53
Joined: Mon, 27. Jun 11, 05:58
x4

Re: [4.1 beta 4] Incorrect fire arcs output calculation

Post by Dj_FRedy » Sun, 25. Jul 21, 18:19

I changed the formula in my personal modification some time ago, the current formula gives incorrect values. How it is calculated in 'menu_ship_configuration' would be better. Something like this:

Code: Select all

		-- OLD + Dj_FRedy
		-- local dpstable = ffi.new("DPSData[?]", 6)
		-- local hasturrets = (defenceinfo_low and #loadout.component.turret > 0)
		-- local numtotalquadrants = C.GetDefensibleDPS(dpstable, inputobject, true, true, true, true, hasturrets, false, false)
		-- if not hasturrets then
			-- locrowdata = { false, ReadText(1001, 9092) .. ReadText(1001, 120), defenceinfo_high and (function() return (ConvertIntegerString(Helper.round(dpstable[0].dps), true, 0, true) .. " " .. ReadText(1001, 119)) end) or (unknowntext .. " " .. ReadText(1001, 119)) }	-- Weapon Output, MW
			-- row = menu.addInfoSubmenuRow(instance, inputtable, row, locrowdata, false, false, false, 1, indentsize)
		-- else
			-- for i = 0, numtotalquadrants - 1 do
				-- locrowdata = { false, (ReadText(1001, 9092) .. " (" .. ReadText(20220, dpstable[i].quadranttextid) .. ")" .. ReadText(1001, 120)), defenceinfo_high and (function() return (ConvertIntegerString(Helper.round(dpstable[i].dps), true, 0, true) .. " " .. ReadText(1001, 119)) end) or (unknowntext .. " " .. ReadText(1001, 119)) }	-- Weapon Output, MW
				-- row = menu.addInfoSubmenuRow(instance, inputtable, row, locrowdata, false, false, false, 1, indentsize)
			-- end
		-- end

		-- local sustainedfwddps = ffi.new("DPSData[?]", 1)
		-- C.GetDefensibleDPS(sustainedfwddps, inputobject, true, true, true, true, false, true, false)
		-- if sustainedfwddps[0].dps > 0 then
			-- locrowdata = { false, ReadText(1001, 9093) .. ReadText(1001, 120), defenceinfo_high and (function() return (ConvertIntegerString(Helper.round(sustainedfwddps[0].dps), true, 0, true) .. " " .. ReadText(1001, 119)) end) or (unknowntext .. " " .. ReadText(1001, 119)) }	-- MW
			-- row = menu.addInfoSubmenuRow(instance, inputtable, row, locrowdata, false, false, false, 1, indentsize)
		-- end

		-- show stats DPS + Dj_FRedy
		local stats = { { id = "BurstDPS", name = ReadText(1001, 9092) }, { id = "SustainedDPS", name = ReadText(1001, 9093) }, { id = "TurretSustainedDPS", id2 = "GroupedTurretBurstDPS", name = ReadText(1001, 8532) } }
		local fficurrentloadoutstats = C.GetCurrentLoadoutStatistics3(inputobject)
		local currentloadoutstats = Helper.convertLoadoutStats(fficurrentloadoutstats)
		for i = 1, #stats do
			local id = stats[i].id
			local name = stats[i].name
			if i == 3 and (C.IsComponentClass(inputobject, "ship_l") or C.IsComponentClass(inputobject, "ship_xl")) then
				id = stats[i].id2
			end
			if currentloadoutstats[id] > 0 then
				locrowdata = { false, name .. ReadText(1001, 120), defenceinfo_high and (function() return (ConvertIntegerString(Helper.round(currentloadoutstats[id]), true, 0, true) .. " " .. ReadText(1001, 119)) end) or (unknowntext .. " " .. ReadText(1001, 119)) } -- MW
				row = menu.addInfoSubmenuRow(instance, inputtable, row, locrowdata, false, false, false, 1, indentsize)
			end
		end
		-- - Dj_FRedy
ScreenShots: https://imgur.com/a/HxBi2cl

If take as sample this code, it can remove the table 'local loadout = {}' at the beginning of the function.
"All my contributions to the Technical Support and Public Beta Feedback sections will be concise and to the point, no diatribes, that's what the other sections are for".

User avatar
Shuulo
Posts: 1492
Joined: Mon, 14. Apr 08, 17:03
x4

Re: [4.1 beta 4] Incorrect fire arcs output calculation

Post by Shuulo » Sun, 25. Jul 21, 22:30

Thing is, it can impact OOS if those values are used in it, so its better to look into this issue.

User avatar
Dj_FRedy
Posts: 53
Joined: Mon, 27. Jun 11, 05:58
x4

Re: [4.1 beta 4] Incorrect fire arcs output calculation

Post by Dj_FRedy » Sun, 25. Jul 21, 23:49

mmm maybe I ventured too soon in saying the values it collects are incorrect, as I say, I changed this a while ago for my personal use and reviewing the ffi now I remember that I did it because I didn't like the way the data was displayed... I think it was just my convenience.

Code: Select all

	typedef struct {
		float dps;
		uint32_t quadranttextid;
	} DPSData;
	uint32_t GetDefensibleDPS(DPSData* result, UniverseID defensibleid, bool primary, bool secondary, bool lasers, bool missiles, bool turrets, bool includeheat, bool includeinactive);
		local numtotalquadrants = C.GetDefensibleDPS(dpstable, inputobject, true, true, true, true, hasturrets, false, false)
It tracks if the weapon group is active, turret behaviour if it is active... these two values already in itself if changed in the ship loadout will already affect the values. It also happens in the 'Ship Overview' screen but only with Avg Turret Output. I won't say more, it's better that a DEV confirms our doubts.
"All my contributions to the Technical Support and Public Beta Feedback sections will be concise and to the point, no diatribes, that's what the other sections are for".

j.harshaw
EGOSOFT
EGOSOFT
Posts: 1323
Joined: Mon, 23. Nov 15, 19:02

Re: [4.1 beta 4] Incorrect fire arcs output calculation

Post by j.harshaw » Wed, 28. Jul 21, 12:35

confirmed. fixed in a future update.

Post Reply

Return to “X4: Foundations - Public Beta Feedback”