This is probably a big ask and I don't expect it will actually make it in but just in case...
Anyway, it would be very useful if there was a HealthFactor value that could be set in the GameInfo section of MapInfo that would scale the Health of all actors by whatever value it gets set to. This could then be further modified by any other health scaling options such as those in skill info but the HealthFactor in GameInfo would set the base value. You might not think this is a big ask but wait there is a second part to this. ZDoom and by extension GZDoom makes a lot of hard-coded assumptions as to the scale actor's health values are going to fall within, for example, player pain and death sounds, blood decal generation, etc. HealthFactor would have to scale all these assumptions as well or the system would quickly break things if the scale was excessively large or small.
My own project would benefit from this immensely, I have manually scaled all health and all damage of all actors by a factor of 100. I did this in order to simulate health and damage values being a double with two decimal places rather than an integer. This gives me a lot more accuracy with damage and damage resistance calculations as I have a lot of stacking systems and being limited to integer health and damage values was leading to noticeable losses in accuracy. What I did not foresee was all the many systems that (G)ZDoom uses that assume the player and monster's health and damage are going stay somewhat close to their vanilla scale. For instance, when the player takes damage, they always use their Pain100 sound despite 100 health only being equivalent to 1% health, they always play the CrazyDeath sound unless gibbed, damage always spawns the maximum number of decals, etc. As I go along, I'm discovering more and more assumptions the engine makes about health and damage values that are broken by my scaling. So far my only recourse has been to try and disable all these features and remake them from scratch through ZScript if it is possible. It is very time consuming and frustrating, especially when I discover yet another thing that has broke and needs to be remade. I'm pretty sure redoing all these features through ZScript is not as efficient performance wise compared to them being handled natively, especially when combined with my coding skills.
I'm sure this is a huge request, as more than likely implementing a feature like this will require changes to many different systems but if it were done, it would make life much easier for me and anyone else who wants their project's health and damage to operate at a significantly different scale.
HealthFactor For GameInfo In MapInfo
Moderator: GZDoom Developers
-
- Posts: 307
- Joined: Fri Feb 21, 2014 5:04 pm
- Graphics Processor: nVidia with Vulkan support
- Location: Montana, USA
-
- Posts: 518
- Joined: Sat Aug 19, 2017 11:52 pm
- Graphics Processor: nVidia (Modern GZDoom)
Re: HealthFactor For GameInfo In MapInfo
Yes, I would need it too, and for the same reason; though I didn't even realize how many things get broken when you increase the health by an order of magnitude or two.
-
- Lead GZDoom+Raze Developer
- Posts: 49188
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: HealthFactor For GameInfo In MapInfo
This is virtually impossible to get right - there's far, far too much code that assumes that health is measured in full hit points that I could never guarantee to find them all and make adjustments.
-
- Posts: 307
- Joined: Fri Feb 21, 2014 5:04 pm
- Graphics Processor: nVidia with Vulkan support
- Location: Montana, USA
Re: HealthFactor For GameInfo In MapInfo
The Health and Damage values themselves don't need to become actual doubles, they can remain integers and the scaling could be limited to powers of 2 or just rounded to the nearest int value. The main problem I foresee is finding all the places in the code that assumes player health is around 100 hit points. If the health is scaled up significantly, certain systems wont work properly anymore, systems like player pain and death sounds and blood decal generation. I'm sure there are even more places that assume health and damage are going to be between certain values and all of these systems will have to be found and changed so as to scale with any Health scaling.
-
- Lead GZDoom+Raze Developer
- Posts: 49188
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: HealthFactor For GameInfo In MapInfo
I understand what you want, but it's not as simple as adding a magic factor. All code using these needs to found and reviewed. Where 'finding' is the big issue.
-
- Posts: 13834
- Joined: Tue Jan 13, 2004 1:31 pm
- Preferred Pronouns: She/Her
Re: HealthFactor For GameInfo In MapInfo
A solution that's less likely to lead to glitches is turning the property into a float/double value, and do the same for the corresponding damage entries. It will still need checking, though, to ensure that it works properly under the new system and checking through all the affected code is no trivial task - and is not any easier than verifying the code as Graf mentioned.
-
- Lead GZDoom+Raze Developer
- Posts: 49188
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: HealthFactor For GameInfo In MapInfo
You still need to change all damage applications to handle fractional damage.
This really is a huge change that requires alterations in a lot of code for very limited gain. The cost-benefit ratio here is very, very low.
IMO not worth changing.
This really is a huge change that requires alterations in a lot of code for very limited gain. The cost-benefit ratio here is very, very low.
IMO not worth changing.
-
-
- Posts: 26629
- Joined: Tue Jul 15, 2003 4:58 pm
- Location: Scotland
Re: HealthFactor For GameInfo In MapInfo
Given that the initial suggestion has been rejected (fair enough), I wonder if ZScript can be employed within the mod to do something like (bear in mind I don't know ZScript syntax very well at all so this is pseudo code):
if if gameskill == X && ismonster == true;
health = gethealth x 2;
That (written correctly, of course) could maybe used in an event handler that runs when a map starts to check any actor that is a monster, get its health and then multiply it by the appropriate factor for that skill level.
Maybe?
if if gameskill == X && ismonster == true;
health = gethealth x 2;
That (written correctly, of course) could maybe used in an event handler that runs when a map starts to check any actor that is a monster, get its health and then multiply it by the appropriate factor for that skill level.
Maybe?
-
- Posts: 518
- Joined: Sat Aug 19, 2017 11:52 pm
- Graphics Processor: nVidia (Modern GZDoom)
Re: HealthFactor For GameInfo In MapInfo
Setting the monsters' health is not a problem, the problem is with the player, and not with setting his health but with the fact that a lot of calculations assume that his max health is around 100-200. I thought that damage flash was all I needed to worry about, but as 22alpha22 says, there are also other things, such as pain sound, blood decals, and I don't know what else.
-
- Posts: 13834
- Joined: Tue Jan 13, 2004 1:31 pm
- Preferred Pronouns: She/Her
Re: HealthFactor For GameInfo In MapInfo
Unfortunately the only real solution I see is to manage the player's health with an extra variable and then scale the health amount accordingly.
This bit of code might be a starting point to creating a more flexible health management system. Do note however, that health powerups will have to be redirected accordingly to use the new RealHealth property. Also, this code is far from complete and will likely require some fixing up before it will work. But it should get you started with a more flexible player health system.
This bit of code might be a starting point to creating a more flexible health management system. Do note however, that health powerups will have to be redirected accordingly to use the new RealHealth property. Also, this code is far from complete and will likely require some fixing up before it will work. But it should get you started with a more flexible player health system.
Code: Select all
class FictionalDoomPlayer : DoomPlayer {
float RealHealth = 1000.0;
override int DamageMobj(Actor inflictor, Actor source, int damage, Name mod, int flags = 0, double angle = 0)
{
bool wasBuddha = bBuddha;
bBuddha = true; // don't let the player die
RealHealth -= (float)super.DamageMobj(inflictor, source, damage, mod, flags, angle);
bBuddha = wasBuddha;
if (RealHealth > 0)
{
Health = 1 + (int)((RealHealth / Default.RealHealth) * 99); // set health to desired value
if (Player)
Player.Health = Health;
}
else if (!wasBuddha)
{
// kill!
Health = (int)((RealHealth / Default.RealHealth) * 100);
if (Player)
Player.Health = Health;
Die(source, inflictor, flags, mod);
}
else // handle buddha
{
RealHealth = Health = 1;
if (Player)
Player.Health = Health;
}
}
}