Structuring Photon Module | Code Help

edited June 2017 in Any Topic & Chat
Hi, our mobile game is now almost ready for soft release and we're using Photon Unity for real time battles. It is a match-3 family game. Our match making, friendly challenges AI and matches work fine, however when we look at the code, The match making (and photon connect) part totally looks alien. The only reason I could think of this is because we gave it very little time, and didn't think of rewriting it, instead plugged in our vs screen and other stuff in it. It is still separate from games' and battle's internal logic, but its ugly.

It was simply built over one of the mono-behaviors from the Examples folder. We made changes to a lot of stuff, but we didn't start off with a solid base, so to speak I think these might introduce problems in future. I have gotten into a few problems for a feature I am implementing, and also I am thinking of re-writing it so it can be clean.

1) I'd like to know if there's a good example on git hub out there, because I couldn't stumble upon any, or if some of you guys can share your architecture/code/drawing so I could think over restructuring my code.

2) The problem I am facing is that, whenever I leave a room OnJoinedLooby - event is fired (understandable) and also OnConnectedToMaster - event is fired. I'd appreciate if there's a life-cycle or a flow chart of these events so I can restructure my code accordingly. For friendly battles and direct challenges, I am using a chat sdk (3rd party) and that works fine. For random match making my sql lobby with filters works like a charm. But because we are planning to launch on facebook, I wanted to do simple messaging in each player's own room instead of using 3rd party chat sdk.

So each player will be in a his own room, whose name will be based on his user id. If player B wants to challenge player A, he'll leave his room (B) and will join room A, if room is not found, we'll assume A is offline, if its found, we'll send a challenge message rpc, which A can accept or decline. What are your suggestions for it.

Any direction in the regard will be helpful.

Sign In or Register to comment.