🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Using bitboards for an abstract strategy game in javascript for a multiplayer web game

Started by
1 comment, last by alvaro 4 years, 3 months ago

I asked this 2 days ago but I realized I put it in the “artificial intelligence” subforum which is not where it belongs, so I'm re-asking it here.

I am trying to build a multiplayer web game, played in the browser, that is an abstract strategy game. Basically think like chess.com but for a different abstract strategy game that isn't chess. Players have accounts, they can play games with other players in real time, etc. The website is far simpler than chess.com (player's game history isn't recorded, much simpler UI, etc.) but I'm okay with that. I've built everything else about the website, the only thing left is the game itself.

Due to the nature of the game I'm trying to use bit-boards, which will make transferring the data across the network and running computations very fast. I can't figure out how to use bitboards in javascript. the game is played on a 10x10 board, so I'd need a 100 digits to work with. If I use an array, I haven't been able to figure out or find how to do bitwise operations on arrays, so I'd have to use loops rather than bitwise operations which is less effective and defeats the point. I've been trying to use the chess programming wiki but it's written in a way that's confusing to me because I'm not too bright.

So basically I have a few questions:

  1. How do I do bitwise operations on arrays in javascript? Or, is there a better way to perform bitwise operations on a string of length 100, or something like that?
  2. when using bitboards, how do you deal with pieces “hitting” another piece and thus not being able to move forward anymore? Like in the case of chess, normally a rook can just move all the way across a whole row/column, but if a piece is in the way, then it can't. How would this be dealt with?
  3. is there any better place to learn about bitboards for games than the chess wiki?

Thank you!

Advertisement

You don't need bitboards. Bitboards are great if you have a low-level programming language and are trying to perform very fast searches. Really, you can stop reading now.

2. There are several solutions to this, but a popular one is magic bitboards.

3. I don't know of a better one.

This topic is closed to new replies.

Advertisement