Photon Networking - Getroomlist() - networking

I used the get room list function for getting the rooms in the server. But once i joined the particular room ,I am not able to see the list? How can i see the list even if i connected to room?

Short Answer: I'm afraid the answer is you can't - its not supported out of the box.
Long Answer:
Its per Design
The reason for this is the scalable architecture of Photon Loadbalancing
which is the server side application and part of the sdk that is usually
used in conjuncion with PUN. Loadbalancing is also what is driving the Photon Cloud in case that is what you are refering too.
What happens is that your client initially connects to what is called the Master, where the matchmaking takes place. Your client cn either create a new room or join a room using the list of rooms or any of the other matchmaking options like JoinRandom for instance.
Once any of this happens the master will send your client the information required to connect to the GameServer hosting the game.
In case of a new client it will send your client to the server with least load.
Under load the list of games and their properties can change very quickly
- games are created
- players join and leave
- games can reach their max allowed # of players
this changes are propagated from all the GameServers back to the Master
but it is not propagated to all GameServers, meanig its not available to your client once its in a room.
Options
There is a longer thread about this topic here:
http://forum.exitgames.com/viewtopic.php?f=17&t=3093
The gist is of the discussion is:
In case you are using the selfhosted version Photon (not the Photon Cloud) you could extend Loadbalancing.
You could connect a second peer and leave it connected to the master, with the disadantage that it is counted as a second ccu, which might be a problem for your costs since its all based on ccu.
Disatvantages of Game Lists
In general the use of game lists as design component in the games tends to be overrated - it is an easy way to have matchmaking during devlopment but doesn't work well (for most of the games) when going live.
Players usually don't care and match to games based on filters (there is no need for game lists for that since photon supports matchmaking with filters), usually leading to player choosing one of the first games on the list. Under load this often means that many player try to join the same game, which usually is a problem since most games need some kind of max # of players.
BTW: if they care its often "I wan't to play with a friend", which is also supported by the photon matchmaking.
If you have mobile clients the lists of games can be a burden specially with very active games, it takes a time to load the lists and it uses bandwith to load and mantain them. Due to the latancy its also more likely for players to select games that are already full.

You might be able to by creating a second instance of PhotonNetwork and connecting it to said server where the games are hosted, and have this instance a game object that also talks to the object that has your lobby script. Not to sure if this will work or how hard it would be to implement. I'm currently working with Photon myself.

Related

Realtime Multiplayer Game with firebase

I just created a mobile game with flutter and would like to extend that to a multiplayer online game. So I thought about making it with firebase. I'm rather new to this domain so I hope my questions don't sound too stupid.
As the characters in my game move around fluidly I need to update their positions at least once per frame, so in case of using firebase I would need a cloud function that runs like 60 times per seconds and never ends. This function would then take all the objects in the game (which are stored in the realtime database) and update their positions according to their speed. The updated values are written back to the database to which the clients listen. They update the values in the game and render the objects at the correct positions. Whenever a player interacts with the game somehow another cloud function is called to handle that and update whatever is needed.
Is it possible to make something like this and does it make sense? It does not sound very smooth to me using cloud functions in this way but I don't have another idea of implementing it. And how would it affect the costs? Sound like a lot of function invocations and db reads/writes..
If this is totally unthinkable what could be alternatives? I wouldn't mind too much using another db and or framework to make the game itself.
Thank you very much
Communicating positions etc through a database won't be fast enough for you to do it 60 times per second. You'll have to use some form of mixed UDP and TCP solution and unfortunately that doesn't exist pre-built for Flame like it does for some game-engines, but it might not be too complicated to build one yourself depending on how complex your use-case is.
Like #Fattie suggests, it could be a good idea to try out if PubNub works for you.
Update: There is now an early stages Nakama (Open source game server) integration for Flutter here.
Firebase has utterly no connection to what you are trying to do.
You just use Unity and one of the realtime-multiplayer services - like Photon.
It is inconceivable that as a hobbyist you'd start from scratch and try to write realtime, interframe, predictive quat. networking!
In five minutes ...
https://doc.photonengine.com/en-us/pun/v2/demos-and-tutorials/pun-basics-tutorial/intro
It takes 5 minutes to download the Photon/Unity demo and be playing a realtime multiuser game with robots running around.
You then just learn how to add guns or whatever and add your own models.
Flame ...
Flame is spectacular BTW. To do a R/T MP demo with Flutter/Flame, I'd suggest just using PubNub, which would take no time.
http://pubnub.com/developers/demos/codoodler (all of the demos are terrific). It's the world's major realtime backbone, nothing is faster, they do Flutter so - that's about it.

Managing a connection to an external component in an Aggregate

I just discovered Axon framework and am very eager to use it as it answers a lot of my questions and concerns about DDD.
The first project I'd like to use it on contains small cameras which are controlled via the GigEVision protocol (over TCP and UDP for the control and stream channels). I think my problem would be the same for any case where we maintain a connection to an external component or more generally we want to link an external component lifecycle to Axon's lifecycles.
I'd like to have an Aggregate named Camera to which I can send Commands to grab 1 image or start grabbing N images at a certain FPS.
What I'm not sure about is how to manage the connection to an external component in my Aggregate.
- Should I inject the client to my camera in my Camera Aggregate and consider connecting to it as part of my protocol / business commands? In this case how would I link the camera lifecycle (a camera get disconnected all of a sudden) to the aggregate lifecyle (create a corresponding CameraDisconnectedEvent)?
- Should the connection be handled in a side car Saga which get the camera client injected, the saga starting on ConnectionRequestedEvent and stopping as soon as we get a connection error from the camera. I would get the same issue of linking the connection lifecycle to the lifecycle of the Saga I think.
- Am I leaking implementation details in the business layer and should manage the issue an other way?
- Am I just using the wrong tool for this job and should not try to force it into Axon?
Thank you very much in advance, hope my message and issues make sense.
Best regards,
First and foremost what you should do, is ensure the language spoken by the GigEVision protocol by no means transitions over into your other domain.
These two should be separate and remain so, as they cover different concerns.
This brings to light the necessity to have a translation layer of some sort.
More formuly called a context mapping. From a DDD perspective, you would take this even further by talking about an Anti-Corruption Layer.
The name already says it, you add a layer to ensure you are not corrupting your domain logic with that from another domain.
Another useful topic to read up on here would be the notion of a Bounded Context.
I digress though, let's go back to the problem at hand: where to position this anti-corruption layer.
What is currently unclear to me, is what domain requirements are in place why the connection is required to be maintained all the time when requesting for images.
Is the command you want to send requesting for a live feed? Or just "some" images from a given time frame?
In both scenarios I am not immediately convinced that any of these operations requires the validation through a single Camera aggregate to be honest.
You could still model this in a command and event format, as the messaging paradigm is very helpful to allow clean segregation of concerns.
But given the current description, I am uncertain whether you need DDD's idea of an Aggregate to model a single Aggregate in.
I might be wrong on this note, but I just don't know enough about your domain at this stage.
That's my two cents to the situation, hoping this helps!

REST API streaming versus repeated GET requests

