Rate of fire

Need help editing the game? Check for help here!
Post Reply

Rate of fire

Leofus
Cadet 2nd Class
Posts: 60
Joined: Wed Jan 11, 2006 12:01 am

Post by Leofus » Sun Feb 14, 2021 8:32 am

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?

User avatar
Vince T
Fleet Admiral (Administrator)
Posts: 13340
Joined: Fri Apr 27, 2001 11:01 pm
Contact:

Post by Vince T » Sun Feb 14, 2021 9:39 am

I'm moving this into Editing/OPTing
Your ship, Captain. I need a drink. - Vince Trageton
Vince T's X-Wing HQ - where the bad guys get their gear

Random Starfighter
Cadet 4th Class
Posts: 15
Joined: Tue Oct 13, 2020 12:14 am

Post by Random Starfighter » 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.

Leofus
Cadet 2nd Class
Posts: 60
Joined: Wed Jan 11, 2006 12:01 am

Post by Leofus » Mon Feb 15, 2021 5:09 am

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

User avatar
Vince T
Fleet Admiral (Administrator)
Posts: 13340
Joined: Fri Apr 27, 2001 11:01 pm
Contact:

Post by Vince T » Mon Feb 15, 2021 8:38 am

@JeremyaFr Could that be integrated in the Weapons hook? I‘v got loads of ideas here XD
Your ship, Captain. I need a drink. - Vince Trageton
Vince T's X-Wing HQ - where the bad guys get their gear

Leofus
Cadet 2nd Class
Posts: 60
Joined: Wed Jan 11, 2006 12:01 am

Post by Leofus » Mon Feb 15, 2021 8:44 am

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:

User avatar
ual002
XWAU Member
Posts: 881
Joined: Wed Sep 24, 2008 2:23 am

Post by ual002 » 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?
Image Image Image Image Image

Bman
Lieutenant
Posts: 986
Joined: Mon Apr 05, 2004 11:01 pm

Post by Bman » Mon Feb 15, 2021 11:17 pm

This can also be done, at least via BHE. We've been using this for TFTC project for several years. Here's a "sample" just for the starfighters section to make IFF sides equal . . .
The values are probably translated differently per MXvTED editor.

<Patch Name="Change global speed of slot 280-LaserRebel.opt from 2000 to 1700">
<Item Offset="1B5128" From="D007" To="A406"/>
</Patch>
<Patch Name="Change global speed of slot 281-LaserRebelTurbo.opt from 2000 to 1700">
<Item Offset="1B512A" From="D007" To="A406"/>
</Patch>
<Patch Name="Change global speed of slot 282-LaserImp.opt from 1800 to 1700">
<Item Offset="1B512C" From="0807" To="A406"/>
</Patch>
<Patch Name="Change global speed of slot 283-LaserImpTurbo.opt from 1800 to 1700">
<Item Offset="1B512E" From="0807" To="A406"/>
</Patch>

.
W-I-P: ISD-II, (Imp) Escort Carrier, NL-1 Platform, Misc, & TFTC.

Bman
Lieutenant
Posts: 986
Joined: Mon Apr 05, 2004 11:01 pm

Post by Bman » Mon Feb 15, 2021 11:31 pm

Then on a craft/object level, say the X-wing for example, you could try to further tweak it's 1st Laser Fire Ratio from "0" to something else . . .
<Patch Name="1st Laser Fire Ratio from 0 to ??? for X-Wing.opt">
<Item Offset="1BA1D0" From="00" To="????"/>
</Patch>
W-I-P: ISD-II, (Imp) Escort Carrier, NL-1 Platform, Misc, & TFTC.

Random Starfighter
Cadet 4th Class
Posts: 15
Joined: Tue Oct 13, 2020 12:14 am

Post by Random Starfighter » 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.

User avatar
ual002
XWAU Member
Posts: 881
Joined: Wed Sep 24, 2008 2:23 am

Post by ual002 » Tue Feb 16, 2021 2:22 am

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.
Image Image Image Image Image

User avatar
JeremyaFr
XWAU Member
Posts: 2940
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » 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
You do not have the required permissions to view the files attached to this post.

User avatar
AngeI
Cadet 1st Class
Posts: 226
Joined: Sun Jan 24, 2016 5:27 pm

Post by AngeI » Tue Feb 16, 2021 10:41 pm

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?

Leofus
Cadet 2nd Class
Posts: 60
Joined: Wed Jan 11, 2006 12:01 am

Post by Leofus » Wed Feb 17, 2021 8:12 am

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?

User avatar
Vince T
Fleet Admiral (Administrator)
Posts: 13340
Joined: Fri Apr 27, 2001 11:01 pm
Contact:

Post by Vince T » 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.
Your ship, Captain. I need a drink. - Vince Trageton
Vince T's X-Wing HQ - where the bad guys get their gear

Leofus
Cadet 2nd Class
Posts: 60
Joined: Wed Jan 11, 2006 12:01 am

Post by Leofus » Wed Feb 17, 2021 8:53 am

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?

User avatar
Vince T
Fleet Admiral (Administrator)
Posts: 13340
Joined: Fri Apr 27, 2001 11:01 pm
Contact:

Post by Vince T » Wed Feb 17, 2021 9:58 am

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.
Your ship, Captain. I need a drink. - Vince Trageton
Vince T's X-Wing HQ - where the bad guys get their gear

User avatar
Will T
Galactic Empire
Posts: 1295
Joined: Thu Aug 19, 2004 11:01 pm

Post by Will T » Thu Feb 18, 2021 10:27 am

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.
Formerly known as The 95 Headhunter

User avatar
Vince T
Fleet Admiral (Administrator)
Posts: 13340
Joined: Fri Apr 27, 2001 11:01 pm
Contact:

Post by Vince T » Thu Feb 18, 2021 11:06 am

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 :)
Your ship, Captain. I need a drink. - Vince Trageton
Vince T's X-Wing HQ - where the bad guys get their gear

User avatar
BattleDog
Rebel Alliance
Posts: 2869
Joined: Fri Apr 06, 2001 11:01 pm

Post by BattleDog » Fri Feb 19, 2021 8:56 pm

So is it now possible to vary refire rate by ship?

If so that's way-cool.
Got rid of the sig, it was upsetting me.

User avatar
JeremyaFr
XWAU Member
Posts: 2940
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » 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.

User avatar
BattleDog
Rebel Alliance
Posts: 2869
Joined: Fri Apr 06, 2001 11:01 pm

Post by BattleDog » Sat Feb 20, 2021 8:25 pm

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.
Last edited by BattleDog on Mon Feb 22, 2021 6:40 am, edited 1 time in total.
Got rid of the sig, it was upsetting me.

Bman
Lieutenant
Posts: 986
Joined: Mon Apr 05, 2004 11:01 pm

Post by Bman » Sat Feb 20, 2021 11:42 pm

@JeremyaFr Thanks for this. Can this work to slow down the rate of fire on rear turrets of Shuttle? Say front lasers use standard slots 280/282 (leave alone) but slow down rear turbo turrets slots 281/283 or 288/289? #2) How to implement for 2, 3, or more seconds? One second (47 = 236 time units) would we use 47 x 2 = 94 and your hook auto converts to hex? #3). So are all different laser slots employed by the .opt model affected in unison?
W-I-P: ISD-II, (Imp) Escort Carrier, NL-1 Platform, Misc, & TFTC.

Post Reply