Page 2 of 7

Re: [WIP] Cold As Hell - Fixing the Massive Lag 4 Years Late!

Posted: Fri Aug 08, 2008 11:50 am
by .+:icytux:+.
yea, seems like the reloading system is buggy in the old version :P

i tried it and when i picked the shotgun up. well. nothing worked anymore.

Re: [WIP] Cold As Hell - Fixing the Massive Lag 4 Years Late!

Posted: Fri Aug 08, 2008 12:16 pm
by Kate
wildweasel wrote:
ThatOneZDoomer wrote:Also, how come early reloading systems like this mod (and others like Zen Dynamics) used ACS compared to the decorate based systems of later reloading systems?
Because it hadn't been discovered at that point that one could just create a dummy Decorate inventory item to serve as the Reload key. Earlier ACS reload scripts relied on the player pressing a key to puke the respective script to give the player a flag to reload. Nowadays, though, we've figured out that such a thing can be done using CustomInventory.
Uhm, no. These projects were started much before CustomInventory was even introduced.

Re: [WIP] Cold As Hell - Fixing the Massive Lag 4 Years Late!

Posted: Fri Aug 08, 2008 12:48 pm
by Graf Zahl
It was released before custom weapons were available. Hard to define a weapon without the capabilites to do so! ;)

Re: [WIP] Cold As Hell - Fixing the Massive Lag 4 Years Late!

Posted: Fri Aug 08, 2008 2:01 pm
by JonayaRiley
Yeah, like GZ and SnowKate said. Keep in mind I originally started work on this thing in early 2004, which was well before the custom weapons were in ZDoom. Also, I started when custom actors and DECORATE in general were still pretty new, so the mod was 100% DeHackED until fairly late in its development cycle. The monsters and stuff are ported over to DECORATE, but you can still see remnants of the DEH dev cycle (like the earlier monsters/soldiers are all replacing existing monsters so I didn't have to change hundreds of spawn points).

The current options available to do reloading weapons are worlds better than using the old ACS script methods.

Actually, the old version does it kind of like Half Life. It checks your pool of ammo and flags some of it as being "in the weapon" and checks against that when firing. It's both complicated and buggy, even under ideal circumstances.

ThatOne, what didn't you like about the objective HUD? I'm very open to suggestions for making it better.

Re: [WIP] Cold As Hell - Fixing the Massive Lag 4 Years Late!

Posted: Fri Aug 08, 2008 2:28 pm
by Shadelight
This sounds interesting, I never played the original Cold As Hell, but I read some good things about it. :)

Re: [WIP] Cold As Hell - Fixing the Massive Lag 4 Years Late!

Posted: Fri Aug 08, 2008 2:30 pm
by ThatOneZDoomer
JonnyFive wrote:ThatOne, what didn't you like about the objective HUD? I'm very open to suggestions for making it better.
It covers the whole screen and takes about five or more seconds to fade away, which to me, is a little too long when I already read what's written. I guess I wouldn't care so much about how long it stays onscreen if it didn't block my view so much. I think it could be improved by showing only text and maybe a picture or two to get the point across. This way, you can still see the rest of the screen when it comes up. Also, I think it should be toggle based, so that it stays up till you hit the objective key to make it go away, similar to how Zen Dynamics does it.

Re: [WIP] Cold As Hell - Fixing the Massive Lag 4 Years Late!

Posted: Fri Aug 08, 2008 3:24 pm
by Project Shadowcat
ThatOneZDoomer wrote:Also, I think it should be toggle based, so that it stays up till you hit the objective key to make it go away, similar to how Zen Dynamics does it.
And MechWarrior, while we're at it.

I'd like to see this thing truly finished as well. =) I was very interested in some of the concepts and I do so want to be able to complete it in a playable state.

Re: [WIP] Cold As Hell - Fixing the Massive Lag 4 Years Late!

Posted: Fri Aug 08, 2008 5:31 pm
by Unknown_Assassin
The only thing I remembered most about this wad was the lag. :P

Good to see that you are making major adjustments! :)

Re: [WIP] Cold As Hell - Fixing the Massive Lag 4 Years Late!

