You are on page 1of 7

Oliver's work introduction:

We have only two scenes now:

SelectorScene: the menu and hero selector


MultiplayerTestScene: (works for Offline / Online and practice map)

Player.cs:

We have 6 players for default, they must be located in Resources folder (Photon
requirements)

They are instantiated by name so they must be named “Player” + index ( from 0-5)

Those 6 prefabs that I created are the same, so you can just modify them later.

The player prefab must have ( in case you want to create the prefab from scratch, if you only
want to modify the existing prefabs, ignore this ):

1. Photon View – Component


In ObservedComponents you have to drag and drop the Photon Transform View
component

2. Photon Transform View – Component

Check the box inside “Synchronize Options”

Exactly like this:


The “CharacterModel” is the one who will rotate and run animations, so we have to
synchronize them:

Add a Photon Transform view, but this time check the box “Rotation”

Add a Photon Animator view, and put “Continous” to the animations that you want to
synchronize

Add a Photon View component and add to “Observed Components” the previous added
components

Like this:
In the Main Camera inside the Player prefab, I created the “CameraFollow” script.
In Player.cs at the start method, I set the parent of the camera to “null” so the camera can
follow smoothly the player, instead of being inside of the player in the hierarchy.
You can notice how necessary is this if you're spectating another player in online multiplayer,
it won't look smooth if you put the camera inside of the player.

If you don't want this, just remove “Camera Follow” from the Main Camera, but I don't
recommend it.

Some Photon View components have no observed components but you can't remove them
because they are required to do other tasks.

Projectiles:

All projectiles must have a Photon View to be spawned across the network.

In all projectiles script, in the Update method, you have to add this code:

if (!owner)
Destroy(this.gameObject);

“owner” is a variable used in all projectiles script, so I guess you'll follow the same structure
for all different type of projectiles abilities.
The purpose of this line is to destroy automatically the projects thrown by players who left the
room in the middle of a battle or pvp.

In “OnTriggerEnter” method, you have to check if the projectile collided with something with
tag “NotShootable” and in that case, ”return;”

To avoid destroying projectiles when they collide with triggers.

Example: if (other.gameObject == owner || !inited ||


other.CompareTag("NotShootable")) return;

The damage is done through a RPC method in online rooms, so the damage is syncrhonized,
since the one who detects if the projectile damaged someone or not, is the Master Client (“to
avoid hacking”)

All projectiles and everything that will be spawned across the network must be located in
“Resources” folder.

Camera:

You must go to Camera component – Rendering – Depth Texture – and change it to “On”

like this:
So you can see the “Fire Circle” properly with his effects and shadows.

Fire Circle:

I bought an asset for this, you can find it in “Oliver's work – Bonus Assets “

It's well documented and I think their document will help you more than my explanation of that
asset.

In game scene: “MultiplayerTestScene” :

ZoneTimerCanvas gameobject, is where the waiting time for shrinking zone is displayed.

CurrentSafeZoneVisualizer gameobject is the fire circle itself, and you can change the
materials from it to change the color etc.

Zone is the gameobject where everything is controlled, the zone delay, shrinking time, etc.

Also, from that script, zone events are called:


Level Manager gameobject:

There is controlled the multiplayer gameplay.

In Multiplayer Level Manager you can set up how much damage will the storm do per second.

In case you want to add more Environments:

Add the GameObject with your environment to the scene

Create the Team A and Team B spawnpoints wherever you want.

Create the Ultimate Orbs Spawn Zone (it's just a collider, they will spawn inside of that
collider)

Add all those references to MultiplayerLevelManager.cs inside the list of Environments

In Canvas – InGameControls

You can find the “LostOverlay” and “WonOverlay” that I created

To modify Ultimate Orb spawning go to LevelManager – Ultimate Orb Spawner

Of course, in multiplayer they are spawned by the Master client, as all multiplayer logic,
master client handles this type of game logic

The ultimate orb I created works like this:

SpawnVFX variable is automatically played when the orb is spawned.


After the particle system effect stops, I activate the “LoopVFX” variable gameobject.

That's what I did to make it look “decent” using some effects that I imported.

Selector Scene:

At the start, the online buttons “Join 1v1, Join 2v2, Join 3v3” are disabled because you aren't
connected to photon, or if you left a game, it will be disabled while Photon gets ready to join
any other room.

In MP_Canvas we have all the new screens.


“Screen 1 (Connecting Screen )” gameObject is not used but I left it as an example in case
you want users to enter an username before connecting etc.

There are a few changes to “Hero Selector” script, we reference all the buttons to select
characters so they get disabled when other player chose it.

After “TimeToAutoSelect” seconds it will choose an available character for the player, so the
game starts and players don't get stuck at this screen while others are waiting for him to start
the game.

In Gameobject: “MP_Canvas” in the component “MultiplayerMenuManager.cs” all the UI


screens are handled.

“Loading Screen” gameobject inside of the MP_Canvas will block any clicks to the whole
canvas while it's active.

You might also like