Page 1 of 1

Creating a live chat O_O

Posted: Wed Dec 06, 2006 9:31 pm
by Mythic Fr0st
I want to add a live chat box to my game...

I need to know what languages to use, and basically, HOW to do it lol

Posted: Thu Dec 07, 2006 12:47 am
by Chris Corbyn
You can do it with JS and PHP in the form of AJAX (you can download these things via hotscripts or google for them too). Java also works nicely for peer-to-peer type applications like this :)

Posted: Thu Dec 07, 2006 2:15 am
by evilchris2003
Java has built in connectivity functions ideal for this sort of thing

Posted: Thu Dec 07, 2006 3:39 am
by aaronhall
If you're not hip to the ajax jive, the old school way of doing it would be to stick your chat box into an iframe and meta-refreshing every second or so. The iframe's source would of course be a php script that pulls the messages from the database in order.

Posted: Thu Dec 07, 2006 7:35 am
by Chris Corbyn
evilchris2003 wrote:Java has built in connectivity functions ideal for this sort of thing
Well, PHP can do it if you relay *everything* via the server.

With Java however you can just "track" the client IP addresses with the server and the have applets connect directly to the remote peer. The AJAX approach in PHP has been proven to work well though and will work with more browsers since Java is often disabled on the client.

hmm

Posted: Thu Dec 07, 2006 5:41 pm
by Mythic Fr0st
Well, What is going to be the most stable & effective?

(I would guess java, but can you use java with php & html?)

Posted: Thu Dec 07, 2006 6:37 pm
by aaronhall
I think they are referring to JavaScript when they say Java. JavaScript will be interpreted on the client side, and will interact with PHP/MySQL by way of the XMLHttpRequest object. While using Javascript is probably the most seamless, my suggestion would be compatible with any client (as it doesn't depend on JS, and JS can be disabled by the client). If your game is already using JS, you may as well go with AJAX.

Posted: Thu Dec 07, 2006 6:39 pm
by Luke
actually I'm pretty sure d11 was actually talking about java.

Posted: Thu Dec 07, 2006 6:45 pm
by aaronhall
The Ninja Space Goat wrote:actually I'm pretty sure d11 was actually talking about java.
Ah, so he was (just reread his first post). Seems though that it would be simpler to make asynchronous calls to a php script from javascript every so many seconds as opposed to writing an applet.

ah

Posted: Thu Dec 07, 2006 7:59 pm
by Mythic Fr0st
I'll check out ajax, although it sounds like a cleaning product:P

I already have a little JS & css, but mostly html & php

Im glad its JS and not java, cus the program I downloaded for it, wont start lolz

Thanks alot guys

now I just gotta figure out how to do it lolz, starting with making the box for the chat o_O

Q1: how do I make the box for the chat, like a black box, where you can type over... if you look at a game like
http://www.shimlar.com and many others, they have sort of a text area, thats my first goal o_O