Posted: Fri Aug 08, 2008 11:20 pm
by Phucket
I'd really like to see this completed. Cold As Hell is still one of my favorite wads of all time. There were so many things in it that I hadn't seen in any previous wads I had played, such as weapons reloading, weather effects, a completely different health system, and actual fixed gun emplacement (not just the simple turret consisting of a bunch of floors and middle textures assembled to look like a gun that fired some kind of projectile when you pushed a button on the back). What's really impressive is that this wad actually scared me at times, and to be honest, there is only 1 other doom wad that actually scare me (Happy Time Circus 2) I was able to run it without too much lag, but the reload system had a nasty habit of screwing up. I'd be walking down a hallway, and with no warning, my double barreled shotgun would suddenly become the ultimate killing machine, firing off hundreds and hundreds of shells in a split second without ever needing to be reloaded. I still don't understand why, but that almost seems to happen at fixed locations, like when I entered the hospital. There was also a crap load of polyobject texture bleeding everywhere I turned, but I'm not really sure whether or not that's your fault or not.

Re: [WIP] Cold As Hell - Fixing the Massive Lag 4 Years Late!

Posted: Sat Aug 09, 2008 12:15 am
by Xaser
Yowza! Good to hear about this! I never was able to finish the wad either, despite its epic value. Here's to hoping you'll pull off something truly amazing this time 'round. ;P

Regarding the reloading, I must warn you that though it's been cited as an example a few times, Zen Dynamics is most certainly *not* a good place to learn to do the reloading scripts. The very concepts were being built at that time (Zen was the first of its kind, actually) so the weapon code is convulted and messy like you wouldn't imagine. Even I'm scared to go back and mess with the old code. Gives me nightmares sometimes. ;P

Check some of WildWeasel's works for inspiration (Diaz mainly), though in all honesty with a little patching, the current reloading system isn't terrible. Unless, of course, the rumors are true and it simply doesn't work. Can't recall the last time I've checked...

Re: [WIP] Cold As Hell - Fixing the Massive Lag 4 Years Late!

Posted: Sat Aug 09, 2008 12:41 am
by wildweasel
If you're going to base your reloading code off of anything, look at my Doom Armory tutorial instead of referring to Diaz directly. It should be a little easier to understand, considering how many extra hacks and effects the Diaz weapons use at the moment.

Re: [WIP] Cold As Hell - Fixing the Massive Lag 4 Years Late!

Posted: Sat Aug 09, 2008 9:43 am
by JonayaRiley
WIldweasel, your tutorial was one of the first things I found when searching for a better way to handle the reloading code. I think I'll use the basic idea, as well as using a similar fake item token to handle a toggle objective screen and note-reading screen.

I like the magazine-based system a lot, and it seems easier to implement than trying to do an ammo-pool-based system through DECORATE. I'll just go back and re-do the ammo layout as needed.

Re: [WIP] Cold As Hell - Fixing the Massive Lag 4 Years Late!

Posted: Sat Aug 09, 2008 11:20 am
by Zippy
JonnyFive wrote:I like the magazine-based system a lot, and it seems easier to implement than trying to do an ammo-pool-based system through DECORATE. I'll just go back and re-do the ammo layout as needed.
An ammo-pool system is cakewalk with a simple mix of ACS and DECORATE.

Code: Select all

/*   DECORATE    */

// In-Clip Pistol ammo
ACTOR PistolAmmo : Ammo
{
	Inventory.Amount 12
	Inventory.MaxAmount 12
	Inventory.Icon "CLIPB0"
	Ammo.BackpackAmount 0
	Ammo.BackpackMaxAmount 12
	+QUIET
	+IGNORESKILL
}

