Page 1 of 2

Rate of fire

Posted: Sun Feb 14, 2021 8:32 am
by Leofus
Sorry if this has been asked before but is there any way, possibly via hex editing, that the rate of fire of the lasers could potentially be modified?

Re: Rate of fire

Posted: Sun Feb 14, 2021 9:39 am
by Vince T
I'm moving this into Editing/OPTing

Re: Rate of fire

Posted: Sun Feb 14, 2021 9:38 pm
by Random Starfighter
Player fighter cannon cooldown:

Code: Select all

Memory
At offset: 491878, bytes: 6BC92F
At offset: 49187B, bytes: 6BD22F

EXE file
At offset: 90C78, bytes: 6BC92F
At offset: 90C7B, bytes: 6BD22F
AI fighter cannon cooldown:

Code: Select all

Memory
At offset: 4918A4, bytes: 6BF62F
At offset: 4918BD, bytes: 6BD22F

EXE file
At offset: 90CA4, bytes: 6BF62F
At offset: 90CBD, bytes: 6BD22F
The point of interest here is the last byte of each of these instructions: hex 2F (47 decimal) which is the cooldown time, multiplied per laser. The game's timing system is based off 236 units per second, so that's approximately 1/5 a second for single fire. Because of the multiplier per number of shots, dual fire would be every 2/5 second, quad fire every 4/5.

Also note that it's a single byte, so the highest you can go is hex 7F (127 decimal) before it becomes negative.

This doesn't change energy consumption or recharge rates. Also you may be constrained by the projectile limit if the cooldown is too fast.

Re: Rate of fire

Posted: Mon Feb 15, 2021 5:09 am
by Leofus
Random Starfighter wrote:
Sun Feb 14, 2021 9:38 pm
Player fighter cannon cooldown:

Code: Select all

Memory
At offset: 491878, bytes: 6BC92F
At offset: 49187B, bytes: 6BD22F

EXE file
At offset: 90C78, bytes: 6BC92F
At offset: 90C7B, bytes: 6BD22F
AI fighter cannon cooldown:

Code: Select all

Memory
At offset: 4918A4, bytes: 6BF62F
At offset: 4918BD, bytes: 6BD22F

EXE file
At offset: 90CA4, bytes: 6BF62F
At offset: 90CBD, bytes: 6BD22F
The point of interest here is the last byte of each of these instructions: hex 2F (47 decimal) which is the cooldown time, multiplied per laser. The game's timing system is based off 236 units per second, so that's approximately 1/5 a second for single fire. Because of the multiplier per number of shots, dual fire would be every 2/5 second, quad fire every 4/5.

Also note that it's a single byte, so the highest you can go is hex 7F (127 decimal) before it becomes negative.

This doesn't change energy consumption or recharge rates. Also you may be constrained by the projectile limit if the cooldown is too fast.
I really appeciate this information. Now I just need to figure out what to do with it. Thank you very much!

update: figured out a hex editor and got them switched. loving the results of 1f

Re: Rate of fire

Posted: Mon Feb 15, 2021 8:38 am
by Vince T
@JeremyaFr Could that be integrated in the Weapons hook? I‘v got loads of ideas here XD

Re: Rate of fire

Posted: Mon Feb 15, 2021 8:44 am
by Leofus
Vince T wrote:
Mon Feb 15, 2021 8:38 am
@JeremyaFr Could that be integrated in the Weapons hook? I‘v got loads of ideas here XD
I was secretly hoping someone more skilled and talented than i would get ideas from this :ops:

Re: Rate of fire

Posted: Mon Feb 15, 2021 5:22 pm
by ual002
Could this affect AI turret ROF?

Random, do you happen to know if AI turret VS Starfighters Accuracy could be also adjusted? Instead of pinpoint accuracy, could there be a margin of error to the spread introduced?

Posted: Mon Feb 15, 2021 11:17 pm
by Bman
.

Posted: Mon Feb 15, 2021 11:31 pm
by Bman
.

Re: Rate of fire

Posted: Tue Feb 16, 2021 2:09 am
by Random Starfighter
ual002 wrote:
Mon Feb 15, 2021 5:22 pm
Could this affect AI turret ROF?

Random, do you happen to know if AI turret VS Starfighters Accuracy could be also adjusted? Instead of pinpoint accuracy, could there be a margin of error to the spread introduced?
Turret ROF is more complicated, a lot more code working together. It does seem to follow a similar concept of a cooldown and a multiplier, but the base cooldown is kind of weird. I found something that seems to affect smaller ships like transports, but is hard to see much difference with larger ships with multiple types of turrets.

Any significant changes to turret ROF or accuracy would probably require rewriting part of the function. Through the magic of hooks, anything is possible. It just wouldn't be as simple as patching a few numbers here and there.

Re: Rate of fire

Posted: Tue Feb 16, 2021 2:22 am
by ual002
Random Starfighter wrote:
Tue Feb 16, 2021 2:09 am
ual002 wrote:
Mon Feb 15, 2021 5:22 pm
Could this affect AI turret ROF?

Random, do you happen to know if AI turret VS Starfighters Accuracy could be also adjusted? Instead of pinpoint accuracy, could there be a margin of error to the spread introduced?
Turret ROF is more complicated, a lot more code working together. It does seem to follow a similar concept of a cooldown and a multiplier, but the base cooldown is kind of weird. I found something that seems to affect smaller ships like transports, but is hard to see much difference with larger ships with multiple types of turrets.

Any significant changes to turret ROF or accuracy would probably require rewriting part of the function. Through the magic of hooks, anything is possible. It just wouldn't be as simple as patching a few numbers here and there.
Yeah the main issue is the sniper accuracy of transports. AI CORTS always seemed too accurate for a ship maneuvering all over.

