playMaker

Author Topic: Enemies and props over a network - cloud vs dedicated server  (Read 2377 times)

joduffy

  • Full Member
  • ***
  • Posts: 121
  • Here to help
    • Online Playmaker Courses
Enemies and props over a network - cloud vs dedicated server
« on: December 15, 2013, 02:14:15 AM »
Hi,

I am trying to create props and enemies over the network using photon.

I noticed on this link:
https://hutonggames.fogbugz.com/default.asp?W860

Is says:
This example obviously is very simple and to the point, but the concept applied here is very important to grasp so that you can extrapolate on using this for a real projects, where you will need to instantiate ennemies and props.

I have looked on the forums and found this link:
http://hutonggames.com/playmakerforum/index.php?topic=5467.0

But could not find the action:
PHOTON / CUSTOM ROOM PROPERTIES CHANGED

So if I wanted to create enemies over the network. I would first use:
PhotonView component
PlayMakerPhotonGameObjectProxy component
Photon Network Instantiate

And then I would test to see if the enemy was already created? But how does it handle which player kills the enemy?

I was looking around and it looked like I would have to have a server which hosts the game and each player connects and can only control their character. All the enemies and physics/interactions would be handled by the server.

I am just tieing my head in nots trying to get my head wrapped around this. I have created a network version were I have player creating and joining rooms. My mind just turns to mush when thinking on the like of W.O.W or L.O.L based games.
- Jonathan

Online Playmaker Courses available at:
http://courses.jonathanoduffy.com

“I want the world to be a better place because I was here.”  -  Will Smith

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Enemies and props over a network - cloud vs dedicated server
« Reply #1 on: December 15, 2013, 05:21:10 AM »
Hi,

 What's W.O.W and L.O.L ?

PHOTON / CUSTOM ROOM PROPERTIES CHANGED is not an action, it's a global event, you are getting confused here. the action to set and get room properties are

https://hutonggames.fogbugz.com/default.asp?W1134
https://hutonggames.fogbugz.com/default.asp?W1116
https://hutonggames.fogbugz.com/default.asp?W1115
https://hutonggames.fogbugz.com/default.asp?W1114

Now, to create an enemy over the network, you simply need to have it as a prefab with a photonNetworkView attached to it, and instanciate it using the action "Photon Network Instanciate". That's your minimal requirments for this to happen.

Which player kills the ennemy is compute at the time of killing, during the killing, the bullet or the enemy will register the killing somehow, and the bullet or the enemy will have to find out the player reference, this has nothing to do with networking here, you can design this logic without the need for a network enabled game.

Can you describe why you want to know which player killed which ennemy? if it's for scoring, the logic can be implement on the enemy, on the player or on the bullet, but for all cases, I think you will need a "scoring Manager" that will listen to all the killing, and deal with score attribution. You woud have a global event "ENEMY KILLED" for example and the string  or int data of that event would reference the player. To have this networked, you can either fire that global event as a RPC event for example, so when a player is killing an enenmy in one of the running instances of your game, all other instances will catch this using thet "ENEMY KILLED" global event.

You do not need a dedicated server nor a headless unity instance running on a server, all this can be perfectly achieved using Photon Cloud.


 Bye,

 Jean