Author Topic: Chat applet :: An external program for chatting directly to people in-game ...  (Read 1323 times)

Galok

  • Traveller
  • *
  • Posts: 11
    • View Profile
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
  • PS MySQL server.
  • Apache Tomcat Application Server giving access to Servlets which get and set Gossip channel text on the PS MySQL server,
  • A Java applet, the external chat program, embedded on the PS web page.

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:
  • Create Servlets for getting and setting Gossip chat text.

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.

  • A MySQL user will need to be set up with limited access to the PS MySQL database, for use by Tomcat.
  • An extra port would be opened (8084 or some such) so the applet can access Tomcat.
  • Small amount of configuration on Tomcat. Basically unzip Tomcat somewhere (with access to PS MySQL) and adjust some configuration files.
  • Java is required for Tomcat to work, either OpenJDK or Oracle Java.

Considerations:
  • Nothing is sent to my servers. All data transacts via the applet and the PS servers. The applet would reside on the PS Web server.
  • The example applet above shows a list of users. I assume a similar list is accessible from the PS MySQL server. For example: who is logged into Gossip channel/s
  • Would people be required to log in or like guests on the IRC channel, would they be allocated a temporary guest name.

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


  • When users start the chat applet their logged-on status is recorded: appletGossipUsers.

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

  • For each user there will be a bandwidth cost of around 0.3kb/second.
  • The applet allows /join so temporary channels can be created. Should these temporary channels also be available in game. PS allows other Gossip channels to be created right? The /join command could be limited to creating other PS Gossip channels.



Catlemur

  • Hydlaa Citizen
  • *
  • Posts: 424
  • Death or Glory
    • View Profile
 :thumbup:Will you release the code?

Galok

  • Traveller
  • *
  • Posts: 11
    • View Profile
Possibly but the prospect does scare me:
  • I've worked on the project for a few years solo.
  • I'm afraid of discouraging comments from other coders.
  • Would I still own the code?
  • Would this mean I'd be part of a team associated with the applet? Team is good.
  • Would I be able to keep a closed version for my own web site and an open version for PS?

The Servlets would be open because you need too see what SQL commands are being issued.

Gilrond

  • Hydlaa Notable
  • *
  • Posts: 764
    • View Profile
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).
« Last Edit: September 01, 2011, 02:16:10 am by Gilrond »

Earowo

  • Veteran
  • *
  • Posts: 1463
    • View Profile
    • Guild Site
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.
Dohmo: Please clean up your language immediately.
Me: as i just said, what i said, fits in the guidlines of rated PG, i was just explaining to the G guy
Dohmo: Sorry I tried to e nice
Dohmo: and i'm telling you to clean it up. last warning
Dohmo: now just do it
Dohmo: No more warnings

Abuse?

Galok

  • Traveller
  • *
  • Posts: 11
    • View Profile
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.

Gilrond

  • Hydlaa Notable
  • *
  • Posts: 764
    • View Profile
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.
« Last Edit: September 12, 2011, 01:45:02 pm by Gilrond »

Elvicat

  • Hydlaa Notable
  • *
  • Posts: 831
    • View Profile
    • My site
just make gossip connect to irc and the #planeshift channel ;)


novacadian

  • Hydlaa Notable
  • *
  • Posts: 960
    • View Profile
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

Galok

  • Traveller
  • *
  • Posts: 11
    • View Profile
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.