Page 1 of 1

On DECORATE Reloading

Posted: Thu May 11, 2006 17:57
by DoomRater
I just finished blabbering about DECORATE and some of the different ways games do reloading. It strikes me as odd that I haven't seen any of the reloading style where you throw away a partial clip- everyone's been using reloading where it takes away from your total ammo count.

See, the reason I'm pointing it out here is because it's a hell of a lot easier to implement. Check this mock reloading code out:

Code: Select all

AltFire:
   TNT1 A 0 A_JumpIfInventory("GenericGunClipAmmo",15,1) //assuming that's like half ammo
   Goto AltFire + 3
   TNT1 A 0
   Goto Ready
   TNT1 A 0 A_TakeInventory("GenericGunClipAmmo",999) 
   TNT1 A 3 A_PlaySound("ClipOut")
   TNT1 AAA 3
   TNT1 A 0 A_TakeInventory("GenericGunClip",1)
   TNT1 A 0 A_GiveInventory("GenericGunClipAmmo",999)
   TNT1 A 4 A_PlaySound("ClipIn")
   TNT1 AA 3
   TNT1 A 3 A_PlaySound("CockGun")
   TNT1 AA 3
   Goto Ready
Notice how there's only one decision in the whole code? And that's even copy and pastable! Bitchin! Sure, it means you can waste up to half the ammo you can carry, but all you have to do is double the amount of clips carryable to balance that issue out and make sure the player always has enough ammo for the job. (adding only a quarter might even be better)

Okay, enough selling the idea- what thoughts do you guys have on it?

Posted: Thu May 11, 2006 18:12
by wildweasel
I've been experimenting with a more unique style of reloading that takes advantage of Heretic-style items. It won't require any extra coding in the weapon itself (outside of clip checks to make sure the weapon won't still shoot or auto-switch if it's out). But my idea is to make ammo clips into inventory items, that you must highlight and use to reload specific weapons. The disadvantage of that is that it'll be harder (probably impossible) to implement reloading animations, or disallow the player to use a clip item unless he's wielding the gun that it goes to.

Posted: Thu May 11, 2006 19:53
by DoomRater
Harder? Ha. Simply have the item give IsReloading at the same time and check for it like what I did in my recode of Inuyasha's M-16. Of course, if you're going to do that, you could just as well do exactly what was done in that M-16... but I do understand what you're going for.

Simply put, once I had that I'd be binding the ammo type to keys on my layout rather than sifting through the inventory list.

Checking the gun item means another counter- one that says "Hey! I'm the weapon being used!" at least until there's a way to check weapon names in DECORATE. But still, doable.

Posted: Mon May 15, 2006 0:42
by Zero Prophet
Seeing that something along the lines of a "Use" state exists for inventory items, it would be theoretically possible to have the clip selection autoselect the particular weapon in the process. On the other extreme, this method behind the madness specifically requires the use of a decorative SetWeapon equivalent, which does not exist to my limited knowledge.

I also have developed a massive grudge against the aforementioned wasteful system of reloading ever since getting stuck on The Chronicles of Riddick and forcing a fresh start as I ran out of ammo due to excess reloading. Use at your own risk.

Posted: Mon May 15, 2006 18:49
by DoomRater
There does indeed exist the equivilent- It was used in Kgsws's skin weapons.

A_SelectWeapon(weapon name)

Posted: Mon May 22, 2006 3:46
by Xaser
Wait, timeout. This is possible? That's pretty damn good news, then.

And I don't care what the prophets say... Riddick's reloading system is pretty damn cool. It makes things much more strategic, preventing reloading every bloody two seconds (which I usually do anyway).

Posted: Mon May 22, 2006 3:52
by DoomRater
What's more, it's EASIER than implementing the other reloading style.

Now, usually I keep people from over-reloading by making sure the clip's half empty first. That's what I did for the Boombox in Stupid Deathmatch.