• Sign Up Login
  • Features
    • Game Services
    • Real-time Analytics
    • LiveOps
    • Add-ons
  • Game Services
  • Real-time Analytics
  • LiveOps
  • Add-ons
  • Games
  • Pricing
  • Blog
  • Support
    • Docs
    • Forums
    • Contact
  • Docs
  • Forums
  • Contact
  • Sign Up Login
  • Ask a question
  • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Topics
    • Questions
    • Ideas
    • Articles
    • Users
    • Badges
  • Home /
  • General Discussion /
avatar image
Question by Ion · Mar 24, 2018 at 07:09 PM · CloudScriptphoton

Need Ideas : How to implement giving lifes in guild chat channel?

Hello!

We are currently working on a game whose social part of the game is used specially to get/give lifes to other clan members.

Which could be the best practice to get a practically synchronous "giving lifes" system?

Are the objects of groups + cloud script a good starting point for this?

Do i need to save the chat history for this?

An example:

I enter to the chat channel, and send " a need lifes message", which other clan members can press a button to give me a life. (the message can be pressed 5 times, so giving me 5 lifes in total)

I back to the main menu (not focus in the chat channel), and suddenly, a user gives me a life, so i get a notification in "lifes section" of the main menu. I go there and i can see the new life to take from the clan member.

Photon chat is cool for exchange messages at the moment, but what about storing such type of messages? Which have a life amount information and expiration date, for example.

Any suggestions/ideas are welcome! :)

Thanks a lot!

Comment

People who like this

0 Show 0
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by Brendan · Mar 25, 2018 at 05:30 AM

Photon Chat is great for running a chat service between players, but it does not provide server-hosted logic that would drive such a feature. And no, group objects would not be a way to do this, since a group object is just that - data which is general to the group, not specific to either player in your scenario.

What would be best would be to simply have a Cloud Script that you call once the player has chosen how many lives to send. The script would take the number of lives and the target player as input, and the logic would be to check that the player is allowed to grant the lives to the other player (to prevent cheating), then increment the lives on that other player. You could then use Photon Chat to push a message to the other player that the lives were granted.

Comment

People who like this

0 Show 2 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Ion · Mar 25, 2018 at 03:08 PM 0
Share

Thanks Brendan, the problem is that a player can only give 1 life for each life request (A life request = 5 lifes). Also, all the life requests are shown in the chat channel, so i need the history of the chat, or the lifes requests as minimum.

I noticed that the chat channel history is cleared when no user is subscribed, or something like that. And i need to store the chat history somewhere, because the life requests must be alive until their expire date or until 5 lifes are given...

I am thinking to implement a similar life request system, without displaying in the chat channel, just another section of the clan, but all the clan members must be able to see the requests.

Is this scenario better to use common data storage in guilds?

Also, i have to explain that is more important the life request system than the chat itself. I can lose the chat history, but not the life requests. I think the life requests should be a common data of the clan, because if the player leave the clan, the life request is also lost.

Thanks!

avatar image Brendan ♦♦ Ion · Mar 25, 2018 at 08:14 PM 0
Share

Photon Chat does not currently provide a means to store the chat history. If you want to store it, it's possible to use the Entity File system, where the Entity is the Group (Clan), but you need to make sure the read/write is done only occasionally. So in other words, do not attempt to update it on every chat message - that's guaranteed to not work. So realistically, you would need to have some server-side logic running that monitors for the presence of players and, when they're all gone, reads out the chat text and stores it - which would mean needing a custom game server running. What would be simpler would be to just use Redis to store the chat messages, and then read them back from there when a new chat room is started.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Navigation

Spaces
  • General Discussion
  • API and SDK Questions
  • Feature Requests
  • PlayStream
  • Bugs
  • Add-on Marketplace
  • LiveOps
  • Follow this Question

    Answers Answers and Comments

    2 People are following this question.

    avatar image avatar image

    Related Questions

    Issues with a Photon RoomEventRaised webook call 1 Answer

    webRpcResponse.Parameters are coming up null / RoomCreated not being called 4 Answers

    Preventing multiple login simultaneously 1 Answer

    Time Locked Items 3 Answers

    Cloudscript and receiving a callback from Mopub's Rewarded Video Ads 1 Answer

    • PlayFab

      • Features
      • Games
      • Pricing
      • Blog
    • Engineers

      • Documentation
      • Quickstarts
      • API Reference
      • SDKs
      • Usage Limits
    • Support

      • Forums
      • Videos
      • Contact
      • Service Health
      • Terms of Service
    • Social

      • Facebook
      • Twitter
      • LinkedIn
      • YouTube
    • Privacy & cookies
    • Terms of use
    • Trademarks
    • About Microsoft
    • Jobs
    • Accessibility
    • Diversity & inclusion
    • Security
    • Company news
    • © Microsoft 2019
    • Anonymous
    • Sign in
    • Create
    • Ask a question
    • Post an idea
    • Create an article
    • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Explore
    • Topics
    • Questions
    • Ideas
    • Articles
    • Users
    • Badges