octachrome / treason

A clone of the card game Coup written in Node.js
Other
138 stars 79 forks source link

There should be time for challenging an action before blocking it #15

Open einsteinsfool opened 7 years ago

einsteinsfool commented 7 years ago

Let's say that Adam wanted to assassinate Bob. I had 2 assassins not revealed and the last assassin was revealed so I wanted to challenge Adam, but Bob blocked it with contessa and now I can only challenge him. States for challenging and blocking should be separate. And first should come challenging.

Edit: Changed Claire to Bob.

octachrome commented 7 years ago

I disagree that there should be a separate phase in the game, this would slow down play. Once an action is performed, the target can block, and anyone around the table can challenge. It happens naturally when playing in real life, and it should be the same online. If you want to challenge an assassination, click faster!

One idea I have is to add a "wait a minute" button, so if you are thinking of challenging, you can quickly tell the other players to wait while you think it through. It would be optional, so they could just ignore you and play on.

BTW, how can Claire block when Adam is assassinating Bob? As I understood it, only the player being assassinated can block.

einsteinsfool commented 6 years ago

BTW, how can Claire block when Adam is assassinating Bob? As I understood it, only the player being assassinated can block.

Right. Updated my comment by changing Claire to Bob.

I disagree that there should be a separate phase in the game, this would slow down play. Once an action is performed, the target can block, and anyone around the table can challenge. It happens naturally when playing in real life, and it should be the same online. If you want to challenge an assassination, click faster!

Yeah, the problem is when Bob (the blocking player) is AI. So I know someone wanting to assassinate AI is bluffing but AI blocks it with contessa too fast. IRL we have a separate phase for challenging and only after it victim can block. So first each of us in a circle says if he wants to challenge or not. And when all people say "no", the victim can block. It's usually just very fast few "no"s.

One idea I have is to add a "wait a minute" button, so if you are thinking of challenging, you can quickly tell the other players to wait while you think it through. It would be optional, so they could just ignore you and play on.

It still won't work with AIs because they take miliseconds to make a decision.

So I have 2 solutions.

  1. My preference. Add a separate phase for challenging and after all players challenge or not, the victim can block the action. It will slow that gameplay a bit but this is how it's supposed to be according to rules.
  2. Add x second delay for AIs before blocking an action so people have time to challenge it earlier. For people it would stay the same. And in player's interest is for another player to challenge the action before blocking it since then one of his opponents loses a card. So for real players it would come naturally to just wait a few moments before blocking to let others challenge.

Let me know which one you choose so I can work on a fix. I won't mind if you choose $2. For $2, let me know how many seconds do you prefer? 5?

octachrome commented 6 years ago

I have already implemented (2) - see moveDelay and moveDelaySpread. It is currently 1 second in server.js, but could be increased if you think it would improve game play. 5 seconds would be fine, with maybe a spread of 1 second.

einsteinsfool commented 6 years ago

Oh. Cool! I see moveDelay: 1000 in server.js. I guess AIs would be making actions way faster. Should have noticed it takes them a second. But why use moveDelay in server.js since it's also declared in ai-player.js? Shouldn't it be removed from server.js and changed to 5000 in ai-player.js? Seems redundant. Also, what is 'moveDelaySpread` for? If AIs make every decision each second or five, we have no additional info that would give us the advantage.

So my idea is:

Of course, it's only an idea. Perhaps moveDelaySpread is useful and I didn't think of something.

octachrome commented 6 years ago

moveDelaySpread defines the range of times that the AI will wait for, i.e., the AI will wait for a randomly chosen interval between moveDelay - moveDelaySpread and moveDelay + moveDelaySpread. I think it is useful so please don't remove it.

The reason moveDelay is overridden in server.js is because the AI should not delay during unit tests, so it is defaulted to zero. It was just easier to override it in server.js than to change every AI unit test to override it to zero.

I see no reason to introduce a separate moveDelayForChallenge. The existing moveDelay simply causes the AI to pause before taking any action whenever the game state changes, so it applies to challenges too. Is there a particular reason why you think there should be a separate delay specifically for challenges?

To summarize, I would:

einsteinsfool commented 6 years ago

I understand how moveDelaySpread works. But I don't see why it's useful. Do you mind explaining? Why randomness is needed here?

Thanks for the explanation for server.js. Seems legit with these unit tests.

As for moveDelayForChallenge it should actually be called moveDelayForBlock. So AI would only wait 1s when challenging or making an action but would wait more (5s) when blocking to give more time to players to challenge. E.g. I steal from AI1, AI2 waits 1s and then challenges me and fails, then AI1 waits 5s and blocks with captain. It would be a faster games with these 2 separate delay times.

octachrome commented 6 years ago

The spread just makes the AI feel more human-like and keeps you on your toes. If it always takes 5 seconds then it feels more like a robot.

I agree that there should definitely be a longer delay for blocking. But I also think it would be nice for the AI to delay longer before challenging. Humans tend to think more before they challenge, and if the AI always jumps in first then the humans don't get a chance to challenge.