0
\$\begingroup\$

Would it be better to actually draw the board in a script and attach colliders to each piece or get a picture and add the colliders before the game starts? Is the difference in processing power needed significant?

\$\endgroup\$
  • 1
    \$\begingroup\$ I wouldn't be worried about the processing power for a chess board :) \$\endgroup\$ – Alexandre Vaillancourt Sep 15 '15 at 0:25
  • \$\begingroup\$ @AlexandreVaillancourt Which way would be the easiest for figuring out where a specific piece is? \$\endgroup\$ – Jacob Swanson Sep 15 '15 at 0:44
2
\$\begingroup\$

I quote your comment:

@AlexandreVaillancourt Which way would be the easiest for figuring out where a specific piece is?

DO NOT use the scene for working out where stuff is. That is absurd and backwards.

Have some internal logic (like a ChessBoardRepresentation class) that stores an 8x8 grid and tells you what pieces are there. like .getPieceAt(x,y) say. You can have other methods like .getPossibleMovesFor(x,y) that returns a PossibleMoves that has things like isPinned() and so forth. This is your 'internal logic'

To make a move you tell the internal logic to make a move. Which could throw if the move is illegal (say) and if that move is valid, updates the internal representation AND tells the bit doing graphics the new positions of some objects.

Remember what you draw on screen REPRESENTS the state, you should never work out the state by looking at the scene graph or other structures managing the drawing process

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.