Let’s get into a room quickly: The PhotonNetwork class has a JoinRandomRoom() method. It’s called when PUN gets you into the lobby. One of the callback methods in PUN is OnJoinedLobby. Type PhotonNetworkingMessage, followed by a period character (a dot), and a dropdown will list the names and a description. So autocompletion in MonoDevelop can give us a quick hint which methods our script might have. There is also an enum with all those method names in code. The list of methods PUN will call can be found in the documentation. Currently, we are interested in something like “arrived in the lobby” or “found a room” and “didn’t find a room”. Like Unity, PUN will call certain methods in our code when something interesting is happening. This makes it easier to find the scripts later on and we don’t rely on the camera being active all the time. ![]() We create a new, empty GameObject and name it “Scripts”. With a minimum of GUI, the code looks like this: ![]() If started this would get us connected and into the lobby. The gameVersion should be any short string as identification for this client. This will read our settings and use them. We did the setup with the Wizard, so we can use PhotonNetwork.ConnectUsingSettings() and pass “0.1” as gameVersion. It’s similar to Unity’s Network class and contains almost all methods we’re going to use. The most important class in the PUN package is called PhotonNetwork. Create a folder “Marco Polo” and a new C# script: “RandomMatchmaker”. The Photon Cloud is built with “room-based games” in mind, meaning there is a limited number of players (let’s say: less than 10) per match. Even though Photon Cloud is not completely free, the costs are low, especially compared to regular hosting, and you can find subscriptions available on the Unity Asset Store . Servers are added on demand, so any number of players can be dealt with. This “cloud” of servers is maintained by Exit Games and offered as hassle-free service for your multiplayer games. So, what exactly does this “Photon Cloud” do?!īasically, it’s a bunch of PCs with the Photon Server running on them. Click “Setup” in the Wizard and copy & paste the app ID”. If the address is known, we registered it before fetch our “app ID” from the account page. For now, we just enter our mail address and the Wizard does its magic: If the mail address is unknown to the Cloud, we will get an “app ID” right away. You can use the free 30 day subscription without obligation. During import, un-check the “DemoWorker” folder (and the complete sample). Get the Photon Unity Networking package from the Asset Store. ![]() Best of all, it comes with a 6 month, 100 CCU cloud service subscription! If you like the workflow, you can get the free intro package , including one month of hosting, or you can get a running start with the comprehensive Photon Networking Guide, a starter kit with in-depth tutorials by expert Unity educator and author of the Ultimate Networking Tutorial, Mike Hergaarden. In this tutorial, Exit Games developer Tobias Schweers explains how to use the new Photon Cloud multiplayer network service to create a fun game inspired by the classic children’s game, Marco Polo.Įxit Games是Unity开发圈内外的高性能网络多人服务器和托管解决方案的知名提供商。 在本教程中,退出游戏开发人员Tobias Schweers解释了如何使用新的Photon Cloud多人网络服务来创建一款受经典儿童游戏Marco Polo启发的有趣游戏。 Exit Games is a well-known provider of high-performance network multiplayer server and hosting solutions both inside and outside the Unity development circles.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |