Announcement

Collapse
No announcement yet.

2 player no server?

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

    2 player no server?

    Hello hello!l Friendly noob here! I have a chessboard type of game. Want to know how to make it 2 player with no server. So 1st player takes control of one side and 2nd player takes other. I know player controller and swithing the number has something to do with it. Just don't know where to set this up. My menu system lets player pick sides but I can still pick other players pawns when playing either side. It would be great to have 1st player pick his side and 2nd automatically get other. If anybody can give me a simple example of something like this to get me started, or a better idea, I would appreciate it. Thank you

    #2
    2 player no server -> I guess you don't want both player in front of one computer, do you? If so, i can't help on that point.

    2 player on 2 different machines -> you need a server anyway, but it could be one of the two clients that acts as a server. That's called a listen-server (search for it).

    To handle 2 player and give them a seat -> I'm using 2 "player start" objects (search), one on each side of the board, both rotate towards the board. The player start object has a "player start tag"-field and it's read- and writeable. Set the values to 1 and 2. Although you need a var-int playerNumber in your custom player controller and/or in your custom player pawn blueprint.

    - When a player joins you have to call a server function ("remote procedure call") to loop over the player start objects and choose the first one with a value == 1 or == 2. Change the value to something else. Return the number and the player start object to the client.

    - You can now use the position and rotation of the player start object to place you player camera or pawn on one side of the board.

    - The last step is to set the var "playerNumer" to the returning value of 1 or 2.

    To handle your chess-pawn actors -> give each of them a var playerNumber (value 1 or 2) as well. Whenever your player (or your game logic) interacts with one of your chess-pawns you have to check against the player number. If the player clicks you can excess the player controller and the player number, and so on.

    Sorry, but English is not my first language. Hope you have enough to look up and get started.

    Comment


      #3
      You still need server for split screen situation? How do you handle a 2 player game on one console?

      Comment


        #4
        As I wrote in my first sentence: this is nothing I can give you any advice.

        I guess this game type is called local multiplayer.

        A quick search result may help: https://answers.unrealengine.com/que...-game-ins.html

        Comment


          #5
          Technically, regardless of singleplayer, multiplayer, splitscreen, or dedicated. You still are going to have a server in one way or another. When you're playing a Singleplayer game your computer acts as a server of information, when you play splitscreen you're still the server. It's just a "local" server and you don't need to worry about information being sent over the internet.

          As far as what you're trying to do, without any indication of what you're already doing it's hard to give you a better idea,. There are multiple ways to approach this. It'd be best to only let Player 1 control the menu, and when he selects his side, then the game takes Player 2 and assigns him to the opposing side. But again, without knowing how you're trying to do any of this I can't really say.
          Pocket Sized Animations

          Comment


            #6
            Hey Irish! So how would you set up the way your talking about? This is kinda what I was getting at in my first post. I have no characters, no pawns, and my cameras are fixed. Its a point and click type of game and each player would get there own cam, and I would like the 1st player to control one side of the pawns and 2nd player control other. If I need to set up server settings how would I accomplish this? Does player controller have anything to do with this? I know you can set player index or something somewhere.

            Comment

            Working...
            X