rorywalsh/wizard

Some thoughts..

Opened this issue · 13 comments

Het @Robzon33. Thanks for the PR.
 
I've some ideas about how to make this a little more accessible, I'm just thinking aloud here.. 

  • We take what's reasonable in the current game and start a new framework with it
  • We develop the class for the deck of cards with an override for the draw function so that users can create their own style of cards
  • We make an abstract game class, similar to the current gameState class, but improved. I think it might be better to start from scratch here. The current game state object isn't really a class. It would be better if it was a class so we could call member functions rather than doing the calculations in the on data receive methods.  We should also provide some virtual functions here for users to override. Or I guess in JS we use callbacks? We might also provide some basic logic for rules of games? This one will be the most challenging. But we could take a very simple game and build it around that. Then test the strength of it against other games. For example we can add functions that look for the highest card, the lowest card, a straight, pairs, three of a kind, four of a kind, etc. We should also need some kind of bidding methods?
  • We should also work out the best way to work with the multiplayer aspect. Should we just create a master class object and keep firing that back and forth between players like I do at the moment? We have to be careful here, because when the host works out a result, each player gets the same response. In the current game each player has their own PlayerDetails object. I'm not happy about how this is currently done. I think the general approach is Ok, but I'm not happy with the implementation. We should add some better utility methods to see we are reaching out the correct player. Right now I'm doing a lot of this, where player.id is the id of the current  player's webpage:
for (player of gameState.players) 
{ 
   if (player.id == id) 
      { //code } 
}

It would far better to make a member method of the playerDetails class, or the main game class? What do you think? Anything to add to this or? 

I just pushed a dev branch now. I tried to clean up the classes a little. I've put some comments in. It won't run now as I'm pretty sure I broke it, but I think that's Ok until we finalise the class structure..

[edit] @Robzon33: the dev branch is now cleaned up and should run fine.

Hey @rorywalsh , just pulled the newest version. I'm not able to run it.
grafik
Do you have any ideas why. When i try to connect a client i get connected = false.
grafik

Besides that... I like your ideas about the new structure. Some abstract classes for card decks and the game itself. I'm just thinking about the variations of card games. What do they have in common? But it's cool to try to cover as many games as possible. I'm gonna focus on that tomorrow.
The multiplayer aspects... I think it should be a private connection between host and client. But to be honest, I'm not sure how to set up a nice communication. That's your task first of all.

ah yeah, it looks very different... but working now

Yeah, I've stripped it back a good bit! And I'm having some fun trying to draw the card symbols 🤣

Hahaaa, except from diamonds it seems like a difficult task. Doesn't it exist somewhere??

Sure, in pictures!! The easy way would be to simply use a PNG image 🙄 But I couldn't do that...

The biggest issue here is getting it to scale correctly. Everything has to be relative to the screen size, and this can vary dramatically across devices.

What did we start with man? :)

Ah yeah.... you were asking in a comment:

can't access this.gameType.validateMove() for some reason??!±?!!?

The method is static. This is way you cant access it with the object.

I only marked it static so I could actually access it. Remove the static and it's inaccessible for some reason..

ah ok