1. Tubelator AI
  2. >
  3. Videos
  4. >
  5. Education
  6. >
  7. Building a Multiplayer Game with Fusion 2: Connection & Basic Movement | Part 1

Building a Multiplayer Game with Fusion 2: Connection & Basic Movement | Part 1

Available In Following Subtitles
English
Variant 1
Turkish
Variant 1
Posted on:
Video by: Photon Engine
Learn how to make a multiplayer game in Unity using Photon Fusion 2. Follow this tutorial series to create a first-person parkour racing game with unique abilities like grappling hooks and player interactions. Part 1 focuses on setting up connections, implementing basic movement, and accessing essential downloads.
tubelator logo

Instantly generate YouTube summary, transcript and subtitles!

chrome-icon Install Tubelator On Chrome

Video Summary & Chapters

No chapters for this video generated yet.

Video Transcript

0:00
Welcome to part one of this new tutorial series where we'll be using Photon Fusion 2 to build a multiplayer game in Unity.
0:07
If you haven't heard of Fusion before, it's basically a high-performance networking library which makes building multiplayer games in Unity simpler and more approachable.
0:15
By the end of these tutorials, you'll have built a first-person parkour racing game where your goal is for players to be the first one to reach the top of the course.
0:23
To help you achieve this, you have a grappling hook, the ability to shove or temporarily immobilize other players, and several other abilities.
0:31
In this first video, we're just going to set up the connection and implement basic input sampling and player movement.
0:37
While we're going to build all the mechanics and write all the game-related code in these videos, we will be starting from a starter project, which you can download from the Photon website.
0:46
You can also find downloads here for the state that the project is in at the end of each video.
0:49
The link to this page will be in the description, but note that you'll need a Photon account
0:54
to access the download.
0:55
Once you've downloaded the starter project, open it up, ideally with Unity 2022.3.19.
1:02
Inside, you should find Fusion pre-installed, along with the simple and advanced KCC addons
1:07
and the Fusion menu.
1:08
The various materials, basic prefabs, sounds, and other assets which we'll be using throughout
1:13
the series are also included.
1:15
In the main scene, you'll mainly see a bunch of UI elements, including the Fusion menu.
1:20
The game scene is pretty much empty, aside from a light, a post-processing volume, and a big plane for the ground.
1:27
Now first things first, you're going to need a Photon Fusion app ID.
1:31
To create one, go to your Photon dashboard and then click Create a New App at the top.
1:36
Make sure a multiplayer game is selected, choose Fusion as the SDK, and make sure the SDK version is set to Fusion 2.
1:43
Give your app a name and click create.
1:45
I already have an existing app ID so I'm going to cancel this one.
1:49
Once your app is created, copy the app ID and go back to Unity.
1:53
Open the Fusion Hub from the Tools-Fusion-Fusion Hub menu and paste your app ID into the text box.
1:59
you should see a green checkmark appear next to it.
2:02
With that taken care of, we can now set up the connection.
2:06
To do this, create a runner prefab and attach the network runner script to it.
2:10
Then find the menu game object in the scene
2:13
and assign the runner prefab to the menu connection behavior scripts field.
2:18
At this point, we could already run the game and create a room through the menu,
2:21
which would then instantiate a runner from the prefab we just gave it,
2:24
but there wouldn't be anything to see or do in it, so let's spawn some players.
2:28
Create a Player script and a GameLogic script.
2:31
For now, we're just going to remove the Player class's default Unity methods and make it inherit from NetworkBehaviour instead of from MonoBehaviour.
2:39
Our GameLogic class also needs to inherit from NetworkBehaviour.
2:43
NetworkBehaviour is something you'll use frequently when developing with Fusion, as it handles network properties and RPCs,
2:49
and provides a bunch of useful callbacks and other functionality which we'll be using throughout this tutorial series.
2:55
Next, add a network prefab reference for our player prefab.
2:59
We'll also need a network dictionary to keep track of players that connect, and we'll give
3:03
it the networked attribute to make it a network property.
3:06
This basically tells Fusion to replicate the property's value from the server or host client
3:10
to other clients.
3:12
The capacity attribute sets the absolute limit on the dictionary's capacity, and this can't
3:16
be changed at runtime.
3:18
I've set it to 12 because that's what I've set as the maximum number of players in the
3:22
Fusion menu config.
3:23
Next, we need to spawn players when they join and despawn them when they leave, which we'll
3:28
do by implementing the iPlayerJoined and iPlayerLeft callbacks.
3:32
To ensure that only the host initiates the spawning of players, we're going to check
3:36
if we have state authority before using the network runner's spawn method to instantiate
3:40
our player prefab.

