So I have an AI which finds the closest player to it and then moves towards this player.
How do I sync this over the network?
I’ve Tried:
Putting NetworkView on The scripts and transforms of the enemy
What do you guys think?
The network spawns the enemies as a Network.Instantiate
EDIT: How would I run the AI’s main function just through the server? and would this main function accommodate for other Players? does this use an RPC?
if you have three or four iPads connected and playing, only one is the “boss” iPad. do all calculations on that one. the others are just puppets.
BTW never use network instantiate for any reason, and never use the “first, stupid” version of RPC.
An important linguistic note: One usually calls it the “server” but that is very confusing because new readers think it means like a server on the internet … indeed, sometimes/often with MP games YOU DO INDEED USE a server on the internet … but that’s a whole other issue.
You say …
“As it stands now (without changes I wish to implement) my GenDungeon function uses Network Instantiate to generate the dungeon (I see that you do not recommend this and I think ill make that whole function @RPC and use an RPC to generate it, correct me if I’m wrong).”
DEFINITELY CORRECT. Create your dungeon on the Boss computer. then, very simply send it to all the others. Your “puppet” machines will have a function along the lines of: “HavingReceivedPlansForADungeon-FromtheBossMachine-BuildADungeonLikeThatHere()”
Don’t forget too … in reality it will be something like HavingReceivedPlans-ForADungeonFromtheBossMachine-BuildADungeonLikeThatHere-AndThenLetTheBossKnow-ThatIHaveFinishedDoingThatSuccessfully()
Of course then you need to carefully consider what happens if you don’t hear back from the puppets, etc etc etc etc
MP is always more complex than you can imagine :-/
if you have more questions on that when you get to it, ask a new question!