Author Topic: Mixing Steam & RakNet calls  (Read 6787 times)

Starg

  • Not-a-newbie
  • *
  • Posts: 6
  • Karma: 0
    • View Profile
Mixing Steam & RakNet calls
« on: December 07, 2010, 09:31:04 AM »
Hi there,

I've noticed that not all the Steam matchmaking calls have RakNet equivalents. So is it safe to mix RakNet & Steam calls?

e.g. I want to send a message in a room from the owner to the client to say the game is ready to start.

This can be done using the Steam Lobby Member Data:
        SteamMatchmaking()->SetLobbyMemberData(blah blah)

Once the other player gets the update they can connect to the host (Using RakNet calls)

It looks OK to do to me, but I wanted to check here first. (Or am I missing a RakNet way of doing this? - I didn't want to use SendChatMsg)
Cheers,
Steve

Rak'kar

  • Administrator
  • Hero Member
  • *****
  • Posts: 6895
  • Karma: 291
    • View Profile
    • RakNet
Re: Mixing Steam & RakNet calls
« Reply #1 on: December 07, 2010, 11:34:02 AM »
It's fine. I only provided the lobby interface to make it easier to use Steam and provide a cross-platform way of doing things. The only actual integration takes place in the calls to SocketLayer code because Steam requires you use their own sockets.

Starg

  • Not-a-newbie
  • *
  • Posts: 6
  • Karma: 0
    • View Profile
Re: Mixing Steam & RakNet calls
« Reply #2 on: December 07, 2010, 11:48:19 AM »
Great.

Well I've got creating rooms and lobbies working under Steam. But I'm stuck on the correct way to connect up. I'm not sure I'm doing things in the right order, or I might be missing a step.

I've got the RemoteIP and PortAddress in the lobby to use in the Connect call (Like in the steam lobby example code)

Firstly I call the following to start things up:

            if(isHost_)
       {
             game->debugMsg("I'm a Server\n");
             peer->Startup(MAX_CLIENTS, &RakNet::SocketDescriptor(SERVER_PORT,0), 1);
       } else {
             game->debugMsg("I'm a Client\n");
             peer->Startup(1,&RakNet::SocketDescriptor(), 1);
       }


However, the Startup call fails when it creates and tests the socket way down in the code where it does a test send using the Steam API.

I've seen a function called PunchTarget(SteamID)  - should I be using this somewhere?

Let me know if I need to give you more info.
Thanks for the help
Cheers,
Steve

« Last Edit: December 07, 2010, 11:49:57 AM by Starg »

Rak'kar

  • Administrator
  • Hero Member
  • *****
  • Posts: 6895
  • Karma: 291
    • View Profile
    • RakNet
Re: Mixing Steam & RakNet calls
« Reply #3 on: December 07, 2010, 11:50:13 PM »
Just do what the sample does. In the callback Notification_Console_RoomMemberConnectivityUpdate you connect. I traced through the Startup() call and it worked here. I'd have to see more of the code to say more.

Starg

  • Not-a-newbie
  • *
  • Posts: 6
  • Karma: 0
    • View Profile
Re: Mixing Steam & RakNet calls
« Reply #4 on: December 08, 2010, 05:12:40 AM »
Right, I've got it working. I think it was going wrong because I was calling Startup after the Steam side was up and running. This causes SendTo to use the Steam version which was failing. (My bad)

One other thing though, the code was then crashing on an assert in the Steam::SendTo function because the number of bytes being sent was greater then 1200.

After a bit of digging I found the code that sets the MTU sizes:

#if defined(_XBOX) || defined(X360)

#elif __PC__
static const int mtuSizes[NUM_MTU_SIZES]={1200, 1200, 576};
#else
static const int mtuSizes[NUM_MTU_SIZES]={MAXIMUM_MTU_SIZE, 1200, 576};   <========
#endif

in my code the bottom line gets complied in. Should I have __PC__ defined? (if that's not a daft question). It's the only place that it's used and if I define it everything works great.

Thanks again!
Cheers,
Steve
« Last Edit: December 08, 2010, 10:21:17 AM by Rak'kar »

Rak'kar

  • Administrator
  • Hero Member
  • *****
  • Posts: 6895
  • Karma: 291
    • View Profile
    • RakNet
Re: Mixing Steam & RakNet calls
« Reply #5 on: December 08, 2010, 10:22:35 AM »
If you're using Steam you'll have to change MAXIMUM_MTU_SIZE to 1200. I'll make changes on my end to address this automatically in the next version.
« Last Edit: December 08, 2010, 10:26:44 AM by Rak'kar »