Tigase: MUG not implemented, what's next? - iphone

I'm starting the development of a multiplayer game for iPhone/iPad and i was thinking of using Tigase as XMMP server for the game server. However it seems like Tigase not yet implement MUG XEP. Anyway MUG is too complex for the simple task i'm trying to achieve so.
Here is the game basic:
Each Match may have up to 4 players.
Each player may perform at any moment a move and the only game rule is to forward a packet to each player in the match that tell the move the user mades and weither or not is is a good move or not.
Here is the way i want to implement it:
Reuse the MUC component to simulate the Multi-player room.
Each room will have a Bot member: all packet will me addressed to that BOT directly: the BOT will check the moves (which will be basic message packets) for validity and sent the appropriate message to all Player in the room.
I think this may work. If you think this is a viable solution:
What is the best way to write the BOT. Should i have one BOT per room? how can i detect when a new room is created so i can create the BOT?

Apparently, the most simple way to do this is to build a plug-in to the MUC component. The MUC and MUG components are very similar so it provide most of the mecanism a multiplayer game needs.

Related

Trying to understand Unreal Engine 4 replication

I'm trying to understand how to call events between client and server. My goal for now is simple. I want to create anything that is interactable for 2 players.
Easiest thing I could think of was cube that is switching color when clicked. So I did create actor based blueprint, checked "Replicates" and AlwaysRelevant to be sure. PlayerController is also replicated and there is no pawn needed.
Color change blueprint:
SM is just static mesh if that is important. As far as I know client have no authority to call multicast events so I wanted to push it through server but it stops there. Called from server works as expected and color itself IS replicated to client, however client cannot change color himself.
What am I missing in this concept? I've watched like 5 videos about replication and I started to think there is something missing which is either obvious for everyone but me or their examples do not need things I do here.
As you've found out, a player's client can not directly call server RPCs on actors which the player does not own. Calls must be routed through that player's PlayerController. The server copy of the player's PlayerController can then call server methods on server-owned actors.
Another issue is that you seem to be using both RPCs and replicated properties for the same purpose. Unclear to me why changed is replicated since you're modifying it in a multicast event which normally runs on all the machines. This is a recipe for hard to find race condition bugs.
Replication in Unreal is definitely one of the harder concepts to get the hang of. The resource that helped me the most is this guide which while quite dated, is both comprehensive and to the point.
You can't have it in PlayerController, it's got to be in a Pawn, or if not, in PlayerState, or it won't get shared to other clients.

How to synchronize a 1v1 realtime action online mini game?

What I'm trying to make
Hi, game development newbie here. The game I am trying to make is fairly simple. It's almost exactly like the old FC game "Ballon Fight" except that I'm trying to make it online where players can go through a match making to find opponents.
BalloonFight:
What I Read
I have read some articles, and found most of them lead to two approaches:
Put all game logic on the client, and the client sends player inputs to server on every frame update. The server acts like a dispatcher which only makes sure player A's input is received by both client A and B. My understanding is that if we see the client in this case as a pure function, and if the two players' inputs are received by each other, the game should produce same results on both clients. Thus synchronization is achieved.
Put all game logic on the server, and let the server do the calculations and send back results to both clients. In this case, clients only worry about displaying.
My Fears
Solution 1 sounded like a simpler one to me, but immediately I realized when network problem is put into account, it becomes incredibly complicated. Losing player A's connection for a few seconds means all the input is lost in that period. What I can guess is, to counter that, the server has to detect whether player A is lagged out and accumulate input from player B until player A is back then feed all the accumulated input to player A's client. Player A's client then need to do a fast forward to catch up. This sounds like there's huge amount of infra work on both client side and server side.
Solution 2 on the other hand looks very daunting to me, since for now I have only written some games on the client side.
My questions
in order to make a simple online game like this, what is the most beginner friendly way to synchronize game state?
if I were to use solution 1 stated above, is there any framework that provides such infra so that I don't have to handle network issues all by myself?
In advance, thank you game dev gurus.

How to display each player's score [Network Manager]

I am working on simple multiplayer (2-player so far) game based on built-in Network Manager (based on this great tutorial https://unity3d.com/learn/tutorials/s/multiplayer-networking) and I have absolutely no idea how to solve my problem. Every tutorial I found about scoring systems was focused on local multiplayer game (not using Network Manager).
My question is:
How to display both players score on each player's UI in format like [Player1Score : Player2Score] if I store player's score in their instance of player's prefab (as a field).
I would like to display the scores in any way, as separate or as one appended string (UI text).
Any help and ideas are welcome!
Cheers!
Well basically , as far as i know , you firstly need a controller (server side) which keeps the score.
Then through Syncvar and RPC you can propagate to clients the score you need.
The logic there is at your choice , for example you might use delegates everytime a point is scored (it will depend on your game), and synchronize the variable.
https://docs.unity3d.com/Manual/UNetActions.html
I do not know what your case is? But can I suggest using Socket to transfer data between client and server. From there it is possible to display each side's scores to the opponent.
Via https://learn.microsoft.com/en-us/dotnet/api/system.net.sockets.socket?view=net-5.0

The same GameObject accessible by two players in Unity Networking (UNT)

Anyone know, or have some ideas, how to have a GameObject in Unity3D Multiplayer (UNT) that is accessible for two player. What i want to do is to have an object that can be dragged from both players.
I have been looking at tutorials and read documentation but have not yet figured out how to solve this.
I used a simple workaround, I made three GOs (one that is being moved (main one), and two GOs that just receive informations from two players). When one player drags main GO on their screen their GO sends info to corresponding GO on other screen, it receives information and moves the main GO, same thing happens with another player. (I did this in Photon)
Most of the multiplayer engines don't support two way communication, so you have to create two one way communications to simulate one two way communication.

Unity - trading card game architecture

I'm trying to develop a TCG(trading card game) in Unity(I'm Unity newbie) and currently stuck on the architecture of the project and the card effects in particular. Coming from web development background for me all the logic and card effects should be on the server but going through some tutorials for Unity I think the logic should be on the client and I should use a simple room-based server to notify for player actions. Is that correct?
To summarize - where the game logic should be(e.g. card effects, rounds etc)? On the client or on the server?
I actually worked on one of the major TCG's out now for iOS/droid, so this is coming from experience. You definitely want all game logic and rules to be on the server. Do not trust your client to be the source of truth for any game outcomes etc. People will be able to hack that by tampering with the data sent back to the server. They don't have to decompile the game to do that, it can be done merely by sniffing the net traffic.
That said, you may end up with some duplicated logic on both client and server, only so that you can enforce game rules and display the outcomes without always hitting the server. However, your server is always the source of truth and the client is just there to accept input and display outcomes.
The general flow was the client would send a message requesting a new game to the server. The server would respond with the cards for each side and the opening move for the first player. Then the client would simply parse each move and display the outcome. On the cards objects we had methods for many of the actions, such as DrainHealth() and BuffAttack(). When called, these methods would trigger things like particle effects and sound fx attached to the card script.
Yeah the effects should be on the client, I assume your game will be turn based right? You might want to take a look at photon then:
https://doc.photonengine.com/en-us/realtime/current/getting-started/realtime-intro
They have a loot of good tutorials about their API and it's well documented :)
Hope that helps you,
good luck