CSM icon indicating copy to clipboard operation
CSM copied to clipboard

Steam API Testing

Open DominicMaas opened this issue 6 years ago • 4 comments

Creating this pull request so people not running on steam can test and make sure this does not crash their game.

I've added a new file SteamHelpers.cs that PInvokes the steam api dll that comes with Cities: Skylines. Note: Cities: Skylines uses 1.36 of steamworks (Feb 9, 2016), keep this in mind when building features (not all APIs may be available).

  • [x] Correctly detect steam context.
  • [ ] Check to see if cities skylines always runs in 64bit. If not, we need to handle that.
  • [ ] Make sure the mod does not crash when not running in a steam context (can maybe do a check to see if the steam api dll is loaded).
  • [ ] Register callback to handle user clicking "Join Game" or accepting invites from friends.
  • [x] Allow the user (host) to invite other steam users via the steam overlay.

In terms of the actual "Join Game" from the steam UI, I think we might use a combination of overlay and lobby APIs

  • https://partner.steamgames.com/doc/features/overlay
  • https://partner.steamgames.com/doc/features/multiplayer/matchmaking

I think we can run this side by side with our current multiplayer setup (and I think 7DaysToDie also uses LiteNetLib and has a similar connection via steam system).

More Notes

https://partner.steamgames.com/doc/api/ISteamFriends#SetRichPresence

"connect" - A UTF-8 string that contains the command-line for how a friend can connect to a game. This enables the 'join game' button in the 'view game info' dialog, in the steam friends list right click menu, and on the players Steam community profile.

Looks like this is how steam works, we may need to somehow handle accepting command line arguments?

System.Environment.GetCommandLineArgs()

Use this when mod / menu is loaded? Maybe just popup the join game dialog with the IP in it for now.

https://partner.steamgames.com/doc/api/ISteamFriends#GameRichPresenceJoinRequested_t

This is used on the client to actually connect (or accept the connect when the game is already open)

DominicMaas avatar Dec 26 '19 22:12 DominicMaas

Since I got the game on Epic Games I could test this. Is that still needed?

Bluenix2 avatar Dec 25 '20 17:12 Bluenix2

Since I got the game on Epic Games I could test this. Is that still needed?

Yeah, I'll update this branch to match the latest in develop, will be good to see if non steam contexts break anything

DominicMaas avatar Mar 06 '21 20:03 DominicMaas

Would this make it possible to connect without port forwarding or does this just integrate the "Join Game" button?

TimJentzsch avatar Jul 07 '22 10:07 TimJentzsch

Would this make it possible to connect without port forwarding or does this just integrate the "Join Game" button?

Just integrates, I've done some work with NAT HolePunching which should remove the need to port forward (see link below), but I'm a bit too busy at the moment to work on this. Hopefully in a month or two.

https://github.com/CitiesSkylinesMultiplayer/HolePunchTest

DominicMaas avatar Jul 07 '22 19:07 DominicMaas

Superseded by #303

kaenganxt avatar Apr 09 '23 01:04 kaenganxt