ACTOR NewPistol : Weapon replaces Pistol
{
	Obituary "%o was tickled by %k's pea shooter"
	Weapon.SelectionOrder 1900
	Weapon.KickBack 125
	Weapon.AmmoType "PistolAmmo"
	Weapon.AmmoType2 "Clip" // Displays reserve ammo
	Weapon.AmmoUse 1
	Weapon.AmmoUse2 0
	+AMMO_OPTIONAL
	+WIMPY_WEAPON
	States
	{
		Ready:
			NPIS A 1 A_WeaponReady
			NPIS A 0 A_JumpIfInventory("PistolAmmo",12,"Ready") // No reload on full clip
			NPIS A 0 A_JumpIfInventory("Reloader",1,"PreReload") // Reload?
			Loop
		PreReload:
			NPIS A 0 A_JumpIfInventory("Clip",1,"Reload") // Got any extra ammo?
			Goto Ready
		Reload:
			NPIS F 3 A_PlayWeaponSound("weapons/pistol/clipout")
			NPIS A 6
			NPIS A 4 A_PlayWeaponSound("weapons/pistol/clipin")
			NPIS G 4
			NPIS H 4
			NPIS IJ 5
			NPIS K 5
			NPIS L 4 A_PlayWeaponSound("weapons/pistol/slide")
			NPIS M 4
			NPIS N 6
			NPIS G 3
			NPIS A 0 A_TakeInventory("Realoder")
			NPIS A 0 ACS_ExecuteAlways(778,0,2) // Reload ammo.  2 == PISTOL
			NPIS A 1 A_WeaponReady
			Goto Ready
		Fire:
			NPIS A 0 A_JumpIfNoAmmo("DryFire")
			NPIS A 0 A_PlayWeaponSound("weapons/pistol/fire")
			NPIS A 0 A_GunFlash
			NPIS B 5 A_FireBullets(2.2,1.6,1,8,"RicochetPuff")
			NPIS C 3
			NPIS D 3
			NPIS A 4
			NPIS A 0 A_ReFire
			Goto Ready
		DryFire:
			NPIS A 10 A_PlayWeaponSound("weapons/click")
			NPIS A 0 A_ReFire
			Goto Ready
		// Rest of the states go here...
	}
}


/*   ACS    */
#define PISTOL 2
#define PISMAX 12
#define ASSAULTRIFLE 4
#define ARMAX 35

/ Ammo synchonizer.  When you reload, this script fills up the ammo
// for your current weapon and also takes the appropriate amount away
// from your backup stash of ammo.  Some management is handled by DECORATE,
// so for this script it IS ASSUMED that the player has at least 1 backup
// unit of ammo and has at most MaxAmmoInClip - 1 in clip.
script 778 (int weapon) {
	int missing;

	if ( weapon == PISTOL ) {
		missing = PISMAX - CheckInventory("PistolAmmo");
		// Either you have enough backup ammo to fill what is missing
		// or you don't
		if ( CheckInventory("Clip") >= missing ) {
			// Have enough to fill
			TakeInventory("Clip",missing);
			GiveInventory("PistolAmmo",PISMAX);
		} else {
			// Don't have enough to fill
			GiveInventory("PistolAmmo", CheckInventory("Clip") );
			TakeInventory("Clip",PISMAX);
		}
	}

	if ( weapon == ASSAULTRIFLE ) {
		missing = ARMAX - CheckInventory("ARAmmo");
		if ( CheckInventory("Clip") >= missing ) {
			TakeInventory("Clip",missing);
			GiveInventory("ARAmmo",ARMAX);
		} else {
			GiveInventory("ARAmmo", CheckInventory("Clip") );
			TakeInventory("Clip",ARMAX);
		}
	}
}

Re: [WIP] Cold As Hell - Fixing the Massive Lag 4 Years Late!

Posted: Sat Aug 09, 2008 8:32 pm
by DoomRater
SnowKate709 wrote:
wildweasel wrote:
ThatOneZDoomer wrote:Also, how come early reloading systems like this mod (and others like Zen Dynamics) used ACS compared to the decorate based systems of later reloading systems?
Because it hadn't been discovered at that point that one could just create a dummy Decorate inventory item to serve as the Reload key. Earlier ACS reload scripts relied on the player pressing a key to puke the respective script to give the player a flag to reload. Nowadays, though, we've figured out that such a thing can be done using CustomInventory.
Uhm, no. These projects were started much before CustomInventory was even introduced.
Timeline time:
DECORATE introduced. Inventory items gained pickup states. AltFire introduced. Realization that inventory items can be used as counters. CustomInventory splitoff of pickup et al. states from Inventory items. Realization that Inventory items can act as inventory item control, creating what we have today for reloading weapons.

Not sure where introduction of Fail commands fits in there, but I think it was long before the splitoff. Theoretically, reloading and altfires were possible before AltFire was introduced if I'm correct about pickup states being before AltFire. If not, they would still have needed ACS to activate them.

Re: [WIP] Cold As Hell - Fixing the Massive Lag 4 Years Late!

Posted: Sun Aug 10, 2008 8:39 am
by JonayaRiley
The DECORATE-based weapon reloading is going quite well. So far the 1911, the Thompson, and the shotgun are all complete and the rest shouldn't be a problem to do tonight. The ability to jump to new state names "like Reload or Dryfire" is a huge help, and the new reload system is a lot better than the old one was even when it worked properly.