| RuneStorm http://www.runestorm.com/forums/ |
|
| Tactical Reload http://www.runestorm.com/forums/viewtopic.php?f=27&t=77890 |
Page 1 of 1 |
| Author: | pilau [ Thu Aug 15, 2013 5:52 am ] |
| Post subject: | Tactical Reload |
I am trying to implement tactical reload as described below (full thread here, not very long): Quote: What you're referring to is professionally called "tactical reload", and for an in-game implementation, you might consider actually "changing magazines", i.e. let's say, for instance, you start with 5 magazines of 30 rounds each. You engage the first battle and fire 20 bullets out of that magazine. When you reload, the game will retain that half-emptied- 10-round-magazine for you, and switch to the largest magazine at your disposal. So on until you finish your bullets. When you take an ammo pickup or reload at a weapon locker, regardless of whether you still have ammunition or not, let's compare that to when an actual soldier re-equips himself during a regroup - simply refill all magazines he has, perhaps get more if he can hold them. This goes in line with how ammo pickups and weapon lockers already work. I see that as far more realistic, challenging, and interesting, than the "arcade" implementation BWpro currently has to offer. One drawback I can see: In the heat of the battle you find yourself having 5 mags with 1-5 rounds each, which is definitely a possibility considering the implementation I suggested above. A solution might be to allow players to "collect" all of their remaining bullets into 1 magazine, of course at a certain time penalty like while reloading, only factored by the number of bullets in question as well. I am only a tiny bit familiar with BW code, that is to say, I have looked into how BallisticWeapon classes are designed, as well as BallisticAmmo classes and BallisticInstantFire(s). I have also read through the StartReload functions (ServerStartReload, ClientStartReload and CommonStartReload) code block. That's as far as I'm familiar with BW code. Since implementing the algorithm for the functionality described above is fairly easy, I would instead appreciate a clue on where to implement it within BW code. So, Xav, Grum, Kelly or anybody else - your guidance is appreciated! |
|
| Author: | Grum [ Thu Aug 15, 2013 12:12 pm ] |
| Post subject: | Re: Tactical Reload |
Thats the reload system Red Orchestra uses if i got it right. Exact amount of bullets left in various magazines for one gun. It is possible to achieve something like this in so many ways. There is not only one solution around for this. UScript is an object oriented language and as such you can do it as you like to do it. Thats called programming and you will have to do it yourself. You programm first on the paper or in your mind, then you code it up and then you compile. And after that the glorious testing and bugfixing comes Go crazy |
|
| Author: | pilau [ Thu Aug 15, 2013 12:19 pm ] |
| Post subject: | Re: Tactical Reload |
Thanks for your reply I am a developer, and as I said I have already went through all of the classes I believe are relevant to implementing this. You're right, there's definitely not a single solution for this, but as I said, I already have an idea of how to write the algorithm to handle tactical reload. However, I don't know how to integrate that into BW. As I said I have read all the reload code (not a lot, actually), which includes the StartReload functions (ServerStartReload, ClientStartReload and CommonStartReload). However I couldn't figure out where exactly is the actual reload happening (i.e. where you deduct from the stock bullets and refill the weapon "magazine" with rounds. Do you have any idea? I will check out Red Orchestra, perhaps I can even ask their permission to have a look/borrow their code. EDIT: By the look of it, I don't think I'll be able to find the guys who made Red Orchestra... It's so old! Guess I'll just have to download the mod and burrow into their code :/ Or simply write it all by myself. It shouldn't be so hard, only I need to know where in BW to interface with! |
|
| Author: | Azarael [ Thu Aug 15, 2013 12:46 pm ] |
| Post subject: | Re: Tactical Reload |
client Reload() calls ServerStartReload() serverside ServerStartReload verifies reload and starts CommonStartReload, replicating this to client via ClientStartReload() PlayReload plays the reload animation which calls Notify_ClipOut/Hit/In for magazine weapons at various points along the reload via the animation notify system, Notify_ShellIn for shovel load weapons instead Some of the reload code is also handled via the AnimEnd event, called when any given animation ends, which is passed to AnimEnded() for BW weapons |
|
| Author: | pilau [ Thu Aug 15, 2013 12:49 pm ] |
| Post subject: | Re: Tactical Reload |
Thanks Aza. I did understand all of that - just one thing you said caught my eye, which I am not getting - you're saying that the reloading code is called from the animation functions? EDIT: By the way, I did bump into this shovel keyword in areas where animations are handled. What is it? And what are "shovel load weapons"? Shotguns etc? EDIT 2: Ah, finally found it Code: simulated function Notify_ClipIn()
{ local int AmmoNeeded; if (ReloadState == RS_None) return; ReloadState = RS_PostClipIn; PlayOwnedSound(ClipInSound.Sound,ClipInSound.Slot,ClipInSound.Volume,ClipInSound.bNoOverride,ClipInSound.Radius,ClipInSound.Pitch,ClipInSound.bAtten); if (level.NetMode != NM_Client) { AmmoNeeded = default.MagAmmo-MagAmmo; if (AmmoNeeded > Ammo[0].AmmoAmount) MagAmmo+=Ammo[0].AmmoAmount; else MagAmmo = default.MagAmmo; Ammo[0].UseAmmo (AmmoNeeded, True); } } |
|
| Author: | Grum [ Thu Aug 15, 2013 12:58 pm ] |
| Post subject: | Re: Tactical Reload |
Functions can be defined in scripts and can be called from within animations. So called "Notifies". |
|
| Author: | Azarael [ Thu Aug 15, 2013 1:03 pm ] |
| Post subject: | Re: Tactical Reload |
Animations can have code notifies, which call a script function when the given frame of animation has been reached. Almost all such functions are marked with Notify_ in code. Edit: Too late. Left the reply window open... |
|
| Author: | pilau [ Thu Aug 15, 2013 1:06 pm ] |
| Post subject: | Re: Tactical Reload |
Yeah, it's a little bit like event-driven programming Couldn't grep for PlayReload(), where will I find it? |
|
| Author: | Azarael [ Thu Aug 15, 2013 1:08 pm ] |
| Post subject: | Re: Tactical Reload |
// Prepare to reload, set reload state, start anims. Called on client and server Code: simulated function CommonStartReload (optional byte i)
{ local int m; if (ClientState == WS_BringUp) ClientState = WS_ReadyToFire; if (bShovelLoad) ReloadState = RS_StartShovel; else ReloadState = RS_PreClipOut; PlayReload(); if (bScopeView && Instigator.IsLocallyControlled()) TemporaryScopeDown(Default.SightingTime*Default.SightingTimeScale); for (m=0; m < NUM_FIRE_MODES; m++) if (BFireMode[m] != None) BFireMode[m].ReloadingGun(i); if (bCockAfterReload) bNeedCock=true; if (bCockOnEmpty && MagAmmo < 1) bNeedCock=true; bNeedReload=false; } |
|
| Author: | pilau [ Thu Aug 15, 2013 1:15 pm ] |
| Post subject: | Re: Tactical Reload |
Oh, it didn't grep because of an insurgent space character Thanks guys, you helped me a lot. In hindsight, I could've just gone through all instances of MagAmmo in the file... lol.. silly me. |
|
| Author: | Blade sword [ Thu Aug 15, 2013 1:36 pm ] |
| Post subject: | Re: Tactical Reload |
I believe that you have to add each time reload you retrieve the clip size from the ammo reserve that's my abstract orientation here. Something like Removing MagAmmo from the ammo reserve or set the weapon as empty everytime the reload occurs. I haven't tried so I don't know which idea helps and works better |
|
| Author: | pilau [ Thu Aug 15, 2013 1:44 pm ] |
| Post subject: | Re: Tactical Reload |
I'm not sure I got you, but I'm planning on setting a magazines array for each weapon, and when a player hits 'reload', choose the most full magazine out of what the user has. That's the basis of it |
|
| Author: | pilau [ Thu Aug 15, 2013 5:25 pm ] |
| Post subject: | Re: Tactical Reload |
Are these two functions (in the BallisticFire class) relevant to what I'm doing? Code: simulated function CockingGun(optional byte Type)
{ if (bIsJammed && UnjamMethod == UJM_Cock) { bIsJammed = false; if (bJamWastesAmmo && Weapon.Role == ROLE_Authority) { ConsumedLoad += Load; Timer(); } } } simulated function ReloadingGun(optional byte i) { if (bIsJammed && (UnjamMethod == UJM_Reload || UnjamMethod == UJM_ReloadAndCock )) { bIsJammed = false; if (bJamWastesAmmo && Weapon.Role == ROLE_Authority) { ConsumedLoad += Load; Timer(); } } } |
|
| Author: | Azarael [ Fri Aug 16, 2013 12:26 pm ] |
| Post subject: | Re: Tactical Reload |
No. |
|
| Author: | Blade sword [ Fri Aug 16, 2013 2:15 pm ] |
| Post subject: | Re: Tactical Reload |
normally you should search ballistic weapon, I think there is the code bit that manages the magazines and ammo. I'm not sure about that but it should be in there. (Ballistic weapon is of course in BCore) |
|
| Author: | pilau [ Sat Aug 17, 2013 11:44 am ] |
| Post subject: | Re: Tactical Reload |
@Blade Sword thanks, I have already found it - if you're interested have a look at my 3rd post above |
|
| Page 1 of 1 | All times are UTC - 6 hours |
| Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |
|