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

Read or Modify sql through mastersever like sfs

Discussion in 'Multiplayer' started by noolza, Oct 13, 2009.

  1. noolza

    noolza

    Joined:
    Mar 6, 2009
    Posts:
    27
    Hello everyone! I want to discuss on the server-side access to sql problem. I am sorry my English is very bad please forgive me!
    use sfs access to sql like this :
    client use SendXtMessage() function to tell sfs what vars he wants get then sfs run a .as script to read sql and send(vars) to the client ,finally client use onExtensionResponse(vars) get his vars .
    use mastersever we can only use www to run asp or php file to read sql.
    I have studied a bit of code mastersever . I want to add some function what he like the code to access the database as sfs
    this my idea:
    client use RPC() funcion to tell mastersever what vars he wants get,mastersever get use's message through OnConnectionGraphRequest() function,then to read sql(I want to add those functions )and send() vars to the client finally ...I don't know how the client get the server message like sfs's onExtensionResponse(vars).

    Some word may be wrong hope to correct,I am honored that we can discuss this issue together!
    thanks!
     
  2. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    There is no Client to MAsterServer RPCing or alike.

    RPCs are Unity to Unity only
     
  3. noolza

    noolza

    Joined:
    Mar 6, 2009
    Posts:
    27
    Thank you for your reply
    How the client and server-side communication
     
  4. zumwalt

    zumwalt

    Joined:
    Apr 18, 2007
    Posts:
    2,287
    Some random thoughts for you:

    Master server only broadcasts and maintains server lists for clients to connect to, nothing more.

    That said, you create a game server using Unity and have this server sit on the network where the SQL server sits so that it can communicate with SQL, you can have this be the game server or another client attached to the game server.

    Launch sequence if not the game server:
    Game Server
    SQL Client Player
    Players

    The SQL Client Server is another player in the game, but ghost him so that other players do not "see" this SQL Client Player, this will however present you with a delay between the game server and the sql client server for database information. You will need to automate any send requests or receive requests to and from the sql client player.

    It is just easier to do all this in the Game Server itself though.

    You can send RPC commands directly to the Sql Client Player as if you were doing a direct peer to peer interface with that player through the game server, no more or less difficult than a chat window dedicated between 2 players in a multi player game, same concept.

    In this case, each player sends the RPC to a function on the game server that you write, this function then passes the information on to the sql client player and back, in the mean time you have the sender and the recipient so the information doesn't get lost or crossed back to the wrong player.

    Hopefully this isn't to confusing.
     
  5. noolza

    noolza

    Joined:
    Mar 6, 2009
    Posts:
    27
    thank you very much!
    From your reply I have learned a lot.

    It's a good idea!

    I still do not understand a question! if one player A start a server and B join it, now A is master B is guest . if A disconnect the server how to make B automatically become master and don't lost the connection. thanks![/quote]
     
  6. zumwalt

    zumwalt

    Joined:
    Apr 18, 2007
    Posts:
    2,287
    A delima with Unity to be sure, here is what you need to look into, the difference between Authoritative and Non-Authoritative server models. In the Unity Examples that you can download, you can get a hold of the network example project, this project contains both Authoritative and Non-Authoritative server models.

    You see, what you need to do, is setup an Authoritative model so that a player (the sql client player) connects up and is verified by the Authoritative game server. As long as this player is connected, then allow other connections. You can not use a model that is Non-Authoritative with a ghost sql player, well, actually come to think of it you can but honestly I would seriously not recommend it.

    You use a non-authoritative model for games like command and conquer, where any peer can be the controling server, however Unity doesn't support true failover without some work. What you are asking is a failover scenario, where player A drops but was the master game server in a peer game, and player B takes over as the master game server, which is what C&C did.

    You see, for this to happen, 2 components need to be co-existing / running at the same time, all peers 'must' be running as a server also, but also connect to a first in game server. This is not supported at current with Unity.
     
  7. noolza

    noolza

    Joined:
    Mar 6, 2009
    Posts:
    27
    thank you Once again!

    I am sure that unity will complete this part of the function :D