1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Custom ClientEvents In Multiplayer

Discussion in 'SimConnect' started by MacFarland Masterton, 7 Sep 2017.

  1. MacFarland Masterton

    MacFarland Masterton

    Joined:
    14 Nov 2015
    Messages:
    30
    Country:
    us-massachusetts
    Hi, I have a simconnect DLL and I'm trying to use simconnect_transmitClientEvent to send a client event to the same DLL loaded on another user's sim in FSX LAN multiplayer. I am using the code below, which does work locally. I can send and receive events between two DLLs, and between EXE and DLL on my machine - both the local clients receive the event. But I'd like to send an event to the other players' machines as well. Everything else in the multiplayer session seems to work fine, aircraft A:var animations, etc... Does anyone have any ideas as to where I'm going wrong? Am I just barking up the wrong tree - are client events not supported in multiplayer? that would be a drag... But client data areas definitely are, right?

    #define TEST_ID 1600
    void Init(){

    hr = SimConnect_MapClientEventToSimEvent(hSimConnect, TEST_ID, name);
    hr = SimConnect_AddClientEventToNotificationGroup(hSimConnect, TEST_ID, TEST_ID, mask);

    hr = SimConnect_SetNotificationGroupPriority(hSimConnect, TEST_ID, SIMCONNECT_GROUP_PRIORITY_HIGHEST);

    }

    void Transmit(){
    SimConnect_TransmitClientEvent(hSimConnect, 0, TEST_ID, 1, SIMCONNECT_GROUP_PRIORITY_HIGHEST, SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY);
    }

    Thanks so much as ever,
    Farley
     
  2. ddawson

    ddawson Resource contributor

    Joined:
    27 Sep 2006
    Messages:
    645
    Country:
    canada
    Have the dll open a SimConnect connection with the multiplayer server.
    Heads up - even though you are running in process on the multiplayer client machine, you will have to act like an external application for the connection to SimConnect on the server, ie, you have to call your dispatch function on a periodic basis, rather than once.
    Also, the server has to be correctly configured to accept outside connection requests. You will need to ensure that the settings in SimConnect.xml on the server match with the settings in SimConnect.cfg on the client machines.
    If you do all this right, when you use the TransmitClientEvent function over the connection to the server, all the multplayer clients who are also connected, via SimConnect, to the server, will also receive it.
     
    Last edited: 7 Sep 2017

Share This Page