Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Development

Reply
 
Thread Tools Display Modes
Old December 8, 2015, 21:12   #1
Derakon
Prophet
 
Derakon's Avatar
 
Join Date: Dec 2009
Posts: 7,943
Derakon is on a distinguished road
Implementing stat swap concepts

As discussed in the gnome mages thread, it'd be nice to have some alternative implementations of the nexus stat swap effect. This thread can discuss implementations. Arguments about what game impact nexus should have can continue going in the original thread; this is more for code details.

The current effect is "memoryless", i.e. the game just swaps the values of two of your stats, and that's the "new normal". Any effect that allows for later reversion (as a temporary status effect, or reversion at levelup, is going to require the game to keep track of what the stats ought to be when the effect expires, so they can be restored later.

I haven't had a chance to take a close look at the 4.0 codebase yet, but a quick look indicates that there's still a player struct that includes an array of current stat values (stat_cur). I assume this is the "internal" stat value before race/class/equipment modifiers are applied.

The way I'd propose tracking nexus stat swaps, then, would be to add a "lookup table" that maps stat indices to stat indices. Normally this would be an array that looks like this: {0, 1, 2, 3, 4}. That is, each stat index maps to itself. When a nexus stat swap occurs, we a) swap the stat values in stat_cur (as we do now), and b) update the mapping array. For example, if STR and INT are swapped, then the array becomes {1, 0, 2, 3, 4}. If STR then further gets swapped with CON, it becomes {4, 0, 2, 3, 1}.

When the time comes to revert the swap, we can use the mapping array as a guide, and then restore that array to its "identity" state.

This does result in the interesting behavior that e.g. if you get swapped, then any stat boosts / drains applied during the swap will "transfer" when the swap reverts. Which sounds reasonable enough to me.

Presumably it'd also be desirable to add a "Nexus" or "Scrambled" text to the status line to indicate to the player that their character is in a temporarily-unusual state. Though this could result in semi-annoying UI if (in Nick's proposal where the stat swap only goes away on levelup) the character hits level 50 with maxed stats across the board and can't get rid of that little status line. One reason to prefer the temporary status effect approach I proposed.
Derakon is offline   Reply With Quote
Old December 9, 2015, 16:11   #2
Estie
Veteran
 
Join Date: Apr 2008
Location: Germany
Posts: 1,413
Estie is on a distinguished road
What about this:

A nexus attack applies damage and a random effect from (various teleports, stat swap), right ?

Now replace full swap with partial swap where the amount of points exchanged is proportional to the damage received; so a weak vortex breath might do +1, while a strong dracolisk breath can do up to +15 or so.
This way swap effectively remains in the game, but only the most powerfull nexus monsters can deliver the full effect.

If it is an issue of "not hard enough!", the chance for the swap occuring can be increased.
Estie is offline   Reply With Quote
Old December 9, 2015, 16:28   #3
Ingwe Ingweron
Veteran
 
Join Date: Jan 2009
Location: Manhattan Beach, CA
Posts: 1,432
Ingwe Ingweron is on a distinguished road
Quote:
Originally Posted by Estie View Post
What about this:

A nexus attack applies damage and a random effect from (various teleports, stat swap), right ?

Now replace full swap with partial swap where the amount of points exchanged is proportional to the damage received; so a weak vortex breath might do +1, while a strong dracolisk breath can do up to +15 or so.
This way swap effectively remains in the game, but only the most powerfull nexus monsters can deliver the full effect.

If it is an issue of "not hard enough!", the chance for the swap occuring can be increased.
This seems reasonable to me. It avoids the "gotcha" effect of a low-level nexus vortex screwing up an unaware @, while not defanging the higher level monsters. It has the added benefit of following the Angband philosophy used with most other monsters of introducing an effect when it is relatively harmless, thereby making a player aware of its existence, before it is encountered full-force later in the game.
__________________
“We're more of the love, blood, and rhetoric school. Well, we can do you blood and love without the rhetoric, and we can do you blood and rhetoric without the love, and we can do you all three concurrent or consecutive. But we can't give you love and rhetoric without the blood. Blood is compulsory. They're all blood, you see.”
― Tom Stoppard, Rosencrantz and Guildenstern are Dead
Ingwe Ingweron is offline   Reply With Quote
Old December 9, 2015, 17:10   #4
Derakon
Prophet
 
Derakon's Avatar
 
Join Date: Dec 2009
Posts: 7,943
Derakon is on a distinguished road
Guys, guys, I wanted to keep this thread about the specifics of how an implementation ought to work, not what exactly should be done. Ideally any implementation will support a wide range of possible effects so we can experiment and figure out which effect works best.
Derakon is offline   Reply With Quote
Old December 9, 2015, 17:31   #5
Estie
Veteran
 
Join Date: Apr 2008
Location: Germany
Posts: 1,413
Estie is on a distinguished road
Sorry; my post implies that "memory" isnt needed, so I thought it would fit.
Estie is offline   Reply With Quote
Old December 9, 2015, 20:20   #6
Nick
Vanilla maintainer
 
Nick's Avatar
 
Join Date: Apr 2007
Location: Canberra, Australia
Age: 52
Posts: 6,566
Donated: $60
Nick is on a distinguished road
Quote:
Originally Posted by Derakon View Post
The way I'd propose tracking nexus stat swaps, then, would be to add a "lookup table" that maps stat indices to stat indices. Normally this would be an array that looks like this: {0, 1, 2, 3, 4}. That is, each stat index maps to itself. When a nexus stat swap occurs, we a) swap the stat values in stat_cur (as we do now), and b) update the mapping array. For example, if STR and INT are swapped, then the array becomes {1, 0, 2, 3, 4}. If STR then further gets swapped with CON, it becomes {4, 0, 2, 3, 1}.
Yes, this looks like the correct way to do it.

