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

Error when set custom playerID for multiplayer local #1141

Closed
huynhthuan opened this issue Apr 4, 2023 · 2 comments
Closed

Error when set custom playerID for multiplayer local #1141

huynhthuan opened this issue Apr 4, 2023 · 2 comments

Comments

@huynhthuan
Copy link

I create game multiplayer with local, and set playerID custom.
When i play move game show error like image below. But when i set playerID list to ['0', '1'] , game will run.
How i can fix this

Project reproduce error: https://codesandbox.io/s/bgio-plain-js-multiplayer-forked-2e72go?file=/src/App.js

image

@rjulian
Copy link

rjulian commented Apr 9, 2023

This is due to the default playOrder being set to ['0', '1'] here.

To override that default turn order, you'd need to set this in your Game:

turn: {
    order: {
      first: ({ G, ctx }) => 0,
      next: ({ G, ctx }) => (ctx.playOrderPos + 1) % ctx.numPlayers,
      playOrder: ({ G, ctx }) => ['12','213'],    
    },
    moveLimit: 1,
    
  }

@huynhthuan
Copy link
Author

This is due to the default playOrder being set to ['0', '1'] here.

To override that default turn order, you'd need to set this in your Game:

turn: {
    order: {
      first: ({ G, ctx }) => 0,
      next: ({ G, ctx }) => (ctx.playOrderPos + 1) % ctx.numPlayers,
      playOrder: ({ G, ctx }) => ['12','213'],    
    },
    moveLimit: 1,
    
  }

Ohh ! Thanks you, my error has resolved 👍

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