|
|
|
|
![]() ![]() |
Feb 18 2007, 07:27 AM
Post
#1
|
|
|
Newbie [ Level 1 ] Group: Members Posts: 9 Joined: 17-February 07 From: U.S. Member No.: 20,462 |
OK, so here's the skinny:
Back when AOL was THE place to be online (1998/1999), me and a few friends became internet vandals, using punters and things of that ilk to reek havoc in the chatrooms. Our heyday was short-lived, as punting became virtually impossible with AOL 4.0 and pretty much a thing of the past with later patches/releases. However, 'progs' -- as they were referred to, usually named by their creator with some variation of the words "Hacker," "Elite," and "Toolz" -- did not die. Their golden age had passed, but souls desperate to keep them alive (like us) persevered. Somewhere along the way, we figured out what the MaGuSes and MoNkEGoDs were using to create these (formerly) fun little toys, and entered my life Visual Basic. I was enthralled. I don't know what it was (or is), but the puzzle-solving nature of programming combined with my interest in computers makes programming fun. Certainly not monotonous tedium, as most other complex things are to me. And by complex, I simply mean things that require effort to understand. I'm a simple man. Anyway, I'll fast forward a bit and try to avoid the nostalgic reminiscing from here on out, k? So here I am today, trying to get back into programming as I should have been doing for years. I could have a career by now if I wouldn't have been such an idiot these past few years, but you live and learn. I've been trying to learn Java for the past month or so, and I've certainly made progress coming from nothing to where I'm at now, with only a For Dummies book and the Sun Java Tutorials to guide me. To get to the point: The past few weeks I've been making a pretty straightforward chess game (calling it simple just feels wrong!) and have got the game itself (mechanics/logic) pretty much done with. All except for castling and a couple of stale-mate scenarios, to be precise. I'm not planning on implementing AI and a single-user mode, but instead want to figure out how to make two applets of the game communicate with eachother so two people can use a webpage to play eachother. I've got a ways to go, and actually haven't done anything towards this end other than a little bit of research, but that's mostly because I'm always working; I plan to get busy here soon. In the mean-time, I thought I'd post a link to my game and the source and (hopefully) have some more experienced coders with nothing better to do scrutinize it and maybe give me some pointers, or flame me or whatever. Feedback is feedback So, you can check out http://www.angelfire.com/crazy/eubanks/chess.html just to catch a glimpse of my game and the GUI that needs to be redone. The full Eclipse IDE project can be downloaded from http://www.angelfire.com/crazy/eubanks/chess/NewChess.zip If you've got some spare time, download the source and check it out, and tell me what you think. After doing some research, I was surprised to find out that the methods I used for the game mechanics were pretty much on point as far as how people usually go about doing it. The only other method I found was the whole bitwise thing, and that's beyond me right now A few things to note for those who check it out: ** I've been wondering just what the hell is up with my GameBoard class (which extends JLayeredPane) and why it's layers are so funky. If you notice in the ChessInterface interface, the BACKGROUND layer is 1, the PIECE_LAYOUT layer is 2, and the PIECE_DRAG layer is 0. This is the only way I could keep pieces being dragged from going behind pieces still in the PIECE_LAYOUT layer. If I set PIECE_DRAG layer to 3 (as I would think it should be) the dragged piece will end up behind some of the pieces in the PIECE_LAYOUT layer when they overlap, which boggles my mind. ** I've currently got move-switching disabled (in MouseEventHandler.grabPiece method) because I needed to test some things and having to move white>black>white>black made it a P.I.T.A. ** You might notice a method or two are straight out of the Sun Java Tutorials (such as the ImageHandler.getImage method). ** I've been getting a weird error recently when I terminate the game, but only some of the time for some reason. If you can tell me where this is originating, thanks: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException: component argument pData at sun.awt.windows.Win32SurfaceData.initOps(Native Method) Well, that's about it guys. Hope one or two of you out there can share some wisdom with me |
|
|
|
Feb 18 2007, 07:28 AM
Post
#2
|
|
|
Newbie [ Level 1 ] Group: Members Posts: 9 Joined: 17-February 07 From: U.S. Member No.: 20,462 |
QUOTE And by complex, I simply mean things that require effort to understand. Haha, that's gold! This isn't a bump I just reread that and thought it was hilarious. |
|
|
|
Mar 4 2007, 02:42 AM
Post
#3
|
|
|
Member - Active Contributor Group: Members Posts: 83 Joined: 10-November 06 From: Provo, UT Member No.: 17,161 |
I took a look at your game (haven't taken a look at the source code though) and was quite impressed. I have a few suggestions to make it better:
These changes are pretty easy to do, except for the multi player one (find a good Socket tutorial if you are confused). I liked your game and it seemed quite professional; just make sure that your code is professional as well. The applet took a little long to load the first time, so perhaps you should try to reduce the amount of code in the startup and build the board and all of that after it is loaded. A simple "Start Game" button would do the trick. Good work, I am impressed. |
|
|
|
Apr 28 2007, 11:32 AM
Post
#4
|
|
|
Member - Active Contributor Group: Members Posts: 77 Joined: 11-December 04 Member No.: 1,704 |
There's just a few features missing:
- Pawn promotion - En passant - Turns (ie. each player has their turn instead of someone being allowed to move over and over again) - And of course, capturing the king can't be done |
|
|
|
Apr 29 2007, 07:54 AM
Post
#5
|
|
|
SM- the Man -The Myth - The Legend Himself Group: Members Posts: 433 Joined: 4-September 05 From: Drinking da rootbeers Member No.: 8,313 |
some pretty good coding done for a chess game, at least for the most part you got the basic of the basic moves done which is a good thing. I didn't try it out but was castling possible in this version of the game? Other then what was recommend I can't say to much about it since I have really touch a chessboard in a long time so their could be other special moves that could be missing as well.
|
|
|
|
May 23 2007, 01:23 AM
Post
#6
|
|
|
Colonel Panic Group: [MODERATOR] Posts: 2,730 Joined: 25-March 05 From: Toronto, Ontario, Canada Member No.: 3,233 |
There are definitely major problems, but nicely done regardless.
It doesn't follow any rules and mainly, there's no A.I and turns, making the game bleh. xboxrulz |
|
|
|
May 23 2007, 11:56 AM
Post
#7
|
|
|
Whitest Black Mage Group: [MODERATOR] Posts: 1,322 Joined: 20-May 05 From: NB, Canada Member No.: 5,281 |
If I remember later when I get home I'll try to find my old chess game code. I actually had to make an online chess game for a university course a couple years back and I got it oooh, lets say 95% functional. As with yours, AI wasn't implemented (it was meant to be a two player implementation of the game) but otherwise mine had most functionality. En Passant I remember was the only thing that was a pain to implement because I forgot about it until the end and tried to implement it in probably the most stupid way possible, but the second way I did it was a piece of cake. Basically in the end I had a functional net based chess game that worked over tcp/ip. The main problems with it had to do with tracking captured pieces and displaying them as they were captured and scores and stuff like that, sort of the bells and whistles rather then the core game itself which basically worked fine.
But yea, if I remember later I'll post my code and look at yours a bit, see if I can notice anything good to suggest. Obviously the things mentioned by the others are important to implement otherwise you just have a piece tracking system, not a chess game |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 5th September 2008 - 11:57 AM |