Writing Logic behind card games

  • Writing Logic behind card games dassouki

    I'm not a dev noob, but definitely never done anything in game dev. There is a trump based card game we play in town that I plan on coding. I'll be either using python/ajax/pyqt or c++/qt.

    My question is as follow, what kind of advice would you give to writing card based games?

  • AJAX/PyQT? Not sure how that would work out. Card games aren't especially complicated unless you are trying to make some kind of generic card game engine (don't do that). Just don't focus too much on the tech, pick something you are comfortable with and make it fun first. Once it is fun, worry about making it snazzy.

  • I'm not really sure what card game you're trying to create, but here are the general steps I would go through:

    1. Write the rules down on paper - Write the rules down in bullet format. This will get your brain thinking about the logic, and will provide you with a handy reference to use later on.
    2. Rewrite the rules to follow the programmatic flow - Keep the rules in bullet format, but reorder and indent them, so they form an outline of the programmatic flow.
    3. Write the pseudo-code - Using your outline as reference, write out the pseudo code.
    4. Create the classes - Make a list of classes you'll need, based on your pseudo code, and implement them.
    5. Replace your pseudo-code with code

    The process is a little slow, but it has a number of benefits to someone in your situation:

    • Each step creates documentation that can be referenced in future steps
    • You have multiple opportunities to catch mistakes in your logic before you ever touch code
    • It's very easy to see how logic should breakdown into code

    Best of luck on your programming adventure! If you have any questions or something seems unclear, let me know. :)

  • The good news about card games is, they are some of the simplest to program, so this is a great first project for getting into game dev. Why? Because you don't have to deal with a great deal of graphics (simple sprites for the cards, no scrolling, no 3d, not even necessarily any animation) nor do you require realtime input (when you say "trump based" I assume this is a turn-based game where you select cards one at a time to take tricks), so the event-driven programming that you're used to in more general software development can apply here just fine.

    If you're an experienced programmer, there are likely only two things you'll need to learn here. One is how to draw sprites to the screen, which is not terribly hard -- there are tons of libraries that will let you do this, PyGame has the functionality built in if you go with Python. The other is, assuming this is a multiplayer game to be played over the internet, you'll need to figure out how to establish a connection and send messages over a network. But that's really it... aside from that, treat it like any other software project.

c++ python logic
Related questions and answers
  • I'm creating an FPS game. I'm writing my own game engine. So far all the backend stuff is going great. I'd like to support md2 as the native file format for 3D Objects, but I also want to use skeletal meshes. Does anyone know if the md2 file format supports skeletal meshes? In-case you need to know, I'm going to use blender as my Mesh creation tool and C++ as my programming language... Thanks For got to mention, the engine is based on OpenGL... Alright, for anyone who is reading this, I just found the Doom 3 md5 specifications (http://tfc.duke.free.fr/coding/md5-specs-en.html). It gives

  • to be moved then so be it), but i felt it would fit here just a bit, since its a game-dev type question. Anyways, My compiler is MinGW that uses the IDE Code::Blocks. also the operating system that im...I am using Ogre3D, and have been using it for a while. Also lately, I have been using the Opengl Rendering system that is included in Ogre, only because Directx will not compile correctly(Will post errors on request through comment). But as of now the main problem is when i render my model(it is a plane with simple, unblended pixelated texture), it looks like this on my Laptop(Left Image

  • Say I like to experiment with multiplayer games and I do not want to reinvent the wheel and build yet another game server. I don’t mind configuring and writing wrappers and adapters (both in c++ and java) for the server. What server does Farmville use? Is it Java or C based? What isometric flash engine do they use? What other examples can I look into to learn the subject? Thanks.

  • Possible Duplicate: Are there existing FOSS component-based frameworks? What open source game engines with component-based design of game objects do you know? And which best of them? I mean best not in Graphics or Physics, but best in context of Behaviour, Messaging, etc. This question is the result of inspiration by another question Thank you!!!

  • Hi I'm new to 3D games developing, I can a little c++, C#, VB.Net, 3D Max, ArchiCad ..etc. my problem is where to get started, which tools I need to start a own 3D game like GTA, I have tried some tools like : 'Unity3D' (crashes on start), '3D Rad' (uses only built-in items), 'Game Maker A7' (only 2D games can be made there).. could you help me to find the tools of making a 3D game..plz I'm using Windows XP SP 2, I don't have pixel shader 1.1 into my video card

  • My friends and I in school play this interesting card game, which we call 'the game without rules' (ironically, of course). The game is like this: in the beginning of a school year, we start with one rule: you have to lay a card that is higher. Everything else is not allowed and the one who is the first to have no more cards, wins. When only one person remains with cards, the game ends. At that point, the winner can define a new rule, such as "on a seven, you have to play a lower card instead of a higher card". This makes the game harder and harder as we play on. Every time a person breaks

  • Qt is an excellent application toolkit and overall the best for C++. While some large projects use Qt (KDE for example), I haven't seen many games using it. So I decided to make my own. But what does Qt provide that may be useful when writing a game (in my case a 2D game)?

  • I'm working on a Component/Entity-System based game engine atm. And I have this little dilemma. I have simple geometrical structures which might be downloaded or created in game at some point. These structures are used to create models that are used in OpenGL and OpenGL ES and then for some collision processing. During dev and Beta I am quite ok with maintaining data copies for the physics and the display. But I started thinking about the future of this engine as I already invested some spare time over a year and a half in it. Now I would like to duplicate a few routines into OpenCL kernels

  • I'm working on learning network programming. I'm working on a simple card game. The basic idea is: Players enter the lobby Players see tables Players sit at an empty seat Once they sit, they do not need any information from the lobby, they see the card table and the data about the other players and so forth. I've programmed the server portion for the game itself. The clients connect to my... going to use the enet library. I was thinking that each time a game session starts, I push a new Game and I map the client IPs to that table, then I just route messages from those clients

Data information