Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When fighting a frightened rat, some weird symbols appear #19

Open
swooboo opened this issue Jan 18, 2017 · 20 comments
Open

When fighting a frightened rat, some weird symbols appear #19

swooboo opened this issue Jan 18, 2017 · 20 comments

Comments

@swooboo
Copy link
Contributor

swooboo commented Jan 18, 2017

If a rat is frightened because I'm wearing a Giant Rat Skull, and I do chase it and fight it, the symbols #$%^ appear in red above the damage number each hit. Can't screenshot it because damage points don't stay there. Version - v remix.26.fix.4

@Mikhael-Danilov
Copy link
Contributor

It is rat reaction to moving from Fear (due to Fetid Rat Skull) to Anger(due your attack) and back again...

@swooboo
Copy link
Contributor Author

swooboo commented Jan 23, 2017

So this is not a bug? Certainly looks like it.

@Mikhael-Danilov
Copy link
Contributor

One possible solution is to add "permanent" flag for Terror caused by Ratter aura.

@swooboo
Copy link
Contributor Author

swooboo commented Jan 26, 2017

Do you want me to try and do it and pull request? I can definitely try, but I'd be happy if you give me some pointers - line numbers etc.

P.S. Можно по-русски.

@Mikhael-Danilov
Copy link
Contributor

O its will be great!

Bellow is good places to start:
com\watabou\pixeldungeon\actors\mobs\Rat.java Rat.canAttack
com\watabou\pixeldungeon\actors\buffs\Terror.java

P.S. Можно и по-русски

@ghost
Copy link

ghost commented Aug 11, 2017

It's not a bug - it's the rat saying a curse word.
It's censored to keep the game child-appropriate.

@swooboo
Copy link
Contributor Author

swooboo commented Sep 6, 2017

Thanks for the explanation @DatBoi287, I would suggest to change it to something like F$%K, so it can be understood by others. It seems like you're the only one to get this. Also, maybe it's not right for a rat to curse, since it's incapable of speech. Thoughts?

@Mikhael-Danilov
Copy link
Contributor

Mikhael-Danilov commented Sep 6, 2017

This is Giant Marsupial Rat from highly magical world.

@swooboo
Copy link
Contributor Author

swooboo commented Dec 22, 2017

I like the joke :)

I want to revisit this issue. As I see it there are two things:

  1. The #$%^ is not clear - it might be just me, but I couldn't understand this means curses, or that it means the creature is angered. (This is minor)
  2. The fact that the creature is angered on each hit when there is a terror aura.

