Chat System

Place for questions and answers for all newcomers and new coders. This is a free for all forum, no question is too stupid and to noob.
Post Reply
Loki
Posts: 7
Joined: Mon Nov 13, 2017 12:47 am

Chat System

Post by Loki »

Is there a standard chat I can implement to my game?

One with different channels so people can talk to alliance members, /w people, and global.

I want it to stick to the footer, and have a icon to pop the chat up or down.

Lyrania chat is awesome, if anyone knows if it's open source.

Thanks.
User avatar
Chris
Posts: 1580
Joined: Wed Sep 30, 2009 7:22 pm

Re: Chat System

Post by Chris »

Of course there is such thing as a standard chat system, otherwise you would not be able describe it the way you did. What you want to know is will it do the extras you want, that would generally require custom logic, and in that case it is no longer a standard chat system.

Chat systems are very easy to build.
Fighting for peace is declaring war on war. If you want peace be peaceful.
User avatar
hallsofvallhalla
Site Admin
Posts: 12031
Joined: Wed Apr 22, 2009 11:29 pm

Re: Chat System

Post by hallsofvallhalla »

Depends on what application you are attempting. Is this a standard web host only or do you have the option of nodejs or is this a .net or unity app?
Loki
Posts: 7
Joined: Mon Nov 13, 2017 12:47 am

Re: Chat System

Post by Loki »

Halls, I'm hosting a standard PHP SQL game on a standard web server. Not quite sure about nodej or any of that.
Loki
Posts: 7
Joined: Mon Nov 13, 2017 12:47 am

Re: Chat System

Post by Loki »

https://imgur.com/gallery/nJnh6

Something similar to this. I've seen plenty of games with it. Wasn't sure if it was a open source thing or not.
User avatar
Jackolantern
Posts: 10893
Joined: Wed Jul 01, 2009 11:00 pm

Re: Chat System

Post by Jackolantern »

Chat is a bit rough with PHP, as PHP has poor support for web sockets, which really are a must for real-time chat. There are some native PHP solutions such as Ratchet, but these can get pretty complicated pretty quickly, because the model that PHP uses for execution (creating objects through a third-party web server temporarily to handle page requests, and then disposing them) doesn't lend itself well to sustained connections.

You could set up a node.js server just for the chat part of your application, and then let the two applications communicate through the database or through API calls but again that is adding a lot of complexity.

What you are really looking for is a way to push updates from the server to the client without the client initiating it. That is what web sockets offer over normal HTTP. If you aren't expecting to have tons and tons of messages going night and day, you could use a commercial cloud service such as Pusher. That would be the easiest way to get server-push set up in a PHP application. Their free plan gives you up to 200,000 server-push messages a day. That is a pretty good number for a smaller, hobbyist web application that may take months to build up more than 100 users. If the site gets popular, you will end up burning through the free plan. At that time, you would probably want to look at working node.js into your setup. But if this is for a new application you are building yourself with limited advertising money, it should fit your needs for a good while.
The indelible lord of tl;dr
Loki
Posts: 7
Joined: Mon Nov 13, 2017 12:47 am

Re: Chat System

Post by Loki »

Pusher looks like it'll work. Thanks Jack!
User avatar
hallsofvallhalla
Site Admin
Posts: 12031
Joined: Wed Apr 22, 2009 11:29 pm

Re: Chat System

Post by hallsofvallhalla »

There are a few open source PHP based chat systems out there. Some good, some not. Google around as it has been some time since I looked but will need to for the simple engine I am working on.
User avatar
Jackolantern
Posts: 10893
Joined: Wed Jul 01, 2009 11:00 pm

Re: Chat System

Post by Jackolantern »

You're right there are some PHP solutions of course. No idea how they work since they can't natively use web sockets, but they are out there.

I would also assume that web sockets are something the core PHP devs are trying to solve as we speak. They have become a huge part of the web and PHP's lack of them is seriously starting to show as a problem. Rails, Python, node, Java, ASP.NET and pretty much everything else has a ws solution.
The indelible lord of tl;dr
User avatar
Chris
Posts: 1580
Joined: Wed Sep 30, 2009 7:22 pm

Re: Chat System

Post by Chris »

First PHP socket I ever made was with zero mq, which came with some major encoding issues between JavaScript sockets. Ratchet is a good solution. But you can always resort to zero mq with any language, just bind to the library.
Fighting for peace is declaring war on war. If you want peace be peaceful.
Post Reply

Return to “Beginner Help and Support”