Collectible Card Game: Magic the Gathering

Hi, I’m new to Panda3D and I have a project in mind and I intend to do it myself. I’m an experienced brazilian python programmer but I never created a game.

For my first game I will create a complete Magic the Gathering game, including a deck manager, one player solitaire, one player against the AI (which I’m going to implement myself in python) and multiplayer Peer to Peer (no server). I intend to implement a complete game rules enforcement also.

The concept is really simple and for a game, I think it would be one of the simplest types of games to create. It is a simple turn based card game, where you duel with another player. It does not involve physics, collision detection, etc but I intend to implement some special effects like burning cards, glow, cards moving from one place to another, etc.

See below a screenshot of what I intend to have. It is very simple and easy to develop for a game and yet, awesome for people who like Magic the Gathering (The screenshot below is for a XBox game, which does not feature all the game sets):

Well, why am I posting on the forum? It is simple: I’ve been reading the Panda 3D documentation for a week and since I already have strong python development skills, all the dynamics of the game, how am I going to develop the rules enforcement and everything is very clear in my head.

The problem is that I do not know how to create an end-to-end program and what libraries I should use with panda and how these libraries are put together to create a COMPLETE game. How can I create an initial screen with menus? How can I create an options menu? How can I make the user select between the various types of games (1 Player, Multi Player) and then load the chosen game?..

Basically What I need to know is the ARCHITECTURE of a complete game. I read and reproduced ALL of the Panda3D tutorials (asteroids, etc), but they only show specific features of Panda3D… none of them show how to really create a complete game.

I really don’t know if I’m making myself clear… It is not a programming question. It is an architecture question.

Any help is appreciated!


That is not their purpose. Those samples are only meant to familiarize you with the engine, not to show you how you should structure YOUR game. Especially since games can very much differ from one another (just like any software).

Also, what you’re asking about actually is a programming question. Before you code, you always think about how and what you’re going to code. You probably know, that tools like UML are very useful here.

Regarding your specific questions:

You create the GUI elements either with the use of Panda’s DirectGUI or another, outside library such as CEGUI (there has been some effort going on here to somewhat integrate it with Panda, so you might want to look at that if you come to like that lib). I personally find DirectGUI very nice to use (implemented rather complex stuff with it) since it uses the exact same style as the rest of Panda, which saves time and makes code more coherent, but the choice is obviously yours and depends on your needs.

As far as options menu – same as above. For main menu you can go with some 3D stuff (like DIRT2 menu for example) or standard 2D approach as well. There really isn’t “the correct” answer here, it’s all about your design. Panda can handle most of what you can come up with.

About selecting a game type, I think you might want to make game types into classes, maybe inheriting from a more general class (if it fits the design), but it’s for you to design and nobody can figure that out for you.

You shouldn’t expect anyone to tell you how you can/should code your game. What you’re asking about IS a programming question, because it’s about how you structure your application. Programming doesn’t start with writing, it starts with designing the application and the application’s code. And that’s something nobody can do for you. That’s also as relevant process for games as for any other (large) applications, and it doesn’t differ that much. You must first know WHAT exactly you want to do, and than you must come up with HOW to do it. There is no other way.

Hi thank you for your answer!

I know that I have to come up with my game architecture. I know we can do anything we want, anyway we want. I tried to be little bit less technical with my question but let me try to rephrase the question:

Does panda have any kind of “best practices” way to implement different game states? Transitions between states? Does panda implement any kind of Finite States Machine logic that we could follow?


Yup FSM is listed both in the manual and api … e_Machines … sm.FSM.FSM

AHHH… Thanks! Perfect! I read almost the entire manual but didn’t see that!! HAHA

Also, I’m sure many people play MTG… if anybody have any kind of suggestion, it would be really appreciated!


for animations, especially in your case. i can highly recommend the use of sequences, parallels and lerp intervals. having a class for each “scene” or game-mode is nice. if you add start/pause/stop you can easily switch to menues and back in the already mentioned fsm’s. (at least in my case that was a good idea)

Well well well.
Having played MTG for over 10 years, for now im playing only online with MWS. So you can find me on MWS servers occasionally under the same name as i use here. And if you are up for a match or two let me know, my MSN is in my profile.

