|
Post by wesleywh on Dec 14, 2018 23:52:42 GMT
I did a quick test and was able to replicate your problem. I will look into this.
|
|
|
Post by wesleywh on Dec 15, 2018 4:35:26 GMT
I just drafted a new release that should hopefully fix your problems. Download version 0.4.2 and give that a try. Please tell me the outcome of this. Thanks for being patient with me!
|
|
|
Post by wesleywh on Dec 15, 2018 19:37:47 GMT
Been working on this a bit this morning and just got it so there are weapons showing across the network. Has a few bugs but it's a good start!
|
|
|
Post by ronnyrfa on Dec 15, 2018 19:44:14 GMT
Damnn good job Wes! Just tried the new release and everything works smoothly. --> prntscr.com/lves22
|
|
qu1nn
New vMember
Posts: 8
|
Post by qu1nn on Dec 17, 2018 21:36:22 GMT
This version 0.4.2 works really well. And the video tutorial answered a few questions for me.
For fun, I merged/copied the overides directly into the source files and everything works fine so far.
So, where did you end up Instantiating the weapons? I just started digging into this Invector source. There is a lot to filter through... this asset is pretty damn sweet.
-Qu1nn
|
|
qu1nn
New vMember
Posts: 8
|
Post by qu1nn on Dec 17, 2018 21:44:06 GMT
Hey Wes,
Just curious, do you need to serialize the variable before sending the RPC?
In reference to this. GetComponent<PhotonView>().RPC("ApplyDamage", RpcTarget.All, JsonUtility.ToJson(_damage));
|
|
|
Post by wesleywh on Dec 18, 2018 0:41:28 GMT
**On serialization** Yes. In that reference I think "_damage" is a custom class with many un-serializable parts (EX: Vector3, GameObject, etc). Now you can write a custom serialization method to fix this or use the ToJson is a way to get around having to do that. ToJson will turn that to a string, which is serializable, send it over and then use FromJson to convert the string back to its original class.
If you would like more details here is a link to Photon talking about it:
**About weapon instantiation** This is a bit of a beast but if you want to start looking into this that would be excellent. I will upload the raw files to github so you can have a reference, please note that these new additions introduce bugs I haven't fully figured out yet.
You will need to look at the "vMeleeManager" and "vShooterManager". I also create a new script that I attached to the "NetworkManager" gameobject to hold a reference to weapon names.
The proper way of doing this would be to spawn weapons based on their "id" but I haven't figured out a way to expose those in a way that I can use them. So when you call "SetRightWeapon" or "SetLeftWeapon" it will send a message across the network with the name of the weapon. Then I spawn that weapon by instantiating that found prefab. This way I don't have to modify every single weapon prefab to get them to spawn across then network.
If you looking for a more in-depth idea of what I am doing I am more than willing to give you more details. Otherwise this is a good start.
Here is a list of new files that I am using for weapon network syncing: * PUN_ItemManager (Attached to NetworkManager gameobject) * PUN_ShooterManager (override for vShooterManager)
* PUN_MeleeManager (override for vMeleeManager)
One final note. Those scripts that I just uploaded have no editor script at this point to set them up for you so if you are to jump into this you have to do it all by hand.
|
|
qu1nn
New vMember
Posts: 8
|
Post by qu1nn on Dec 18, 2018 3:34:14 GMT
Thanks for explaining the reason for using the JsonUtility serialization method.
I'll check out those new scripts as well. I'm use to doing it by hand, worked with Torque3D for many years...
-Qu1nn
|
|
qu1nn
New vMember
Posts: 8
|
Post by qu1nn on Dec 18, 2018 16:14:29 GMT
You may have already thought of this, but you could drop this script on a weapon prefab and set an id or name. Then access it through script. Or I am totally wrong about what you're trying to do :/
public class WeaponList : MonoBehaviour {
public enum WeaponName { Pistol, Rifle, SniperRifle } public WeaponName weaponName;
}
|
|
|
Post by wesleywh on Dec 19, 2018 0:43:11 GMT
That is one way of doing it. I could write an editor script to look through all the weapon prefabs and add that script to it (could be interesting/difficult). However, that means this isn't going to get created as part of the invector editor scripts making the weapon. For the average user this means there is a high probability of mistakes happening and not remembering to run that new editor script every single time a weapon is made.
I wanted to have something a little more universal that would just work without having to do something to every single weapon that might be or have been created. Doing it the way that I am doing it now means nothing needs to happen to any weapons generated through invector at all and they will be synced over the network. The only limitation is the weapon names.
I guess if we wanted to get technical you could essentially move all the weapons to the "Resources" folder and network instantiate them instead of just calling instantiate, but that gets messy... fast.
Now with all of that said I am more than happy to adapt things if you come up with a fluid solution that implements that script.
|
|
qu1nn
New vMember
Posts: 8
|
Post by qu1nn on Dec 19, 2018 14:21:27 GMT
Would the inventory system already have what you need? When I add a new weapon in my inventory I need to select it from a list. If I want ammo I add that as well. And when you create a new weapon you assign the model a weapon name, etc.
Might be possible to access the player inventory list directly for weapon names.
|
|
qu1nn
New vMember
Posts: 8
|
Post by qu1nn on Dec 19, 2018 20:47:48 GMT
Good thing I had made a backup of my original sources files. Last night I started messing with those new files you uploaded. Corrupted my third person camera source some how and couldn't fix it. LOL
I'm taking some smaller steps with these new files. I'll let you know what I come up with in a few days.
|
|
|
Post by wesleywh on Dec 19, 2018 23:25:27 GMT
I'm glad you made a backup. Ya, these files are not perfect or polished by any means lol.
The inventory is actually where I got my original idea or the id. If I can have an override for the inventory actions then this might be easier than sending an even on equip/unequipped actions.
However, this would only work for inventory based characters and not non-inventory based characters. So that's the main reason I have avoided that route.
|
|
qu1nn
New vMember
Posts: 8
|
Post by qu1nn on Dec 20, 2018 1:57:29 GMT
Oh, I see, you're trying to cover both options, didn't realize that. Well, that's going to be a bit tricky...
|
|
|
Post by darknubis365 on Dec 20, 2018 2:13:43 GMT
Im about to play around with this right now this making nice progress man wesleywh And what did i do wrong? Assets/UNetMultiplayerAddon/OverrideScripts/M_ThirdPersonController.cs(10,29): error CS0115: `M_ThirdPersonController.RandomIdle()' is marked as an override but no suitable method found to override
|
|