Author Topic: In-Game Messaging and Addressing  (Read 384 times)

Offline DV8

  • Level 10
  • *
  • Posts: 63
  • Reputation: +0/-0
    • View Profile
    • Shadowrun: Corrosion
In-Game Messaging and Addressing
« on: February 17, 2011, 07:00:05 AM »
When I initially started coding away at my game, I made a simple messaging system; the game could send messages to the players on behalf of NPCs and players could send messages to each other. One inbox, no folders, and the way to address the right player was by choosing the right character name from a drop down box. Oh, and there was no way to reply to a message. I left it at that and moved on to more important things.

I feel that it's become time to make something a little bit more serious to take the current messaging's place. At the very least, an inbox, an outbox and a sent-box. Threaded e-mail exchanges and easy one-click replies. Also, and this is the crux of my real problem, how do you handle addressing? Do you let people type up the name of the character in the to-field and let the name be validated by an AJAX call or server side? What about multi-recipient addressing? If anyone has some suggestions I'd be more than happy to listen to them. :)

Offline CygnusX

  • Level 24
  • *
  • Posts: 304
  • Reputation: +3/-2
    • View Profile
    • Lords of Midnight
Re: In-Game Messaging and Addressing
« Reply #1 on: February 17, 2011, 07:12:38 AM »
There are several ways to handle this...

For starters, on reply, I typically add <input type="hidden" name="mailtoID" value=" some player ID ">.  This eliminates the hassle of the player having to type out the players name.  It can also find the player much faster in the database as playerIDs are indexed. 

For sending, I allow players to type in names, and comma delimmiate.  Ie, player1; player2; player3.  I dislike this as I have to search a varchar field, but its necessary imo. 

I'm not sure why there would need to be an Ajax call... though this could be added.  Typically, I allow the player to try to submit the message, and if it has no recipients (or fails to reach a recipient), I store the message in $_SESSSION['Msg'];, echo this session value between <textfield> and </textfield>, and throw the error of who the message could not reach. 

Finally, I like to limit the number of messages a player can send per day.  Not only is it a good paid for premium feature to allow additional messages, but messaging takes up a lot of server resources that can get easily abused via spam.

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal