Javascript/PHP Hearts
by zAlbee

Play: Multi (v0.94) | Single (v0.40)

General Information

Javascript/PHP Hearts was written by me, zAlbee, in response to the incredible slowness and lag times I experienced playing Yahoo! Hearts from my Queen's University connection, thanks to the unfavourable network traffic priority placed on any non-HTTP/POP3mail packets (such as Java games, blech). It is based mostly in Javascript, with additional PHP server code to handle data transfer and synchronization between multiple players. Most of it being in Javascript means that the game is executed locally - in other words, it is fast, and you will never spend time waiting for a blank screen.

Since Javascript and PHP both work to produce dynamic HTML, the game is playable with any current browser (IE 5+, Netscape 6+, or Mozilla 1+) without downloading any additional plugins (ahem Java VM's...). Being HTML also means that it's pretty easy to customize/skin/mod... ;-)


Multiplayer Notes

IMPORTANT: If you are using a popup-blocker, you must allow popups for this site "http://www.intricus.net/~zalbee/hearts," or you will be unable to logout. See instructions here. No other popups (ads, etc) will ever be shown - only the logout screen.

- The bottom-most frame will reload every 5 seconds to request data from the server. As such, it may appear that events only happen every 5 seconds and that you are "lagging." This is not the case.
- If you hear constant clicking sounds, turn off "Navigation Start/Stop" sounds in your Windows Control Panel.

Known bugs:
- Game will fuck up if equal sign or space is present in name, so I have disabled that possibility.
- If you write 2 or more messages (in chat) within one second of one another, you will only see your first message show up. However other players seem to be able to see all of it... (I'm not sure why they can)
- A javascript error sometimes occurs for the player that plays the last card of the game... not 100% reproducible
- Server counts Q of spades incorrectly as 1 point, and shooting the moon as 14.

History:

v0.94: Fixed Newgame button. Fixed chat from rewriting itself in its entirety. Major privacy improvement, so that chat is NOT stored until all four seats have seen it. You will no longer get a PHP error by pressing enter at Login. Frame size fixed.
v0.91: Made chat better. Much better.
v0.90: Implemented chat.
v0.86: Moved forms client-side, cutting bandwidth by 484 bytes per refresh. Unnecessary data transfer now virtually zero (15 bytes to be precise).
v0.85: Added Fast Redraw Mode for slower CPUs. Also eliminated unnecessary data transfer when game has not changed.
v0.82: Added the ‘your turn’ arrow + colours!
v0.81: Fixed the not-counting-of-the-single-point-card bug.
v0.80: First public beta.


To do (in order of most likely implementation date):
- Fix known bugs
- Add spectator mode
- Use binary search
- Implement ability to host switch + more host options (kick)
- Add bots
- Pass cards (maybe)


Singleplayer Notes

- There are no bots. You play completely by yourself! (Not a bad way to devise new strategies...) If you want to play bots, play MS Hearts on Windows!
- The single player game has more features, including replacing the suits (spades, hearts...) with letters (for easy copy/paste), as well as "fun modes" =) . Note: the following modes require IE 5.5+ filters: Flaming Cards, I See Backwards People, and Drunken Master.
- In Flaming Cards mode, you may find it hard to select a card. This seems to be a bug in IE; the solution is to click directly on the number (2,3...A) or suit picture.
- Click "doEndRound" to end the round prematurely and add whatever points were taken to the scores. This was a debugging option that I never removed. You probably won't find it useful. *shrug*

Known bugs:
- none!

History:

v0.40a: Fixed silly javascript error in non-IE browsers. Now it's final.
v0.40: Final version, with scoring, fun modes, and all.
v0.20: 4 hands, no rules =) Only thing it does is calculate whose turn it is.
v0.10: Not a game, but does a nice job of shuffling cards!