chaitu236 / TakWeb

Javascript based Tak client
https://www.playtak.com
GNU General Public License v2.0
40 stars 18 forks source link

Step through notation not efficient #25

Open chaitu236 opened 8 years ago

chaitu236 commented 8 years ago

Step through clears all scene objects and creates them again. This is not efficient and results in a little delay.

TreffnonX commented 8 years ago

I have a solution, though it applies to my current modified fork. If you want it, I can write it here in plain lines, so you can copy the functions into your version. It requires a bit of fiddling here and there though.

My general solution was not to completely remove all board and piece objects from the scene, but to put them back into the stock (board.piece_objects) and clear them from their board positions, as well as mark them as 'onsquare = false'.

I did this by creating a new function in board that arranges the pieces. It does, what board.addpieces did during process. That is now modularized, so it can be modified more easiely. And also be called from within 'board.resetpieces'.

I can integrate it into your master, if you let me know when i can work on it without collision.