Announcement

Collapse
No announcement yet.

[network] Create custom login system

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [network] Create custom login system

    Hi, i'm new to UE4 and i'm trying to make a login system in a dedicated server / client model.
    Goal :
    User launch the client with a lvl_login
    Connect to the server by clicking a button
    Server check login IDs
    Server travel the client to the lvl_world

    I made the connection
    Code:
    void Anplayer::login(FString name, FString pass)
    {
        ClientTravel("127.0.0.1", ETravelType::TRAVEL_Relative);
    }
    Code:
    void Agame_mode::PostLogin(APlayerController* new_player)
    {
        Super::PostLogin(new_player);
    
        new_player->ClientTravel("/Game/nebula/blueprint/lvl_world", ETravelType::TRAVEL_Relative, true);
    }
    Only way i found to make it work is compiling the server with the ClientTravel and the client without it.
    - Why the client is calling PostLogin ? I read gamemode was only server side.


    If you have any good tutorial about this, it would be helpful.

    Thanks for your help.





    #2
    I tried to make 2 game modes too, don't know if this is a good way, but then how could i connect to the server with the game_mode after logging using the login_mode ?

    Comment


      #3
      Sorry just to make it clear: are you sure the client isn't authoritative?

      If you are 100% sure PostLogin should only be called upon the Server, then something is wrong, if not - say its just an event, expressed both for server and client, so each can handle its own logic according to the NET level - just run a series of boolean checks to ensure the appropriate client-only behavior.
      [On Hold]WIP: Vertex-Based Ledge Detection/Parkour Engine

      Looking for fellow programmers to develop a project.

      Comment


        #4
        Well i don't know how it's supposed to work, i'm new with game engines. There is different behaviours when i change the play options (single process, run as standalone game etc ..) so i'm totally lost. Sometimes level is loading, sometime it's not sometimes there is 2 client launching (but i set 1 client). Single process works when i don't launch the server from editor, i don't understand anything ..


        I saw for a login system, i have to check the IDs with an external database then connect to the game server, but how do i make the link between the database player ID and the game server ?

        Comment


          #5
          I assumed you would have some experience.

          GameMode only exists on the Server, therefore no necessary checks should be required... Are you sure the client is calling PostLogin? Do run a debug message on the function and see if it appears in your client.

          As for your second question, you will need a handler, ideally a main-server which handles login requests from each individual dedicated server. If you want however the dedicated-server to directly check the DB - not recommended - search the forums for SQL wrappers.
          [On Hold]WIP: Vertex-Based Ledge Detection/Parkour Engine

          Looking for fellow programmers to develop a project.

          Comment


            #6
            Well it depends how i launch the client. As i said there is different behaviours depending on launch options.
            For example, when i check autoconnect, postLogin is not called; if unchecked, postLogin is called.
            But i don't want to autoconnect, i want to login first then connect to the game server.

            Yes i will use a main-server. When the login success, i get the user id but how i pass informations to the game server ?

            Comment

            Working...
            X