- Home /
Authoritative Server / Player Communication
I've recently decided to learn more about Networking. As a project, I've decided to make a very small scale MMO type game. No trolling, please. I know that I won't be able to make an MMO yet, so I'm creating a model of one. Maybe 10 players max, but I want the world to save after players leave, etc. My question is, to get the server to handle computing all players/npc's health, etc, would it be best to have a 'buffer script' that the Networkview is focused on. The server contacts that script and then that script sends messages to other scripts on the player, etc.
i.e. If a mob is attacking player. The mob tells the server it attacks, server calculates damage, sends damage to players middleman script, which sends it to the player's VitalsScript?
I'm asking because it seems NetworkView can only have one focus.
See about those technologies and similar
Smartfoxserver (paid & free license)
PhotonServer (paid & free license)
RedDwarf (free and opensource)
Boltengine (don't know)
etc.
I think it more interesting to implement one of those technologies and similar in your unity game, because you can encount some limits with the native networking of unity
This is going to be a shameless plug, and if you're not out looking to buy something then disregard this:
$$anonymous$$y networking engine (www.boltengine.com) solves pretty much everything that is hard about networking for you automatically, it will let you sync transform/animation and user-definable state for your players and characters without writing a single line of code.
Can be interesting but not totally free as SFS2X and Photon ...
http://www.boltengine.com/#purchase
Purchase Options
You can purchase a license for Bolt either directly from us through PayPal, or you can purchase it through the Unity Asset Store. Licenses purchased directly from us are subject to our own End User License Agreement, while licenses purchased through Unity are subject to the Unity Asset Store EULA. The benefit of buying from us directly is that you will be getting updates to Bolt a lot faster since they don't have to go through the asset store approval process, which takes about one week on avarage.
As long as we are going all self-promotion here, if you are looking for an EASY solution, check out u$$anonymous$$$$anonymous$$O: https://www.assetstore.unity3d.com/en/#!/content/13867
Answer by RetepTrun · Jun 17, 2014 at 03:44 PM
A middleman or make the player so all the scripts on him that need to be contacted with a network view are on thier own child for the server to find. I was never able to get my middleman script to work, no matter what type I used or how I tried to call a function broadcast or otherwise.
So I just cut down the number of scripts that needed communication to 2 and they are on thier own transforms for the server to find thier networkviews.
An example of what you might have trouble with. It will never print("name updated") . Still a mystery to me.
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class RpcBrancher : MonoBehaviour {
public List<Transform> scripts;
[RPC]
public void UpdateName (string name) {
foreach(Transform thing in scripts){
thing.BroadcastMessage ("UpdateName", name ,SendMessageOptions.DontRequireReceiver);
thing.SendMessageUpwards("UpdateName", name ,SendMessageOptions.DontRequireReceiver);
print ("name updated");
}
}
}
$$anonymous$$akes sense to me. Didn't really think of having child empties with the scripts attached. Thanks a lot.
Your answer
Follow this Question
Related Questions
Unity networking tutorial? 6 Answers
Should I worry about making an authorative server for an online multiplayer WebGL game? 0 Answers
Authoritative server basics Unity 5.2 0 Answers
Networking Help Needed 0 Answers
UNet Network Transform not Sync 1 Answer