0
\$\begingroup\$

I'm making a card game (inspired by Dominion, Hearthstone, Gwent, and others). The way it's set up now, it has a player manager that handles a player's resources and hand of cards, while I have a game manager that handles anything else. At the moment it is set up so that behind the scenes there really is just one player, while the opponent is actually the game manager moving cards around with no regards for the rules of the game, using information sent over the network to mirror what the real opponent is doing at their computer. (I don't care about cheating. I'm not planning to go big; I just want to be able to play and test the card game itself with friends across the country.)

However, I would also like for there to be a hotseat variation on this game. In other words one that is played by two people on one computer. I don't know if it would work out in practice. Things like the length of turns and how much a player can do during the opponent's turn isn't quite fixed yet (note: allowing the players to keep their hands secret from one another is not a concern at the moment).

How would I implement it easiest? Just have one player manager that "switches sides" and swaps out all its fields once a turn is over? That seems ungainly and prone to errors. A second player manager? That would need quite a bit of rewriting of the game manager, and remember that it should still mainly be used online.

\$\endgroup\$
  • 2
    \$\begingroup\$ You seem to have covered the bases here. Either you have a single player entity that saves off all its data and loads up a new identity every time it's time to switch, which is messy and error-prone but works with your existing code, or multiple player entities which is more robust and scalable but requires lots of refactoring. Which trade-off is more palatable for your development style & needs is a question that you're in a much better position to answer than we are. ;) As for presenting the switch, that's a separate question you should ask on its own. \$\endgroup\$ – DMGregory Oct 22 '17 at 13:39
  • \$\begingroup\$ @DMGregory I'm both happy and sad that I haven't missed some clever, ingenious solution. Oh well... I'll look more into the presentation (and possibly ask a new question) once I've decided that is actually something I want to go through with. \$\endgroup\$ – Arthur Oct 22 '17 at 14:58
  • \$\begingroup\$ Sadly there's no magic in game development, just horrifying kludges and cheats. ;) Since there are no answers yet, you could edit out that part of the question and focus just on how to communicate the switch. Looking at examples of other hotseat games will help a lot there. \$\endgroup\$ – DMGregory Oct 22 '17 at 15:01
  • \$\begingroup\$ Well, it's a decades old field where some pretty clever people have worked. That means that there should at least be some problems that have clever solutions that I, as a hobby developer working on my first real game, can't expect to find. Apparently this was not one of them. \$\endgroup\$ – Arthur Oct 22 '17 at 15:17

Your Answer

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

Browse other questions tagged or ask your own question.