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.

Chat System

Postby Loki » Wed Nov 15, 2017 6:48 am

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.
Loki
 
Posts: 7
Joined: Sun Nov 12, 2017 7:47 pm
Has thanked: 3 times
Been thanked: 0 time

Re: Chat System

Postby Chris » Wed Nov 15, 2017 8:02 am

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
Chris
 
Posts: 1575
Joined: Wed Sep 30, 2009 2:22 pm
Has thanked: 4 times
Been thanked: 5 times
Blog: View Blog (2)

Re: Chat System

Postby hallsofvallhalla » Wed Nov 15, 2017 12:37 pm

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?
User avatar
hallsofvallhalla
Site Admin
 
Posts: 11998
Images: 13
Joined: Wed Apr 22, 2009 6:29 pm
Location: mobile, al
Has thanked: 11 times
Been thanked: 164 times
Blog: View Blog (3)

Re: Chat System

Postby Loki » Wed Nov 15, 2017 8:53 pm

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: Sun Nov 12, 2017 7:47 pm
Has thanked: 3 times
Been thanked: 0 time

Re: Chat System

Postby Loki » Wed Nov 15, 2017 8:59 pm

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.
Loki
 
Posts: 7
Joined: Sun Nov 12, 2017 7:47 pm
Has thanked: 3 times
Been thanked: 0 time

Re: Chat System

Postby Jackolantern » Wed Nov 15, 2017 11:02 pm

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
User avatar
Jackolantern
 
Posts: 10893
Joined: Wed Jul 01, 2009 6:00 pm
Location: Houston, TX
Has thanked: 22 times
Been thanked: 92 times
Blog: View Blog (1)

Re: Chat System

Postby Loki » Wed Nov 15, 2017 11:35 pm

Pusher looks like it'll work. Thanks Jack!
Loki
 
Posts: 7
Joined: Sun Nov 12, 2017 7:47 pm
Has thanked: 3 times
Been thanked: 0 time

Re: Chat System

Postby hallsofvallhalla » Thu Nov 16, 2017 10:49 am

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
hallsofvallhalla
Site Admin
 
Posts: 11998
Images: 13
Joined: Wed Apr 22, 2009 6:29 pm
Location: mobile, al
Has thanked: 11 times
Been thanked: 164 times
Blog: View Blog (3)

Re: Chat System

Postby Jackolantern » Thu Nov 16, 2017 7:54 pm

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
Jackolantern
 
Posts: 10893
Joined: Wed Jul 01, 2009 6:00 pm
Location: Houston, TX
Has thanked: 22 times
Been thanked: 92 times
Blog: View Blog (1)

Re: Chat System

Postby Chris » Fri Nov 24, 2017 6:01 pm

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.
User avatar
Chris
 
Posts: 1575
Joined: Wed Sep 30, 2009 2:22 pm
Has thanked: 4 times
Been thanked: 5 times
Blog: View Blog (2)

Next

Return to Beginner Help and Support

Who is online

Users browsing this forum: No registered users and 1 guest

cron

x