Boardgame.io: UI framework

Created on 5 Oct 2018  ยท  15Comments  ยท  Source: boardgameio/boardgame.io

Just recording the current state and future work planned.

We're going to ship both 2D and 3D (using threejs) components! The two sets of components will be created using the same API so you can seamlessly switch between the two.

I've started a new branch 3d to track development of this. I've split the UI framework into 2d and 3d directories:

src/ui/
โ”œโ”€โ”€ 2d
โ”‚ย ย  โ”œโ”€โ”€ card.css
โ”‚ย ย  โ”œโ”€โ”€ card.js
โ”‚ย ย  โ”œโ”€โ”€ card.test.js
โ”‚ย ย  โ”œโ”€โ”€ deck.css
โ”‚ย ย  โ”œโ”€โ”€ deck.js
โ”‚ย ย  โ”œโ”€โ”€ deck.test.js
โ”‚ย ย  โ”œโ”€โ”€ grid.js
โ”‚ย ย  โ”œโ”€โ”€ grid.test.js
โ”‚ย ย  โ”œโ”€โ”€ hex.js
โ”‚ย ย  โ”œโ”€โ”€ hex.test.js
โ”‚ย ย  โ”œโ”€โ”€ logo.js
โ”‚ย ย  โ”œโ”€โ”€ logo.test.js
โ”‚ย ย  โ”œโ”€โ”€ token.js
โ”‚ย ย  โ”œโ”€โ”€ token.test.js
โ”‚ย ย  โ”œโ”€โ”€ ui.js
โ”‚ย ย  โ”œโ”€โ”€ ui.ssr.test.js
โ”‚ย ย  โ””โ”€โ”€ ui.test.js
โ”œโ”€โ”€ 3d
โ”‚ย ย  โ”œโ”€โ”€ card.css
โ”‚ย ย  โ”œโ”€โ”€ card.js
โ”‚ย ย  โ”œโ”€โ”€ deck.css
โ”‚ย ย  โ”œโ”€โ”€ deck.js
โ”‚ย ย  โ”œโ”€โ”€ grid.js
โ”‚ย ย  โ”œโ”€โ”€ hex.js
โ”‚ย ย  โ”œโ”€โ”€ token.js
โ”‚ย ย  โ””โ”€โ”€ ui.js
โ”œโ”€โ”€ card.js
โ”œโ”€โ”€ deck.js
โ”œโ”€โ”€ grid.js
โ”œโ”€โ”€ hex.js
โ”œโ”€โ”€ hex-utils.js
โ”œโ”€โ”€ hex-utils.test.js
โ”œโ”€โ”€ token.js
โ”œโ”€โ”€ ui-context.js
โ””โ”€โ”€ ui.js

Each component has a file in the root directory (which is exposed as the public API) and one in each of the 2d and 3d directories. The root component just delegates to the appropriate rendering component based on a prop that you pass to the <UI> element.

For example:

<UI>
  <Deck><Card/></Deck>
</UI>

renders DOM elements as cards and decks, whereas:

<UI three={true}>
  <Deck><Card/></Deck>
</UI>

renders to a threejs canvas.

Things missing in the 3D component set:

  • [ ] hex grids
  • [ ] grids
  • [ ] tokens

Things missing in the 2D component set:

  • [ ] ability to drag / drop tokens (currently only implemented for cards / decks)
feature

Most helpful comment

FYI: Might be worth checking out https://github.com/drcmda/react-three-fiber for the 3D stuff.

All 15 comments

@Korla Are you still interested in working on the 3D hex grid?

@nicolodavis Yes I am, I have been occupied for a while with making "The Hive" using boardgame.io, but it's gotten to the point where a 3D-renderer is actually a good next step, so I could take a stab at implementing the hex renderer.

Will you be merging your 3D-branch with master some time soon, or should I start working on it off your branch?

Let's keep it as a separate branch for now and work on that. I'll merge it in once the 3D components have feature parity with the 2D components.

Alright, I'll start working on it on that branch on my fork, and will make PR(s) to your branch as necessary.

FYI, I am working now on the "ability to drag / drop tokens (currently only implemented for cards / decks)" for the 2D component

Is anyone doing the grid, hex map or tokens right now? I am interested in doing them.

Are you talking about the 3D components? I think @Korla signed up for them but probably got busy.

Are you talking about the 3D components? I think @Korla signed up for them but probably got busy.

Yes, I am trying to make change on the 3D-branch right now. Btw, any ideas on how to guide the camera in 3D?

I'm going to merge the 3D branch into master after https://github.com/nicolodavis/boardgame.io/pull/316 so just be aware of that. It probably won't change any of the directory structure, but just the destination of your pull request once you're done with your change.

About camera views, we should probably have a pan mode. The threejs repo has some examples of this I think, but I haven't had time to explore them yet.

I'm almost ready to merge the 3d branch into master. The one remaining item is that token.js does not have 100% test coverage.

@flamecoals I think this was from your PR #316?

screenshot from 2019-01-21 23-17-22

Yes, I think it is my fault, I will raise a PR to fix it.

On Mon, Jan 21, 2019, 10:20 AM Nicolo John Davis notifications@github.com
wrote:

I'm almost ready to merge the 3d branch into master. The one remaining
item is that token.js does not have 100% test coverage.

@flamecoals https://github.com/flamecoals I think this was from your PR

316 https://github.com/nicolodavis/boardgame.io/pull/316?

[image: screenshot from 2019-01-21 23-17-22]
https://user-images.githubusercontent.com/236078/51483073-222a1900-1dd3-11e9-9030-95661aa25eb6.png

โ€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/nicolodavis/boardgame.io/issues/282#issuecomment-456109043,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AA_Jh2PmPZ7DfzKMZgqzIFXO4-VoxJ12ks5vFdrJgaJpZM4XKUyW
.

Merged into master.

FYI: Might be worth checking out https://github.com/drcmda/react-three-fiber for the 3D stuff.

This is interesting, I'll have a look

This effort has stalled a bit.

I'm going to propose a slightly different direction (I'll link to a new issue and close this one):

  1. Let's just ship a single 2D implementation (no threejs for now).
  2. Let's make it a framework (with a proper API) rather than a set of components.

New design to follow in a separate issue (#455).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jchadwick picture jchadwick  ยท  4Comments

Pong420 picture Pong420  ยท  9Comments

julienroulle picture julienroulle  ยท  9Comments

eseom picture eseom  ยท  4Comments

nicolodavis picture nicolodavis  ยท  6Comments