Posts RSS Comments RSS Del.icio.us Digg Technorati Blinklist Furl reddit 66 Posts and Comments till now
This wordpress theme is downloaded from wordpress themes website.

YuGiOh GUI in C# (2006)

I wrote this nifty GUI in 2006 (shortly after college) for playing the YuGiOh card game.

This basic GUI prototype is pretty simple – it doesn’t have any AI, or networking, or OpenGL graphics.  It doesn’t enforce any of the complex card-specific rules logic.  It doesn’t display the card graphics (it just displays the card’s name).  What it does do is…  It reads a deck from a text file.  It shuffles the deck randomly and allows you to draw cards from the top of the deck, and to move a card to a specified game location (in the specified position).  It also has a simple integer number generator (for rolling dice, coin flips, etc).  When a card is placed on the field, the text boxes are intentionally editable so you can track things like how many counters are on a card.

This basic functionality was very useful to enable two use cases.  The first use case is that I could experiment making decks without using physical cards – to create a deck, I just type the card names in a simple text file.  I could also manually simulate playing two decks against each other.  The other use case is that I could play with someone over instant message and track the state of their game and my game (yes I actually did this) (the person on the other side could be using an actual physical deck instead my program).  So this was a great example of a tool that was low effort to write, but very useful.  And it could (obviously) be expanded to do a lot more.

One more feature worth mention is that although this is a GUI application, you can also play the entire thing in console mode using custom scripting commands (this is similar to how AMD SimNow works).  This could be extended to record and playback a session, though we’d need to save random number seeds for anything random (eg shuffling the deck).

Screen shot of the initial GUI:

image

Screen shot after a bit of playing:

image

To place selected card from hand, you right-click the zone:

image

Or if a card is already placed, you can reposition or move it, by right-clicking on the card:

image

An example deck list text file:

# http://www.professional-events.com/decks/UDE/YGO!/RegionalsButler090206.htm
# 14
[Monsters]
3 Lava Golem
3 Stealth Bird
3 Des Koala
2 Des Lacooda
1 Sangan
1 Spirit Reaper
1 Morphing Jar
# 13
[Spells]
3 Chain Energy
3 Wave-Motion Cannon
2 Nightmare’s Steelcage
2 Messenger of Peace
1 Swords of Revealing Light
1 Level Limit – Area B
1 Graceful Charity
# 13
[Traps]
3 Secret Barrel
3 Just Desserts
2 Ojama Trio
1 Ring of Destruction
1 Magic Cylinder
1 Gravity Bind
1 Ceasefire
1 Torrential Tribute

Trackback this post | Feed on Comments to this post

Leave a Reply