Video Summary & Chapters

No chapters for this video generated yet.

Video Transcript

0:00
Bu yeni tutorial serisinin ilk kısmına hoşgeldiniz.
0:03
Burada, Foton Fusion 2'yi Unity'de bir multiplayer oyun yapmaya çalışacağız.
0:07
Fusion'u daha önce duymadığınız için,
0:08
bu basit bir yüksek performans netflik librasi,
0:11
bu, Unity'de multiplayer oyunları yapmak daha basit ve yakınlaşabilir.
0:15
Bu tutorialleri bitirince,
0:17
ilk kişi parkur ya da yürüyüş oyununu yapabilirsiniz
0:19
ve oyuncuların amacı, ilk kişinin kursunun üstüne ulaşmasına.
0:23
Bunu yapmak için yardımcı olduğunuz için,
0:24
bir kutu var, diğer oyuncuları tembellendirme veya tembellendirme yapabilmek
0:28
ve birçok diğer yetenekler.
0:30
Bu ilk videoda, sadece bir bağlantı kurmak ve basit input samplaması ve oyuncu hareketlerini implementetmek için yapacağız.
0:37
Bu videoda tüm mekanikleri yapıp, tüm oyunla ilgili kodları yazacağız.
0:41
Başlangıçta başlayacağız, Foton'un web sitesinden doldurabilirsiniz.
0:45
Ayrıca, bu videonun sonuncu bölümünde olan projenin kuruluşu için doldurulabilirsiniz.
0:50
Bu sayede link var, ama doldurulmak için Foton'un hesabını almanız gerekiyor.
0:54
bir sonraki videoda görüşürüz.
1:00
3.19. İçerisinde Fusion'u pre-installed'a katılmalısınız,
1:05
KCC adonları ve Fusion menüyü ile birlikte.
1:08
Tüm materyallar, basit prefabler, sesler ve diğer asetler
1:12
serisinde kullanacağımız olanlar da var.
1:15
Kulaklıkta, en önemli şey, UI elemanları,
1:18
Fusion menüyü de var. Oyun kutusunda,
1:21
ışık, post-processing volümü ve
1:24
bir büyük uçak var. Şimdi ilk olarak,
1:28
İlk olarak, Fusion App ID'yi kullanmanız gerekiyor.
1:31
Birini kurmak için, Foton Dashboard'a git ve
1:33
yeni bir app'i çevirmenin üstünde kliklayın.
1:36
Multiplayer oyununu seçin,
1:37
Fusion SDK'yi seçin ve
1:40
SDK versiyonunu Fusion 2'ye koyun.
1:43
App'i isim verin ve Çevir'i kliklayın.
1:45
Ben zaten bir existing App ID'yim var,
1:47
bunu kutlamak için çalışacağım.
1:49
App'iniz kutulduğunda,
1:50
App ID'yi kopyaladığınızda,
1:52
Unity'ye geri dönün.
1:53
Fusion Hub'ın Tools-Fusion-Fusion Hub'ın
1:56
ve App ID'ni text box'a koy.
1:59
Yerde bir ışık görmelisin.
2:00
ve bir şeklik ortaya çıkıyor.
2:02
Bunu yaptıktan sonra,
2:04
şu an bağlantıyı hazırlayabiliriz.
2:06
Bunu yapmak için, runner prefabı
2:08
ve netflik runner script'i ona takip edin.
2:10
Sonra, scene'deki menü oyun cihazını bulup,
2:13
runner prefabı menü bağlantı
2:15
behavior script'e takip edin.
2:17
Bu anda,
2:18
altyazıda alışkan bir yer
shape-icon

Download extension to view full transcript.

chrome-icon Install Tubelator On Chrome

YouTube First AI Assistant

chrome-icon Install On Chrome

AI Art For This Video No image generated for this video yet but here is the example.

ai art
0:09
Prompt
spider man in aladdin style, bright colors, hyper quality, high detail, high resolution, --video --s 750 --v 6. 0 --ar 1:2
ai images

Explore more in Education