One of the things I have been aiming at with the 4.0 codebase is for the code to represent as transparently as possible what is happening in the game world - so preferencing clarity over efficiency. This scheme fits in, because it is a direct statement of stats being swapped, which is what we are thinking the in-game effect is.
__________________
One Ring to rule them all, One Ring to find them,
One Ring to bring them all and in the darkness bind them.
Nick is offline   Reply With Quote
Old December 9, 2015, 20:25   #7
Nick
Vanilla maintainer
 
Nick's Avatar
 
Join Date: Apr 2007
Location: Canberra, Australia
Age: 52
Posts: 6,566
Donated: $60
Nick is on a distinguished road
Quote:
Originally Posted by Estie View Post
Now replace full swap with partial swap where the amount of points exchanged is proportional to the damage received; so a weak vortex breath might do +1, while a strong dracolisk breath can do up to +15 or so.
This way swap effectively remains in the game, but only the most powerfull nexus monsters can deliver the full effect.
Another way of representing the power would be to have stat swaps as an additional effect to the teleport. So any nexus attack has a teleport effect, plus a (small) random number of swaps, more for bigger attacks.
__________________
One Ring to rule them all, One Ring to find them,
One Ring to bring them all and in the darkness bind them.
Nick is offline   Reply With Quote
Old December 9, 2015, 20:58   #8
Derakon
Prophet
 
Derakon's Avatar
 
Join Date: Dec 2009
Posts: 7,943
Derakon is on a distinguished road
If we do want to be able to represent a partial swap and then later be able to restore the correct stats, then we could store a 2D array representing how much each individual stat has "donated" to the other stats. So e.g. if the first array was {0, 2, 1, 0, 0}, then STR would have given 2 points to INT and 1 to WIS. Reversion of the partial swap would be done by going through the arrays, subtracting the values from the recipient stats, and adding the sum of all values back to the donor stat (being careful to only apply stat caps after all the modifications are reverted).

Application of multiple swaps could either be done by iteratively applying +1/-1 modifiers or by doing a single swap of larger scope like +3/-3, +10/-10, etc. The former would tend to be more balanced but also be more likely to affect any given stat.

Under this regime, outside stat modifications like Potions of Strength would continue to affect the "correct" stat both before and after the swap.
Derakon is offline   Reply With Quote
Old December 9, 2015, 21:51   #9
Ingwe Ingweron
Veteran
 
Join Date: Jan 2009
Location: Manhattan Beach, CA
Posts: 1,432
Ingwe Ingweron is on a distinguished road
Quote:
Originally Posted by Derakon View Post
Guys, guys, I wanted to keep this thread about the specifics of how an implementation ought to work, not what exactly should be done. Ideally any implementation will support a wide range of possible effects so we can experiment and figure out which effect works best.
How is Estie's post not a discussion of an alternative implementation of the nexus stat swap effect? It sounded to me like precisely what this thread called for, it just wasn't your particular alternative implementation idea. I favor Estie's alternative implementation, a swap effect proportionate to damage, but not reversable except with the tried and true method of increasing the stats.

I'm totally fine with this thread being limited to a discussion of how to implement a change to nexus swap effect. I'm just a little concerned on two fronts, 1) alternative implementation suggestions other than your own should not be chilled, and 2) the discussion as to whether any change is a good idea in the first place should not be hidden away in a seemingly unrelated thread about gnome mages where it might get lost in the shuffle, or is this a game of three card monty?
__________________
“We're more of the love, blood, and rhetoric school. Well, we can do you blood and love without the rhetoric, and we can do you blood and rhetoric without the love, and we can do you all three concurrent or consecutive. But we can't give you love and rhetoric without the blood. Blood is compulsory. They're all blood, you see.”
― Tom Stoppard, Rosencrantz and Guildenstern are Dead
Ingwe Ingweron is offline   Reply With Quote
Old December 9, 2015, 22:50   #10
Derakon
Prophet
 
Derakon's Avatar
 
Join Date: Dec 2009
Posts: 7,943
Derakon is on a distinguished road
I don't object to Estie's idea, and in fact I rather like it conceptually. I was merely making an (evidently fruitless) attempt to keep discussion on-track, and also to avoid having a conversation that's relevant to game players (viz. what exactly nexus should do to characters) happen in a subforum that game players might not keep up on (the development forum).

Of course I could have just continued this discussion in the other thread (which is already hopelessly off-topic), but it seemed different enough to warrant a new thread.

I'm not at all trying to be a dictator here -- that's Nick's job. I'm just trying to get some change to happen. Because I know that once change does happen, it becomes a lot easier for people to concretely say what they do and don't like about some feature, instead of talking about vague hypotheticals. Hell, it's entirely possible that I'll hate the first pass at a "fix" even if it hewed closely to what I suggested. It's just super hard to know without actual playtesting.
Derakon is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Judicious use of stat-swap potions Ingwe Ingweron Vanilla 6 August 29, 2014 20:08
nexus stat swap is abuser dos350 Vanilla 0 July 9, 2014 07:20
Sil Builds/Challenges/Concepts/Stupid-Ascension-Tricks HallucinationMushroom Sil 214 February 17, 2014 16:01
Swap stat potions hate me Derakon AAR 2 August 8, 2010 19:11
Nexus: remove stat swap effect Derakon Vanilla 43 May 1, 2010 15:14


All times are GMT +1. The time now is 13:40.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.