Re: Rate of fire

Posted: Tue Feb 16, 2021 4:56 pm
by JeremyaFr
WIP

Hello,
Here is a WIP of the weapon rate hook.

I've included the cooldown time patch.
I've added a CooldownTimeFactor setting per craft to define the value. The default value is 47 (0x2F).

EDIT: link removed

Re: Rate of fire

Posted: Tue Feb 16, 2021 10:41 pm
by AngeI
JeremyaFr wrote:
Tue Feb 16, 2021 4:56 pm
WIP

Hello,
Here is a WIP of the weapon rate hook.

I've included the cooldown time patch.
I've added a CooldownTimeFactor setting per craft to define the value. The default value is 47 (0x2F).


xwa_hook_weapon_rate_WIP_2102161752.zip
Does this affect Turret RoF or just regular forward guns?

Re: Rate of fire

Posted: Wed Feb 17, 2021 8:12 am
by Leofus
JeremyaFr wrote:
Tue Feb 16, 2021 4:56 pm
WIP

Hello,
Here is a WIP of the weapon rate hook.

I've included the cooldown time patch.
I've added a CooldownTimeFactor setting per craft to define the value. The default value is 47 (0x2F).


xwa_hook_weapon_rate_WIP_2102161752.zip
sorry if this is a dumb question but what effect does increasing/decreasing the decharge/recharge rates do?

Re: Rate of fire

Posted: Wed Feb 17, 2021 8:30 am
by Vince T
Well as the name suggests it defines how quickly your lasers decharge and recharge, so
decharge = how fast energy is consumed while firing.
recharge = how quickly your energy fills up again.

Re: Rate of fire

Posted: Wed Feb 17, 2021 8:53 am
by Leofus
Vince T wrote:
Wed Feb 17, 2021 8:30 am
Well as the name suggests it defines how quickly your lasers decharge and recharge, so
decharge = how fast energy is consumed while firing.
recharge = how quickly your energy fills up again.
thank you for the fast response. is it possible to redefine the default values using this hook or only for individual craft?

Re: Rate of fire

Posted: Wed Feb 17, 2021 9:58 am
by Vince T
I think there‘s a default.ini where you could define this.

Note that this will affect the vanilla game mission balance. Some missions may become way too easy or unplayable.

Re: Rate of fire

Posted: Thu Feb 18, 2021 10:27 am
by Will T
Vince T wrote:
Mon Feb 15, 2021 8:38 am
@JeremyaFr Could that be integrated in the Weapons hook? I‘v got loads of ideas here XD
Yeah, there's potential for things to get very interesting here.

This would really give some huge options if it could be coupled with changing the damage of certain weapons too.


If you could increase the ROF of certain hardpoints on a certain opt or FG and lower their damage at the same time, we could finally get the Autoblasters on the B-Wing.

Give it a reduced power turbolaser on the wing end hard point, and reduced power, fast firing normal lasers on the cockpit and you've got a canon B-Wing in XWA at last. Obviously that would affect balance, but as an option for people less bothered by that, it would be amazing.

Re: Rate of fire

Posted: Thu Feb 18, 2021 11:06 am
by Vince T
I'm still dreaming of a minigun-like implementation, maybe on some custom model. For player-craft it would even be somewhat balanced as you'd still have to mind recharge rate so you can't just squeeze the trigger indefinitely but instead rather use it in short bursts to prevent the imaginary minigun from "overheating" i.e. running out of energy :)

Re: Rate of fire

Posted: Fri Feb 19, 2021 8:56 pm
by BattleDog
So is it now possible to vary refire rate by ship?

If so that's way-cool.

Re: Rate of fire

Posted: Sat Feb 20, 2021 1:59 pm
by JeremyaFr
BattleDog wrote:
Fri Feb 19, 2021 8:56 pm
So is it now possible to vary refire rate by ship?
Yes, it is.

Re: Rate of fire

Posted: Sat Feb 20, 2021 8:25 pm
by BattleDog
JeremyaFr wrote:
Sat Feb 20, 2021 1:59 pm
BattleDog wrote:
Fri Feb 19, 2021 8:56 pm
So is it now possible to vary refire rate by ship?
Yes, it is.
Something I thought of a while ago, and have been reflecting on recently.

Is it possible to define the range of lasers for fighter craft? The main application for this would be to make laser bolts faster so that we could increase the speed of fighters and transports without having to make absurd deflection shots. Right now lasers move at something like 1,200 metres per second, compared to 2,000 metres per second in Squadrons. Currently we can increase laser speed but this also increases the range of lasers.

Re: Rate of fire

Posted: Sun Mar 28, 2021 6:35 pm
by JeremyaFr
WIP

Hello,
Here is a new WIP of the weapon rate hook.

I've fixed a bug.
EDIT: link removed

Re: Rate of fire

Posted: Mon May 03, 2021 3:49 pm
by JeremyaFr
UPDATE
Hello,
I've updated the weapon rate hook.

I've merged the changes from the WIP into the stable version.

Re: Rate of fire

Posted: Mon Nov 08, 2021 10:13 pm
by Darkblue
Hi, I have beenn trying this, because I wanted so much to make the TIE lasers more like in the movies (or in Squadrons). I mean, that they fire the lasers at faster rate, specially dual lasers. Maybe I am wrong but I understand that the hook allows to change the recharging and consumption rates, not the firing rate. And on the other hand, I tried the exe modification by Random Starfighter but it seems to do nothing in my case.

I wondered if it is just me or really for the TIEs is not possible to accelerate the firing ratio?

Thanks!