PlaneShift

Development => Development Deliberation => Topic started by: Galok on July 04, 2011, 11:46:11 am

Title: Chat applet :: An external program for chatting directly to people in-game ...
Post by: Galok on July 04, 2011, 11:46:11 am
I was in the Court House Developer meeting yesterday. I asked if there would be any interest in a separate application for users who are not logged into PS to communicate with those in-game, via the Gossip channels. The idea was not slammed (if I understood the responses correctly) so here is my proposal.

Chat applet :: An external program for chatting directly to people in-game using PS Gossip channels.

Architecture

An example of the applet is here and uses this architecture: http://78.105.176.34/logFarm/infoPage_227.html

Based on this example, work required:

To determine when new chat text has arrived the applet uses date time. It's possible the data and time of new Gossip chat text is not recorded on the PS MySQL server. This applet does all the getting and setting of text so dates and times are necessary.


Considerations:

Currently the applet allocates a temporary user name but the user can register and log in.

It's still possible to moderate temporary user names because the applet uses IP address (in addition to user names) to silence, kick and ban.

The applet retrieves the user's IP address for moderation purposes and writes various IP information to: ips

Field   Type      Null   Key   Default   Extra
ipStuff   varchar(100)   NO    PRI         Unknown


So this table would need to be created.

And a table called: bans

Field         Type       Null   Key   Default   Extra
userName      varchar(50)   NO       Unknown
channelName   varchar(50)   NO      NULL
banReason      varchar(250)   NO      Channel privacy has been switched on.
invitedUser      tinyint(1)   NO      0
canObserve      tinyint(1)   NO      0
userIP         varchar(50)   NO      Unknown
dateBanStarted   datetime   NO      NULL
id         int(11)      NO   PRI   NULL         auto_increment



Field      Type       Null   Key   Default   Extra
userName   varchar(50)   NO   PRI    NULL
loggedIn   tinyint(1)   NO      0
pingTime   datetime   NO      NULL


When a user starts to use the applet their user name would be added here. When the user stops using the applet their user name is removed from this list.

The pingTime field is updated periodically by the applet. If that date-time exceeds a certain period, they are considered a Zombie, meaning the applet has not cleaned up properly. On my server I run a separate application: a Zombie manager



Title: Re: Chat applet :: An external program for chatting directly to people in-game ...
Post by: Catlemur on July 04, 2011, 12:17:20 pm
 :thumbup:Will you release the code?
Title: Re: Chat applet :: An external program for chatting directly to people in-game ...
Post by: Galok on July 04, 2011, 02:11:16 pm
Possibly but the prospect does scare me:

The Servlets would be open because you need too see what SQL commands are being issued.
Title: Re: Chat applet :: An external program for chatting directly to people in-game ...
Post by: Gilrond on September 01, 2011, 09:13:27 am
Just noticed this thread, since it was bumped up. A few questions - do you really need Java for that? May be frontend can be done in JavaScript. Also, for chat one could use XMPP server, which could for example mirror PS gossip. Then anyone using an XMPP compatible client can connect to it, even without need for a browser (making XMPP client in JavaScript is also possible).
Title: Re: Chat applet :: An external program for chatting directly to people in-game ...
Post by: Earowo on September 01, 2011, 12:30:30 pm
You know, the benifit to this, is that GM's would be able to moderate the channles, while offline, from a laptop, anytime..
If it were upgraded to that extent, mabey even from a cell phone.
Title: Re: Chat applet :: An external program for chatting directly to people in-game ...
Post by: Galok on September 12, 2011, 04:52:08 pm
Gilrond, if your question was address to me:

The reason I suggested Java and Tomcat is because I had already created a similar project.

My original idea naively assumed that in-game chat text was saved to a database but I am now of the opinion it isn't, which takes my architecture idea off the table.

So now:

+-------------+         +------------+        +------------+
  In game chat|- Socket-   PS Server |-Socket-|  Other PS
  facility    |                      |        |  Clients
+-------------+         +------------+        +------------+
                              |
                             -|- Same Socket
                              |
                        +------------+
                           External
                         chat program
                        +------------+


I am guessing that the PS Client and Server open a socket (ip:portNumber) and they push chat-data back and forth to each other, via this socket.

I don't believe we can do 'that' with javascript since it can't use InputStreams for security reasons (right?).

So we'd need a bridge to transfer chat-data to and from the openChatProtocol service.

+-------------+         +------------+        +------------+
  In game chat|- Socket-   PS Server |-Socket-|  Other PS
  facility    |                      |        |  Clients
+-------------+         +------------+        +------------+
                              |
                             -|- Bridge to and from
                              |  Jabber or what-not.
                              |
                        +------------+
                           External
                         chat program
                        +------------+

I am still an advocate of saving chat text to the PS database though. Once in the database there are endless possibilities for using it.

For me this is where Tomcat Application Server would be useful, it would separate the web space from the database.

I'm wedged at the database idea.

As Earowo points out, mobile devices need to be considered so an all-browser facility would cover all users.
Title: Re: Chat applet :: An external program for chatting directly to people in-game ...
Post by: Gilrond on September 12, 2011, 08:38:08 pm
Such simple database is not an ideal thing for distributed system which chat is. It's a single point of failure and performance bottle neck. What you might want to use the DB for, is storing offline messages, but PS chat doesn't support them, so DB might be avoided altogether.

I agree that you need some gateway which could bridge PS chat with some generic chat server (I like Ejabberd for one). And if you consider using a browser client, there is no way out of using JavaScript. Java isn't an option on several platforms.
Title: Re: Chat applet :: An external program for chatting directly to people in-game ...
Post by: Elvicat on September 13, 2011, 12:08:08 am
just make gossip connect to irc and the #planeshift channel ;)
Title: Re: Chat applet :: An external program for chatting directly to people in-game ...
Post by: novacadian on September 13, 2011, 04:36:16 am
My feeling is that this development should be avoided. It is my personal feeling that there are already too many channels to drag players out of any immersion. Guild and alliance channels can be felt if not heard in distracted players sitting together and not mentioning a word or doing so with huge lags in the flow. Bringing in chatter from people not even playing the game will only heighten such distractions in my opinion.

- Nova
Title: Re: Chat applet :: An external program for chatting directly to people in-game ...
Post by: Galok on September 13, 2011, 12:12:14 pm
Elvi,

PlaneShift could set up their own IRC server for this purpose. The advantages:

- Less, maybe no chance of nick conflicts.

- Zero chance of channel name conflicts.

- Freenode is an excellent service but a PlaneShift owned IRC server would be controlled and used by PlaneShift only so no breaking any freenode rules.

- PlaneShifters would simply connect to the PlaneShift IRC server instead of the Freenode server with their usual IRC client so no need to develop an external application.

IRC servers are free, easy to install and low bandwidth. It could reside on the PlaneShift server without worries of resource hogging. A new port number would need to be opened on the server.

Development: Pipe chat-data to and from the Gossip channels, to and from the IRC service.

This solution is the most straight forward so far I think, nice one.

      +-----------+    +---------+
        Gossip    |----    PS    |
        channel/s |      Clients |
      +-----------+    +---------+
           |
           |-- Chat-data
           |
      +-----------+
       PlaneShift |
       IRC Server |
      +-----------+
           /\
          /  \
         /    \
+---------+  +---------+
 Standard |   Standard |
   IRC    |     IRC    |
  Client  |    Client  |
+---------+  +---------+


P.S.

novacadian, I respect your point of view.

This reply and thread is/was not designed to inflame RP or game-immersion arguments.