28

tl;dr: Math is useful, but it can not replace playtesting. Card economy. You don't want the game to take forever, so you need to make sure that over time players will have a net loss of cards. So you need to make sure that the cards picked up by "take X" cards do not outweight the natural rate of losing cards. This is one aspect where trying to find a ...


21

Card shuffling is an algorithm which is easy to write intuitively, and get entirely wrong by doing so. There's a good reference for implementing card shuffling correctly on Wikipedia. What I'm presenting here is a very slightly simplified version of the algorithm covered on that page under The modern algorithm. Here's the basic idea, in plain english: ...


20

I think you can find the majority of poker hands by simply making a couple of tables of how many cards in the hand there are of each rank and suit. In other words, create an array mapping card ranks (numbers and A/J/Q/K) to the count of cards of that rank in your hand. If the player has a pair or three-of-a-kind, there will be an element in this array ...


17

There are several open-source projects of this nature, with different approaches to implementing the rules. Here is a blog entry from the creator of one of the more well-known MtG implementations, CardForge. It may not be a complete list, but it contains several open-source projects where you can simply browse the code, or visit the forums for specific ...


17

It's a little tricky because there's so many combinations. Luckily you have a processor that can check a great number of combinations in a very short time. You'll need a few different strategies, for detecting different types of hands. Luckily, a few of the different types can overlap strategies. I would search through, in order by rank of the hand. ...


17

Some suggestions to bring more cards into the game: When a player wins a match, reward them with two cards: One from the losers deck and one newly created one. You might also consider giving a generated card to the loser to compensate for the loss, otherwise they would progress backwards, which is a real motivation breaker. Reward players for playing by ...


16

