Difficulty Functions, Flags, and other misc. settings
Moderator: GZDoom Developers
-
- Posts: 612
- Joined: Tue Mar 17, 2009 5:12 am
- Location: done making ZDF free sprites
Difficulty Functions, Flags, and other misc. settings
I was thinking earlier about difficulty settings, and how little coders appear to be able to use them. Here are some ideas that may help that problem.
A_JumpIfDifficulty(name, state/frames)
A_JumpIfDifficulty could be used on monsters to give them more accuracy or other attacks custom tailored to difficulty. They also could be used in monster spawners to adapt to the difficulty and spawn more, or tougher monsters. Weapons, effects, powerups, and even scenery could have different behavior depending on difficulty.
+IGNOREDIFFICULTY
Essentially, this flag would cause an ammunition type or powerup (anything applicable) to ignore any difficulty based changes, such as less or double ammo.
DropItemX (X = difficulty)
Not a biggie, but it'd possibly help in mods where people want easier modes to have extra items dropped by monsters. This would probably use the spawning filter difficulty.
Just throwing out some ideas.
A_JumpIfDifficulty(name, state/frames)
A_JumpIfDifficulty could be used on monsters to give them more accuracy or other attacks custom tailored to difficulty. They also could be used in monster spawners to adapt to the difficulty and spawn more, or tougher monsters. Weapons, effects, powerups, and even scenery could have different behavior depending on difficulty.
+IGNOREDIFFICULTY
Essentially, this flag would cause an ammunition type or powerup (anything applicable) to ignore any difficulty based changes, such as less or double ammo.
DropItemX (X = difficulty)
Not a biggie, but it'd possibly help in mods where people want easier modes to have extra items dropped by monsters. This would probably use the spawning filter difficulty.
Just throwing out some ideas.
-
-
- Posts: 17934
- Joined: Fri Jul 06, 2007 3:22 pm
Re: Difficulty Functions, Flags, and other misc. settings
My predictions:
1. [WFDS]
2. [wiki=Actor flags#INVENTORY.IGNORESKILL][Already in][/wiki]
3. [WFDS]
Note that if you want to have monster loot depend on skill setting, you can do that already with the skill property ReplaceActor. E.g., DropItem "ImpLoot" in your actor, then in your skill "ReplaceActor = "ImpLoot", "SomeStuff"".
1. [WFDS]
2. [wiki=Actor flags#INVENTORY.IGNORESKILL][Already in][/wiki]
3. [WFDS]
Note that if you want to have monster loot depend on skill setting, you can do that already with the skill property ReplaceActor. E.g., DropItem "ImpLoot" in your actor, then in your skill "ReplaceActor = "ImpLoot", "SomeStuff"".
-
- Posts: 1113
- Joined: Wed Jul 16, 2003 8:53 am
- Location: Perth, Western Australia
Re: Difficulty Functions, Flags, and other misc. settings
I confess I can't see why the first one would be difficult. GameSkill is an integer value available to ACS. It simply needs to be exposed to DECORATE, as so many other ACS variables are. ("Simply", says the person who doesn't, really, know what goes on inside the code. )
Traditionally, the main technique available to change the difficulty of a level is to vary the number of monsters according to skill level. Exposing the GameSkill to DECORATE allows much more flexibility to mod-makers. For example, the level design may make it undesirable, or impossible, to add another monster at a particular place in a level. The ability to change the monster itself would still allow the mod-maker to adjust the difficulty.
As The_Funktasm points out, A_JumpIfDifficulty would allow the creation of actors that could adjust their behaviour and characteristics as the skill level changed. At lower skills monsters might throw a punch for a melee attack, while kicking at higher skills. At lower skills a monster might fire its gun once per attack sequence, with a lower accuracy; while at higher skills it might fire two or three times, with a higher accuracy. It might change its dropped item, or might run a script that checks a different loot table. It might have more or less health, or armour.
Ok, you could probably use dummy inventory items to pass the skill level to the actor, but this will require an ACS script to give the item to every monster you want to be able to vary. You'd probably have to add this to the spawn state of every monster's DECORATE. Having the GameSkill directly available to DECORATE would surely be neater.
Traditionally, the main technique available to change the difficulty of a level is to vary the number of monsters according to skill level. Exposing the GameSkill to DECORATE allows much more flexibility to mod-makers. For example, the level design may make it undesirable, or impossible, to add another monster at a particular place in a level. The ability to change the monster itself would still allow the mod-maker to adjust the difficulty.
As The_Funktasm points out, A_JumpIfDifficulty would allow the creation of actors that could adjust their behaviour and characteristics as the skill level changed. At lower skills monsters might throw a punch for a melee attack, while kicking at higher skills. At lower skills a monster might fire its gun once per attack sequence, with a lower accuracy; while at higher skills it might fire two or three times, with a higher accuracy. It might change its dropped item, or might run a script that checks a different loot table. It might have more or less health, or armour.
Ok, you could probably use dummy inventory items to pass the skill level to the actor, but this will require an ACS script to give the item to every monster you want to be able to vary. You'd probably have to add this to the spawn state of every monster's DECORATE. Having the GameSkill directly available to DECORATE would surely be neater.
-
-
- Posts: 17934
- Joined: Fri Jul 06, 2007 3:22 pm
Re: Difficulty Functions, Flags, and other misc. settings
Sure, but that could be done by having gameskill (and other useful global variables) available to [wiki]DECORATE expressions[/wiki], rather than yet-another-A_Jump function.
-
- Posts: 612
- Joined: Tue Mar 17, 2009 5:12 am
- Location: done making ZDF free sprites
Re: Difficulty Functions, Flags, and other misc. settings
http://zdoom.org/wiki/Projectile_TrapGez wrote:Sure, but that could be done by having gameskill (and other useful global variables) available to [wiki]DECORATE expressions[/wiki], rather than yet-another-A_Jump function.
After reading that, another A_Jump sounds wonderful.
Alternatively, you could add it to another jump function, dunno which one.
-
- Posts: 1113
- Joined: Wed Jul 16, 2003 8:53 am
- Location: Perth, Western Australia
Re: Difficulty Functions, Flags, and other misc. settings
So what's involved in exposing GameSkill to DECORATE?Gez wrote:Sure, but that could be done by having gameskill (and other useful global variables) available to [wiki]DECORATE expressions[/wiki], rather than yet-another-A_Jump function.
-
- Posts: 1113
- Joined: Wed Jul 16, 2003 8:53 am
- Location: Perth, Western Australia
Re: Difficulty Functions, Flags, and other misc. settings
Sorry for the bump, but I really would like an answer to this:
What is involved in exposing GameSkill to DECORATE, please?
What is involved in exposing GameSkill to DECORATE, please?
-
- Lead GZDoom+Raze Developer
- Posts: 49184
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Difficulty Functions, Flags, and other misc. settings
You define different actor classes and set a class remapping in MAPINFO. That way you don't have to mess around in the actor with A_JumpIf's.
-
- Posts: 3302
- Joined: Wed Mar 23, 2005 5:31 pm
- Location: New Jersey
Re: Difficulty Functions, Flags, and other misc. settings
For those that need an example, it involves using the [wiki=MAPINFO/Skill_definition]Skill definition[/wiki] in MAPINFO and would look something like this...
This creates the custom skill (shows up as "Shotgunners are Evil" in the menu) that if selected by the player, replaces all the ShotgunGuys with the new, more difficult shotgunner. This lets you do the different behaviors per difficulty as suggested, with the added benefit of doing it without encapsulating all the difficulty behaviors in a single actor, reducing that actor's complexity.
Code: Select all
//
// DECORATE
//
// This is a ShotgunGuy that fires more bullets, more accurately, with more damage per bullet. For Hard mode.
ACTOR ShotgunGuyHard : ShotgunGuy
{
States
{
Missile:
SPOS E 10 A_FaceTarget
SPOS F 10 BRIGHT A_CustomBulletAttack(14, 0, 4, 6, "BulletPuff")
SPOS E 10
Goto See
}
}
Code: Select all
//
// MAPINFO
//
skill MyCustomSkill
{
name = "Shotgunners are Evil"
replaceactor = "ShotgunGuy", "ShotgunGuyHard"
}
-
- ... in rememberance ...
- Posts: 6109
- Joined: Fri Jul 06, 2007 2:34 pm
Re: Difficulty Functions, Flags, and other misc. settings
If you really need this, you could try A_JumpIf(ACS_ExecuteWithResult) pointing to a script that returns game skill.The_Funktasm wrote:A_JumpIfDifficulty(name, state/frames)
-
- Posts: 1113
- Joined: Wed Jul 16, 2003 8:53 am
- Location: Perth, Western Australia
Re: Difficulty Functions, Flags, and other misc. settings
Brilliant! They look great alternatives.
Many thanks.
Many thanks.