marcoallanda01 / IS23AM15

4 stars 2 forks source link

Synchronize better the game #18

Closed GiuseppeBocci closed 1 year ago

GiuseppeBocci commented 1 year ago

We should not synchronize ChatController and PlayController (as it is now) but Game. This for better performances.

ingconti commented 1 year ago

I am a bit thinking about: syncrhonizing alla the game could lead to a bigger lock porblem

did You find performance penalties?

pls explain

GiuseppeBocci commented 1 year ago

I explained it wrong. We are locking with "synchronized" before the methods of PlayController and ChatController. It's true that both access the Game (shared object between them). For how we projected the Game (that gives access to the entire model) should not be deadlock). The model of the chat controller is accessible only throw Game but it is separated from the "playing model". Chat uses Optional (that we wanna refactor in Optional), but the players remain the same objects and nicknames for all the life of Game. Ps. Also if a player disconnect I can send him messages, he just will not receive them (I'm gonna go deep in this part tomorrow).

ingconti commented 1 year ago

seems a good explanation.. I am curious about perforce.. yet :)

GiuseppeBocci commented 1 year ago

It isn't a big project with a lot of computational power required so I think it's gonna be ok, but we'll see with the testing and I'll comment here

ingconti commented 1 year ago

good. I will be glad to see some dedicated test to stress it! (I honestly think seeing a MP4 consume far more computation :) )

PietroAmmaturo commented 1 year ago

Performance due to synchronization does not seem to be relevant in our implementation, synchronization will be left as it is.

ingconti commented 1 year ago

k