In the case of UNO, I find it highly unlikely that there was any deep consideration of the underlying mathematics. Consider this image of the UNO deck of cards (taken from the Wikipedia page on UNO): It contains 108 cards. That's an interesting number. Why? Because it's twice the number of cards in a standard deck of playing cards - 54 (13 of each suit, ...


15

Phaser has support for two types of sprite sheet: "classic" ones, where every frame is the exact same size, and "texture atlases" which are created with the help of a third party app like Texture Packer, Shoebox or Flash CC and come with an associated json file. You load the "classic" ones with game.load.spritesheet where you must specify the width and ...


12

If you want the feature, implement it. If you don't want the feature don't implement it. If you're unsure if the player wants it, implement it and notify the user if the other player disconnects and give them an option to continue with the AI player.


11

I agree with Jari Komppa that defining card effects with a powerful scripting language is the way to go. But I believe that the key to maximum flexibility is scriptable event-handling. In order to allow cards to interact with later game events, you could add a scripting API to add "script hooks" to certain events, like the beginnings and endings of game ...


11

It sounds like you are describing an extension of the rock-paper-scissors mechanic whereby every piece/card/token can defeat at least one other piece/card/token. (Your question made me think of Stratego, and specifically of the few pieces like the low-ranked Spy who can defeat the otherwise-top-ranked Marshal and the Miner who can defuse bombs.)


10

Don't optimize prematurely. Keep it simple. Using TCP in this case is OK, and I don't see any problems with your current scheme. UDP is usually used for performance critical scenarios such as in an online action game, because it allows explicit control over individual packets as opposed to working on top of a layer abstraction of streams like TCP. However, ...


9

I gave this problem - flexible computerized card game engine - some thought some time ago. First off, a complex card game like Chez Geek or Fluxx (and, I believe, Dominion) would require cards to be scriptable. Basically each card would come with its own bunch of scripts that may change the state of the game in various ways. This would let you give the ...


9

You first define a sequence of all the cards you want to shuffle: List<Card> shuffled = new ArrayList<Card>(); shuffled.addAll(allCards); Then you walk through every position in the sequence and assign it a card randomly. Random random = new Random(); for (int i = shuffled.size() - 1; i >= 0; i--) { int j = random.nextInt(i + 1); /*...


8

For C# I have used and really helpful the following card game framework http://deckofcards.codeplex.com/ Microsoft has built a nice library/framework for Card Game http://www.microsoft.com/en-us/download/details.aspx?id=20303 For Java Both of them I used and will be helpful for you http://www.ethanwilder.com/node/23 http://kenai.com/projects/jnag/...


8

Depending on the complexity of your game, verifying if an action is legal or not might require to backtrack large parts of the game. An example: Player A says Player B can't play that card right now because he has no ResourceX. PlayerB says he has plenty ResourceX. Who is right? To find out you would simulate the whole game again from start to finish to ...


7

For best quality results, you should probably first render the SVG at high resolution and then scale it down, using a good scaling algorithm. For example, here's the result I got by taking your 256 × 357 px image and scaling it down to 71 × 99 pixels in GIMP using Lanczos3 resampling: It looks noticably sharper than the version you got using ...


7

There are tons of books that you can find on Amazon to get you started. Just search 'XNA' on Amazon, and grab the first book that interests you. One title I highly recommend is XNA 4.0 Game Development by Example: Beginner's Guide by Kurt Jaegers. He'll walk you through several games step by step, the best way to learn, and most fun, in my opinion. You'll ...


7

Hello visitors of Jindsay's Card Game Forum. Here is your friend xXx_GameH4x0rPhilipp_xXx with another cheat for you. Do you want to win every game? Here is a simple hack which works with every web browser: Press F12 Click on "Debugger" Select check_win.js There is now a window with lots of programming code. Don't worry, you don't need to understand any of ...


6

I once programmed AI for Tarneeb, a card game very similar to Spades. The person I was working with wanted to do a pattern recognition thing involving lots of stored games and stats on the outcome based on what moves were done in different situations. In essence, the AI would become better over time the more games it played. However, from playing many hands ...


6

I bumped into this algorithm once. It multiplies prime numbers to determine hands and is a very interesting reading. Cactus Kev's Poker Hand Evaluator


6

var sprite = game.add.sprite(x, y, 'spritesheet_name'); sprite.frame = 0; Spritesheets aren't limited to animations, that's just one way to use them. An animation is just a way to display different frames at different times. By manually setting the frame of a sprite, you can display a specific part of the spritesheet.


5

This is my experience from implementing a MTG AI. If the AI is not considered from the start, adding it later can be challenging. Your engine needs a way to copy the game state. It also needs a way to to quickly undo a move, so search tree can be generated efficiently. Every AI thread should operate on its own copy of the game. When computer makes a move ...


5

Doing basically anything on client-side apat from the inputs is a bad idea. And believe me, if the programmers could collect inputs on the server side, so the client couldn't fake them, then they would happily do so. Literally anyone can change the code to always register a winning condition. If they make it send it back to the server, than it's even worse. ...


4

1) A Value Heuristic. You need a heuristic that the AI can evaluate how "good" a particular game state is. For example, in MTG, a very simple heuristic could assign 2 points for every card you have in play and 1 point for each point of life the enemy has, so one of the AI's goals would be, all other things being equal, to play as many cards as possible, but ...


4

Ok, if you don't care about the graphics, that's simpler. From a high-level pseudocode, what I suggest is like how any other game loop works: while game has not ended yet: keep going // we're out of the while loop; game has ended show results, etc. go back to main menu Thing is, yours is turn-based, so we can do away with the loop part, or keep it and ...


4

When you play a game online, you usually play it online because you want to play against a human opponent. So it doesn't make much sense to play when your opponent is computer-controlled. But when you have a multiplayer game which has more than two players and which becomes unplayable when one player drops out of the game (like Hearts), it would certainly ...


4

You can do this by making the secret starting state verifiable and guesses difficult: Have all players generate a new private/public key pair, send the public keys Let them shuffle their own decks Choose and/or exchange salts (see below) Generate signatures for the information you want to check: Either a player's full deck if that can become known after ...


4

"I want to prevent cheating as much as possible." - So say we all. :) Perhaps a more sensible approach is to not waste time doing anything above and beyond the reasonable and generally effective anti-cheating measures. Those are: double-testing for bugs that would allow players to perform any illegal actions, and sending only encrypted data (via https or ...


4

I would say you should absolutely generate your descriptions procedurally. This will allow you to tweak your abilities and definitions to your hearts content at a later time without having to manually adjust many many descriptions. Based on what you have shown, I would have somewhere where the Trait was defined not within a specific card, with a ...


Only top voted, non community-wiki answers of a minimum length are eligible