PDA

View Full Version : Chat feature for Online Multiplayer Game



Kaitenshin
July 24th, 2009, 05:16 AM
Does anyone know where, or know exactly how to make a simple flash chat feature. A basic one, just inputs your name and message into a dynamic text box. I've looked at all the existing ones and none of them have worked exactly for me (using xml sockets).

http://www.sephiroth.it/tutorials/flashPHP/flash_chat/index.php
http://www.kirupa.com/developer/flash8/php5sockets_flash8.htm
http://www.moock.org/webdesign/flash/

None of these ended up working on my server. Is their a specific, complete idiot proof one that anyone knows of? Or at least a more in depth version of one of these by yourself? This has been frustrating me for at least two days... changing ports, setting my own server and one off a website to test. Any help, big or small, would be _excellent_.

flyingmonkey456
July 24th, 2009, 05:58 AM
just make your own. i've never really done anything with php, mysql, or anything like that, but i know the basic idea of it.
every time someone enters a message you would send the message, the time it was sent, and the name of the sender an such to the server as a simple text string. everyone in the chat room would then receive that string from the server, parse it, and print the text to the screen. simple as that ;)

EDIT: i missed the bit about xml sockets, what i said was for using a php or mysql server. i'm not really sure about using sockets, i've never really dealt with them.

Kaitenshin
July 24th, 2009, 07:44 AM
Yeah. Supposedly the xml socket class is much more efficient since it maintains a constant link with the server side application. I mean... I get sooo close with these tutorials, but I must me goofing up somewhere... it probably has to do with the server / port being wrong.


mySocket.connect(null, 9999)

null makes the script look for the server app in the same directory that the flash client belongs to, and the port, which is just a random number, should work in theory right?

Gnoll
July 24th, 2009, 07:55 AM
The port shouldn't be a random number, it will be set on the server and will need to be the same on the client, if you want the server on a different host you will need to portforward from that host, and supply a crossdomain.xml

Gnoll

Kaitenshin
July 24th, 2009, 08:13 AM
How or where would I find out which port my server is using? Or do I set that myself?

(Running WAMP Apache Server with php/mySQL, off my own computer.)

Sorry, I'm still learning all of this and I'm a bit overwhelmed with this recent flood of knowledge.

Gnoll
July 24th, 2009, 08:55 AM
Somewhere in the server code (Your php files I assume) it will have a port variable, or if there is a config it should be in there :)

Gnoll

SparK_BR
July 27th, 2009, 12:47 AM
Apache's default port is set into your config file and you set it during the instalation
port 8080 is the default i think... not sure