Email conversation
From | Burak Baskan |
To | Me |
Subject | solitaire game with ajax support |
Date | 26 October 2009 00:40 |
hi,
I'm trying to make some changes on your solitaire js code to make it
ajax based game with a chat support. More likely a player is playing
game and at the same time there might be people watching him and also
able to chat during the game. I'm not really good at JS, I'm a
PHP/Mysql guy, so wonder if you could help me to make those changes.
I'm willing to pay for this if its a reasonable price for me.
Let me know what you are thinking.
Best.
From | Me |
To | Burak Baskan |
Subject | Re: solitaire game with ajax support |
Date | 28 October 2009 17:17 |
Burak,
> a player is playing
> game and at the same time there might be people watching him
This is a really major undertaking, and not in any way a simple change to
the code. However, it should be possible for you to write a module that
hooks into the events system provided by the game:
http://www.howtocreate.co.uk/tutorials/jsexamples/solitaire.html#events
Whenever any event is detected, you would need to collect all of the
relevant information about the event from the API provided by the game (what
cards were involved, in what order).
Then you'd have to use XMLHttpRequest to send that information to the
server, which would have to store it in a FIFO queue. The "watchers" would
then have to poll the server using XMLHttpRequest, and get the list of
queued actions. You'd then have to write something that manipulated the
cards manually (when shuffling, for example) or used the API to update the
watcher's copy of the game (adding relevant cards to relevant stacks in the
correct order, and flipping them over as needed) to see what is happening.
This functionality is not built into the game directly, and would require a
lot of work on your part. It might even be easier to create a dedicated
viewer instead of adapting my game to display the game to the watchers.
Why on earth would you want to go to so much work just for a card game that
is intended to be played with only one player? Even if (as I'd guess) you
were attempting to use it as an interactive game tutorial, it doesn't seem
like it would be worth the effort to build it from my game.
> able to chat during the game.
So basically, you want to write a Web based chat client. This is an equally
huge task, and even major players in the Web development market have trouble
doing it right. It's far easier to buy existing solutions than write your
own.
> I'm willing to pay for this if its a reasonable price for me.
I am not doing any freelance work, and do not want any employment offers, as
stated on my contact page. Good luck if you still plan on doing it yourself,
though. I'd suggest that you hire a very competent JavaScript developer to
do that sort of work - it's not something that you can do without a lot of
JavaScript experience.
Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/