1

Is it possible to implement a JavaScript plugin/app in a web text based game? if it is, how is this done. I don't really need the codes. All I want is the functionality. Basically, I want a player in the game to talk to another player in the same game. Like if he(player) enters a room, I want him to see a player and communicate with him or her. Remember, it is chatting with another player, not another user.

Also, I want the php code used to integrate this app onto the site.

2
  • zeitoun.net/articles/comet_and_php/start , see the second example for chat. Commented Mar 14, 2011 at 15:36
  • 3
    "it is chatting with another player, not another user" What do you mean by this? Also: Is it already a multiplayer game? If yes then it probably already has a server side implementation for interaction, you can base your solution on that apparatus. Commented Mar 14, 2011 at 15:45

3 Answers 3

3

WebSockets are part of HTML5 and fit in my webbased game just neatly. There is a full guide on http://net.tutsplus.com/tutorials/javascript-ajax/start-using-html5-websockets-today/

Sign up to request clarification or add additional context in comments.

Comments

0

you can use long polling with js/jquery ajax calls to the php scripts and the database (or files) to make a chat like program

1 Comment

I'd like to mention that this can accumulate to alot of bandwidth. You could have an ajax call every, say, 5 seconds, but including all headers sent each time you might end up with several MBs of bandwidth in the end. Not sure if that will overcome somebody, but I'm just talking from my own experience.
0

Try searching for some open/free libraries that you can integrate with your game if you don't want to spend time implementing the chat part yourself. I just found this - https://blueimp.net/ajax/ but I have not used it, so you may want to take a look at the features and if it works for you.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.