I'm really curious to see what some other people think that have used the Multiplayer plugin, or knows a bit about coding MP games.
So I have player inputs working well, and I'm getting to the portion of the code where the enemies are coded. I'm curious on your guys' take or ideas on the best way to achieve this. I'll have plenty of different enemy types, but for now lets just stick with the traditional "run towards you constantly" variety. So far, I have this:
1. I basically set all the code for the enemies to behave the way they will (animations, triggers, etc.). However, ONLY the host determines when an enemy is active, and who the enemy is chasing, and then relays that message.
ie
if Host
[ul]
[li]Pick Nearest Player[/li]
[/ul] - If Zombie distance < 25, set Zombie.chaseTarget to Player.peerID
- Send MP Message (Zombie.instance, Player.peerID)
[ul]
[li]On MP Message, pick Zombie instance, set chaseTarget to peerID[/li]
[/ul]
[ul]
[li]For Each Zombie[/li]
[/ul] - Chase Player by peerID
[/code:wlf1lmmo]
It works. However, you will get slight differences depending on the latency of where that enemy is. But technically, it's all aesthetic. So if you're lagging like crazy; yes, it might look like you're friend is hitting air and killing an enemy on the other side of the screen every once in a while.
Truthfully, I don't know how else do this without tons of bandwidth.
Any other ideas?