I'm making a turn based game kind of like multiplayer checkers that works with firebase realtime database, so each client needs to know when moves are made.
I'm limited by third party framework that only allows REST API requests, but doesn't allow REST API streaming because there is no way to "Set the client's Accept header to text/event-stream" or "Respect HTTP Redirects, in particular HTTP status code 307".
So, I'm thinking of reading the database with GET requests every second to see if there is new data, but I'm worried that this could be inefficient in terms of data and cause a large bill. How much worse is this solution than a REST API streaming one and is it practical?
Since in multiplayer games response time is very critical, I think you should think about how this may be inefficient in terms of user experience. But of course that will depend on how the game works.
But if you think it is ok users to have 1000ms delay, then the question is how much players will be playing the game daily, how long does each game take to finish (turn wise).
((avg. turns per game) * (avg .# of players in a single game)) * (games played per day) will be the minimum reads for only the game play part. Also you must consider if you will have to constantly check multiple documents. Probably there will be many writes also reads on the other parts of the game.
So I think overall, it is very inefficient way to solve this problem in many ways.
What is the platform you are using? Maybe someone could find a way around somehow.
Firebase provides callback listeners for requests. You can attach ChildEventListener to your request to track real time changes in your database. As long as it is connected it will be considered a single request.
Refer to this link

How to make correct implementaion of multiple child stores created dynamically

I have app where I have office list and workplace list (Workplace belongs to office). On both of them you can add notes, items (Ie. this place is small / this one has a printer / this office has one office-wide printer etc.)
Problem - To manage notes and items I plan to use shared component which renders as pop-over, and it can be more than once on screen (to compare two places for example). What I cannot figure out is how to do this correctly in redux. I cannot have one store for component. If I put one store per office / workplace - then I'm worried that I will have too much memory used (As it should take care about up to ~10000 workplaces spread between 10 offices, each of workplaces can have up to 20 items + notes). And I cannot find any other way to make store for component only - which will be created when it is shown, then it will work inside with component to make it work, and then it will be destroyed when component is closed.
Question - How to make this correctly, so I can use as much as possible from redux and it wont have local store with all data ?
[Additional info]
From analysis (And from goal of application) I see that this lists will be used once in long period of time, when they need to load data at the beginning from the server, then make some actions around, then done.
Overall there is big amount of small changes to items / notes, but very small amount of changes to workplaces / offices - which are checked via AJAX polling. I wanted to avoid AJAX polling / sockets for all details - because this will mean big data flow to clients
Having 10000+ items is totally fine. In fact, this slideset on High Performance Redux compares the behavior of a list of 10K items with only the list component connected to Redux, vs a list of 10K items with every list item connected, and demonstrates that the 10K connected list item example is much faster.
Also see Redux FAQ: Performance for more information on performance, and redux-ecosystem-links for links to libraries that can help implement per-component state stored in Redux.

signalR groups - connecting/disconnecting and sending - am I missing something?

very new to signalR, and have rolled up a very simple app that will take questions for moderation at conferences (felt like a straight forward use case)
I have 2 hubs at the moment:
- Question (for asking questions)
- Speaker (these should receive questions and allow moderation, but that will come later)
Solution lives at https://github.com/terrybrown/InterASK
After watching a video (by David Fowler/Damian Edwards) (http://channel9.msdn.com/Shows/Web+Camps+TV/Damian-Edwards-and-David-Fowler-Demonstrate-SignalR)
and another that I can't find the URL for atm, I thought I'd go with 'groups' as the concept to keep messages flowing to the right people.
I implemented IConnected, IDisconnect as I'd seen in one of the videos, and upon debugging I can see Connect fire (and on reload I can see disconnect fire), but it seems nothing I do adds a person to a group.
The signalR documentation suggests "Groups are not persisted on the server so applications are responsible for keeping track of what connections are in what groups so things like group count can be achieved" which I guess is telling me that I need to keep some method (static or otherwise?) of tracking who is in a group?
Certainly I don't seem able to send to groups currently, though I have no problem distributing to anyone currently connected to the app and implementing the same JS method (2 machines on the same page).
I suspect I'm just missing something - I read a few of the other questions on here, but none of them seem to mention IConnected/IDisconnect, which tells me these are either new (and nobody is using them) or that they're old (and nobody is using them).
I know this could be considered a subjective question, though what I'm looking for is just a simple means of managing the groups so that I can do what I want to - send a question from one hub, and have people connected to a different hub receive it - groups felt the cleanest solution for this?
Many thanks folks.
Terry
As you seem to understand, which groups a logical connection (user if you will) is in is something you the application writer is responsible for maintaining across network disconnects/reconnects. If you look at the way JabbR does this, it maintains the state of which "rooms" a user is in in its database. Upon reconnecting, a user's identity helps place the current connection back into the proper set of groups that represent the specific "rooms".

Resources