Setup photon on Amazon EC2 Servers

Hi, I hope you all are doing good.

Today I launched a windows EC2 instance on amazon aws servers.

I followed the documents to get the server running but I don't know how to get the server and port address for my client game.

I really don't know how to get the server running.

Please if anyone has successfully done it on amazon EC2 servers tell me step by step how to do it.

by the way my game works fine on photons servers.

Thank you.

Answers

  • hi, @AmirRahmani

    first set local IP address, copy client on your machine and try to get it working.

    'LoadBalancing (My Cloud)' menu you will find sub menu items to start/stop photon or to install it as service.

    Once it is working locally set Public IP of your server and try to access your server using your laptop/desktop

    best,

    ilya

  • Hey. thanks for your reply.

    when I start as application it will start but it won't get me a public ip.

    and when I click on set public ip it says: Object reference not set to an instance of an object

    I don't know what to do and I am REALY CONFUSED. Please Help me.

  • JohnTube
    JohnTube ✭✭✭✭✭
    edited November 2021

    Hi @AmirRahmani,

    Thank you for choosing Photon!

    There is a known issue in PhotonControl in v5 RC1 that will be fixed in upcoming v5 Final (ETA: soon).

    You need to configure the GameServer IP manually:

    In "deploy\LoadBalancing\GameServer\bin\GameServer.xml.config"

    change "PublicIPAddress" setting value to your public IP address.

    restart or start server and try again.

    Otherwise here are our Photon Server hosting on AWS EC2 steps.

    Sorry for the inconvenience and for the confusion.

  • Thanks for your reply @JohnTube

    I changed the "PublicIPAddress" setting value and followed the Photon Server hosting on AWS EC2 steps.

    I don't know what to and I really wish the  v5 Final comes out soon.

  • Hello there again.

    I think I made some progress. I was able to connect to the nameserver but there is this error about regions:

    please help me. Thank you

  • JohnTube
    JohnTube ✭✭✭✭✭

    Hi @AmirRahmani,

    Please follow steps here to connect to Photon Server SDK v5.

    Change port to 5058 to connect to the NameServer.

  • AmirRahmani
    edited November 2021

    Thanks @JohnTube

    I was able to make a stable connection to the server but there is this problem:

    I can't create a room. These are the logs:


  • Hello there again.

    I couldn't get it work yet.

    I guess I am going to make my own networking system or use something else.

    Thanks anyway

  • JohnTube
    JohnTube ✭✭✭✭✭
    edited November 2021

    Hi @AmirRahmani,

    The logs are a bit confusing and too verbose.

    The important entry is "Failed to get server instance".

    it means the master server cannot find a game server.

    so somehow in your setup/config the game server cannot register itself with the master server.

    The other PUN related logs are misleading because they are probably about local client.

    Not sure how to reproduce the errors though and they are unrelated to the main problem of not being able to create a room and connect to a game server.

    Also the warning is about trying to 'connect' (initiate first connection) while already connected to master server.

    So, I would first solve the problem of game server - master server connection.

    I would check server logs, open logs using PhotonControl shortcut and see what's wrong.

    Are you hosting all server apps on the same machine?

    How did you configure GameServer's PublicIPAddress? private or public address?

  • Hey @JohnTube

    I used photon server SDK v5 and it didn't detect my public IP so I changed the "PublicIPAddress" setting value In "deploy\LoadBalancing\GameServer\bin\GameServer.xml.config" and in the unity editor I changed the port to 5058 and I had a "connected to nameserver" message. So my game connected to the server but failed to create room.

    I tried the photon server SDK v4 but still the same result. but in the v4 it detected my public IP automatically.

    I guessed about "it means the master server cannot find a game server." but I don't know how to fix that.

  • hi, @AmirRahmani

    please share with us server side logs. they are in deploy/log folder.

    By default GameServer looks for Master on the same machine. it uses address 127.0.0.1 to connect to master. it looks like it can not connect. But I will be able to say for sure only by checking logs.

    Please attach also your PhotonServer.config file


    best,

    ilya

  • Hello @chvetsov

    Here are the logs and the PhotonServer.config file.

    I tried v5 and v4 both.


  • @AmirRahmani you have sent me wrong logs. I asked from deploy/log folder. you should see there something like Game.log, Master.log and so on

    best,

    ilya

  • @chvetsov Sorry.

    Here are the logs. I hope this is the right one :)


  • hi, @AmirRahmani

    It looks like you misconfigured game server. Lets' learn some things.

    Look at the GSGame.log. you will see

    2021-11-30 07:44:15,100 [10] WARN Photon.LoadBalancing.GameServer.MasterServerConnectionBase - s2s MS connection: connection failed:3.....45:5058., errorCode=121, msg=The semaphore timeout period has expired.. Skipped:1

    this means that GS failed to establish connection to master. look at the address. it tries to connect to port 5058. First this is udp port and second this port for NameServer (according to PhotonServer.config).

    Port for S2S communication is 4520. Find it in PhotonServer.config and read comment.

    Please send me GameServer.xml.config. I'll check it

    Last note is that your log has debug messages. It is ok for development. but may dramatically slowdown server on production.

    best,

    ilya

  • Hey @chvetsov

    Thank you so much for your help.

    Problem fixed successfully.

    I was able to connect to the server and create rooms.

    The problem was GameServer.xml.config.

    I will contact you if there was any problem again.

    Thanks again.

  • Hello there again.

    I could manage to connect to the server but some of my players couldn't connect to the server.

    The strange part is when they use VPN it will connect(if they don't use VPN the it will be connect and disconnect fast). the player who experienced this is from US and I don't think it's because of his country.

    is it the photon or the Amazon. How am I able to fix this?

    Thank You.

  • hi, @AmirRahmani

    I can not help you here. I at least should take a look on logs.

    I would say if client does everything correctly photon should not disconnect it.

    may be there is some issue with VPN service it self, if it works correctly without


    best,

    ilya

  • Hi, I am using photon server host on AWS but it not working. I tried on local machine it work but when i put it on server (AWS-Windows machine) it not working. Also i put my server public IP address on GameServer.xml.config and restart but it not working. Please help me.