Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Please, I need help in my 3D FPS called "Lordliness: Polish Soldier".

Discussion in 'Scripting' started by szumski_krzysztof, Jul 10, 2021.

  1. szumski_krzysztof

    szumski_krzysztof

    Joined:
    Jul 10, 2021
    Posts:
    2
    I tried to make a game in Unity Engine, but I don't know a lot of this and i tried to use a tutorial and i search in YouTube "jak zrobić grę typu csgo w unity" (in polish how to make game like csgo in unity) and then I watched the tutorial, I made the main menu without interruptions and then came Photon Networking and map what broke everything. So, theres a code BUT first, this is called MenadzerPolaczen.cs (connection manager in polish, poland is my homeland :D). And Unity say me (I programming in Visual Studio 2019) this error "Assets\__Skrypty\MenadzerPolaczen.cs(54,18): error CS1513: } expected". Please don't say me like "fuction cannot be there" or something, just please say me what letter I need put where.
    The code:


    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. /// <summary>
    6. /// Skrypt odpowiadający za łączenie się z serwerem (oraz rozłączanie się i utratę połączeń)
    7. /// </summary>
    8. public class MenadzerPolaczen : Photon.MonoBehaviour
    9. {
    10.  
    11.  
    12.     void Start()
    13.     {
    14.  
    15.     }
    16.  
    17.     void Update()
    18.     {
    19.  
    20.     }
    21.     public void Polacz()
    22.     {
    23.         PhotonNetwork.ConnectUsingSettings("PreRealese1");
    24.  
    25.         void OnGUI()
    26.         {
    27.             GUI.Label(new Rect(0, 0, 200, 20), PhotonNetwork.connectionStateDetailed.ToString());
    28.  
    29.  
    30.         }
    31.         void OnJoinedLobby()
    32.         {
    33.             SceneManager.LoadScene(1);
    34.  
    35.  
    36.             void OnPhotonRandomJoinFailed()
    37.             {
    38.                 PhotonNetwork.CreateRoom(null);
    39.             }
    40.  
    41.             void OnLevelWasLoaded(int level)
    42.             {
    43.                 if (level != 0)
    44.                     PhotonNetwork.JoinRandomRoom();
    45.  
    46.  
    47.                 void OnPhotonPlayerConnected(PhotonPlayer pp) { }
    48.                 if (PhotonNetwork.isMasterClient)
    49.                 {
    50.                 }
    51.  
    52.                 void OnPhotonPlayerDisconnected(PhotonPlayer pp)
    53.                 {
    54.                 }
    55.  
    56.                 void GraczWszedl(PhotonPlayer pp)
    57.                 {
    58.                     void GraczWyszedl()
    59.                     {
    60.  
    61.                     }
     

    Attached Files:

  2. exiguous

    exiguous

    Joined:
    Nov 21, 2010
    Posts:
    1,749
    Making a multiplayer game without ANY programming knowledge is not the wisest choice. You SHOULD REALLY start with something simple.

    If you want help in an english forum it would be wise to code in english.

    If this issue is Photon related maybe you should ask in their forum?

    If you struggle with syntax do some general C# programming tutorials first. For example the C# Yellow Book by Rob Miles.
     
  3. Yoreki

    Yoreki

    Joined:
    Apr 10, 2019
    Posts:
    2,605
    Please check your {curley brackets} placement. Follow your tutorial closely. They are not the same.
    Each opening bracket defines a scope until the closing bracket it belongs to (usually easily identified by the indentation). There should be as many opening brackets as closing ones, but that's not all either. For one, your class has no closing bracket. But there is also local functions inside local functions inside local functions here.. which i highly doubt is correct. So make sure you copied it correctly.

    Secondly, a forum is for exchanging opinions and discussing problems. Not for people to fix your typos or misplaced brackets for you. Lines like
    also only make the impression that you dont actually want to learn how to programm, but instead want the finished product with the least amount of effort possible. Which comes off as lazy. Sorry if that is not your intention, but that's the impression comments like that easily leave.

    Thirdly, if you are a programming beginner start with something super easy. Dont just jump into a multiplayer shooter and expect to learn anything from it. This is far over what you should tackle currently. You will eventually get there, but start with the basics. There are great beginner tutorials on youtube. Some noteworthy channels are Sebastian Lague (Beginner GameDev Series) or Brackeys.

    Last but not least, consider coding in english. This may be a minor annoyance to you, but it helps improve readability and with that maintainability of your code. After all, the API you use is in english already. So mixing it with polish just results in something hard to comprehend. Not to mention that most polish words will be equally understandable to non-polish people as if you named all of your variables and functions "a", "b", "c", .. and so on. Variable names help immensely to navigate code efficiently and understand what it's supposed to do. If you ever expect anybody except for you to read your code, code in english. And if you ever need help with something and post your code in a forum, then this definitely applies. If people cant easily understand your code, you wont receive help. That's just how it is. If people understood how to solve some math problem you had, but the question was formulated in spanish, people wont bother to translate it in order to be able to help you. This is even more true for code :)
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,520
    That's not how engineering works.

    If you are serious and want to do this, start small and work with beginner tutorials. What you are trying to do is ULTRA advanced and hard.

    Here are some great starting points:

    Imphenzia / imphenzia - super-basic Unity tutorial:



    Jason Weimann:



    Brackeys super-basic Unity Tutorial series:



    Sebastian Lague Intro to Game Development with Unity and C#:



    Imphenzia: How Did I Learn To Make Games:



    How to do tutorials properly:

    Tutorials are a GREAT idea. Tutorials should be used this way:

    Step 1. Follow the tutorial and do every single step of the tutorial 100% precisely the way it is shown. Even the slightest deviation (even a single character!) generally ends in disaster. That's how software engineering works. Every single letter must be spelled, capitalized, punctuated and spaced (or not spaced) properly. Fortunately this is the easiest part to get right. Be a robot. Don't make any mistakes. BE PERFECT IN EVERYTHING YOU DO HERE.

    Step 2. Go back and work through every part of the tutorial again, and this time explain it to your doggie. See how I am doing that in my avatar picture? If you have no dog, explain it to your house plant. If you are unable to explain any part of it, STOP. DO NOT PROCEED. Now go learn how that part works. Read the documentation on the functions involved. Go back to the tutorial and try to figure out WHY they did that. This is the part that takes a LOT of time when you are new. It might take days or weeks to work through a single 5-minute tutorial. Stick with it. You will learn.

    Step 2 is the part everybody seems to miss. Without Step 2 you are simply a code-typing monkey and outside of the specific tutorial you did, you will be completely lost.

    Of course, all this presupposes no errors in the tutorial. For certain tutorial makers (like Unity, Brackeys, Imphenzia, Sebastian Lague) this is usually the case. For some other less-well-known content creators, this is less true. Read the comments on the video: did anyone have issues like you did? If there's an error, you will NEVER be the first guy to find it.

    Beyond that, Step 3, 4, 5 and 6 become easy because you already understand!