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.
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");
}
}
}