I don’t have any suggestions for you, i have way too many suggestions :slight_smile:

  1. Create a simple game loop.
  2. Take a look how panda handles keyboard and mouse events.
  3. Take a look at directGUI and all of its components.
  4. Create a simple main menu to handle different game states, something like that:(Solitare, Vs AI, Multiplayer, Options, Exit). Options will have all the graphics tuning, network setup, sound and so on)
  5. Create a 3d grid based scenery(battlefield).
  6. Add a blank card to the scenery and take a look on how to click on 3d objects.

By now you should have a pretty clear understanding how your game structure should look. Not because of what i wrote, but because of what you have learned doing the above mentioned.

Now redo everything based on what you have learned and let me see it.

If you have a clean and clear structure you can go for the eyecandy.

Hi again!

First of all, I would like to thank “enc” and “ThomasEgi” for the very constructive tips they gave. Since I’m a “newbie” in Panda3D, This is the exact kind of tips I need. This directions are very important so I can efficiently start the project! So, don’t be shy MTG players, more tips!

I will post here the main functionalities I intend to have for this game so the MTG players can know what to expect from this project. My main goal is to have a commercial-grade totally free and open source MTG game, with amazing graphics so the MTG enthusiasts can get the most fun out of it.

I downloaded and studied all the good programs I could find about MTG and despite the fact that I WILL develop the game FROM SCRATCH, I will use the two OS programs below to get ideas for AI logic and rules enforcement logic:

1. Wagic the Homebrew - 1 Payer against AI, developed mainly for playstation, but can be played in windows and also linux. Since wagic is open source, developed in C++, and have a very good AI, I will use the AI logic as a starting point to develop the AI of the game in python.

2. Incantus - 1 Player solitaire or 2 players over the internet, no AI. Totally developed in python, using pyglet for the UI. It has a VERY VERY good rules enforcement logic but it is SO slow that it cannot be played. I will also use this program as a starting point for the game.

Well, lets talk about the game functionality and the order I intend to implement:

1. Deck Construction - I will implement an interface to manage cards and construct decks. Pretty much like Magic Workstation or MTG Studio.

2. Rules Enforcement - What do I mean by rules enforcement? The game should know what stage of a turn it is, how to process the spell stack, it should know WHEN and IF you can play a card, it should know how much mana you have available if you turn a terrain, how to distribute combat damage points, etc…

3. I will not implement ALL MTG rules and cards at once up to ROE since this would be stupid and it would take a year to release a working game. I intend to have a working 1 player solitaire with nice graphics in no more than 2-3 months from now. For the first release, I intend to have all the rules of Alpha, Beta, Unlimited (they are basically the same). So, the game development evolution will follow the sets release order by WotC, from 1994 until today. Cards abilities and availability will also follow this. This mean that an official release of the game will never have cards from some edition unless ALL cards and rules from ALL previous editions are implemented and working.

4. One Player Solitaire Game - The requirements for this is first, read deck files and rules enforcement. After the development of this first game mode, we will have a nice and working battlefield, graphics, etc, so we can move on to the other 5 types of games I intend to have.

5. One Player against AI - After having a fully functional game I will start developing the AI to enable 1 player games against the computer. I will also be including new sets and cards and rules enforcement for the new sets and cards.

6. Multiplayer Unrestricted - This mode will function much like the magic workstation but with full rules enforcement. I will also implement the game formats (Standard, Extended, Legacy, Vintage, Blocks and No Restriction). Now, I do I call this “Unrestricted”? Because any player in the network will have every implemented card available to construct decks and play against others. Now let me explain about the next type I intend to implement.

7. Multiplayer Real World - I want to implement a Market System, (just like the official MTGO), of course, with no real money involved. Just “play money”. Let’s face it, at least 50% of the fun of a collectible card game is to collect the freaking cards. If you play it, you know the excitement of obtaining a really rare card. Each new user will start with $100 “play money”, he will be able to buy starters, boosters or singles from the online “store”. He will be able to trade cards with other players. He will be able to bet cards or “play money” in a match. The price of the cards will follow the real world card prices. So it will be hard to obtain rare cards. We won’t see many Black Lotus flying around! :wink:

Well, for now, I think that is it… If anybody have any tips, please please, say something.[/b]

One more thing i wanted to add. Do the one player vs AI as the last feature. MTG did not become popular because of solo plays. Its strength is in player vs player play.

So try not to get stuck in AI development too early.