My thoughts:

  1. Change the anger string to something else, like F$%K or 😡 (Unicode smiley, although in the current font it doesn't look too angry), or maybe add a log message "The rat gets angry!".
  2. Contrary to @Mikhael-Danilov's suggestion to make Terror from Ratter permanent, I believe that the rat should stay angry for some time (or even forever once attacked). Real-life creatures, even when scared, when provoked, will attack back. So making terror permanent will result in a creature that gets punished and doesn't do anything about it.
    1. These are details though, either way should be good.
    2. I also understand that this is a Giant Marsupial Rat from highly magical world and might not adhere to the real-world examples.

Let's discuss this further so we can find a solution.

EDIT: Nethack has an interesting approach to this - https://nethackwiki.com/wiki/Scare#Effect
They have 2 different but connected statuses - scared and fleeing. Worth a read.

@Mikhael-Danilov
Copy link
Contributor

  1. I strongly against "Fuck" or similar words in Remixed. Because we must keep the game child-appropriate. And being translated to other languages this word can be... translated too creatively...

1.a Using unicode can be an option ( but this requires fixes for pixel font )
1.b Adding log message looks like good addition ( log will be too spammy with it? or not? )

  1. PD creatures behavior much simpler what nethack monsters (let leave real-world creatures alone for now)
    They have following ai states:
    SLEEPING,HUNTING,WANDERING,FLEEING,PASSIVE. (Some mobs have more complex behavior but it implemented by overriding methods such as getCloser & canAttack - which is bad in comparasion to new ai state imho )

Terror buff works simple as follows:
if (buff instanceof Terror) {setState(FLEEING);}

For partial solution we can do not aplly Terror buff for already fleeing Rat ( check Rat.canAttack() )

Or for more complete and complex sollution we can introduce new ai states.

@swooboo
Copy link
Contributor Author

swooboo commented Jan 15, 2018

  1. Agreed against curse words.
    a. How hard are the fixes? Maybe until we agree on the logic this should be postponed.
    b. I agree that the log might be too spammy, so first the correct logic has to be in place. If it is good, it shouldn't spam the states and we can add the log messages safely.
  2. Can you explain what will happen if we go forward with the partial solution of ignoring terror if fleeing?
  3. Introducing new AI states seems both complicated and risky, at least to me. What do you think?

Anyway when I have time I'll start experimenting with this.

@Mikhael-Danilov
Copy link
Contributor

a. We need add corresponding smile to pixel font, should be not too hard.
b. Agreed.
2. Terror will be applied much less often, curses too.
3. In my opinion new AI states can make code clearer, and mobs smarter, so for me this is preferred way.

@swooboo
Copy link
Contributor Author

swooboo commented Jan 17, 2018

Agreed to go forward with a new AI state. I guess a good one is SCARED. In that state the mob will attack only if it can't run away from the hero. What do you think?

Maybe a good start will be to draw the finite state machine diagram of the current implementation (or other representation like a text description of it), and the proposed one so it's easier to follow.

@Mikhael-Danilov
Copy link
Contributor

Roughly it looks-like this:

ANY -terror> FLEEING
ANY -attacked> HUNTING
ANY -lullaby> SLEEPING
HUNTING -target lost> WANDERING
SLEEPING,WANDERING-target spotted>HUNTING

@swooboo
Copy link
Contributor Author

swooboo commented Jan 18, 2018

So this is the current one:

image

Generated with GraphViz using this code:

digraph finite_state_machine {
	rankdir=LR;
	size="10,10"
	node [shape = circle];
	PASSIVE, HUNTING, WANDERING, FLEEING -> SLEEPING [ label = "lullaby()" ];
	PASSIVE, SLEEPING, WANDERING, FLEEING -> HUNTING [ label = "is_attacked()" ];
	PASSIVE, HUNTING, WANDERING, SLEEPING -> FLEEING [ label = "terror()" ];
	HUNTING -> WANDERING [ label = "target_lost()" ];
	SLEEPING, WANDERING -> HUNTING [ label = "target_spotted()" ];
}

What do you think the SCARED should look like here?

@Mikhael-Danilov
Copy link
Contributor

Thanks for great state graph!

I believe we should look at Thief class:
https://github.com/NYRDS/pixel-dungeon-remix/blob/6611f3c22a5902265fb72c60673ca3c4bf287d3d/PixelDungeon/src/main/java/com/watabou/pixeldungeon/actors/mobs/Thief.java

It is privately extends FLEEING state to something very similar to proposed SCARED state. Maybe it worth to reuse it?

@swooboo
Copy link
Contributor Author

swooboo commented Jan 26, 2018

I'm frankly having hard time keeping all the info in my head for this discussion, sorry if you'll have to explain some things several times for me.

The code you're talking about:

	private class Fleeing extends Mob.Fleeing {
		@Override
		protected void nowhereToRun() {
			if (buff( Terror.class ) == null) {
				getSprite().showStatus( CharSprite.NEGATIVE, TXT_RAGE );
				setState(HUNTING);
			} else {
				super.nowhereToRun();
			}
		}
	}

Does this mean "If I have nowhere to run and am not terrified, start HUNTING" behavior? Or is there something else?

@Mikhael-Danilov
Copy link
Contributor

It is. it is not SCARED as is due to 'terrified' part, but close enough.

@swooboo
Copy link
Contributor Author

swooboo commented Feb 4, 2018

Great. I think it might be good to have something similar as well. First thing that I thought:

  1. Scared state will inherit from Mob.Fleeing - If I am scared, I am fleeing, but if I am not scared I can still be fleeing for other reasons.
    1. This will introduce structure to the AI States
    2. On the other hand, this will introduce complexity and might interfere with some other code - if there are instanceof Fleeing lines, they will catch Scared as well and it might introduce bugs.
  2. Once I am Scared but have nowhere to run, I will start Hunting.

I'm still not sure how this will integrate with Ratter Skull and whether it will solve the flipflops of the states we have now (Fear <--> Anger). I mean that it might introduce another flipflop - SCARED <--> HUNTING.

@Mikhael-Danilov
Copy link
Contributor

Sorry for delayed reply.

Scared may or may not inherit from Fleeing (in my opinion ai states should be not related by inheritance)

Not sure if it is possible to completely avoid flipflops scenarios but it worth to try to mininize chances.

For example it may be: Scared -> nowhere to run -> Berserk(immune to terror) or(50% chance) Death from fear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants