I created this free to use steam lobby manager and want some feedback. https://github.com/jugi-dev/com.jugidev.steamlobby
#Can you review my code
1 messages · Page 1 of 1 (latest)
Is there something specific you want feedback on here?
For the most part this feels like a wrapper for existing facepunch methods or these scripts are just the absolute basics of starting a steam lobby. It feels more like a template rather than a "lobby manager" that people can drag and drop per se if that was your intended use case
Which isn't a bad thing if you intended for this to be a template for developers new to multiplayer
Yeah its more like a template and its purpose is to ease the creation of steam lobby having to only worry about UI code
Its been a few months since ive looked at anything facepunch related, so I can't comment on if the code is logically correct.
One thing I notice is the use of OnLobbyEvent and lobbyEvent.
lobbyEvent isn't actually used in this code other than supplying a parameter to OnLobbyEvent. You don't need to store this in a variable, just instead reference the enum directly when invoking the event. for example
OnLobbyEvent?.Invoke(currentLobby, LobbyEvent.HOST_LEAVE);
conflicting to my point above, I don't think this enum is a good idea at all. You'd be forcing anyone using this lobby manager to write one method subscribing to OnLobbyEvent and write a switch statement based on the enum. Some people might just end up using that switch to call their own OnLobbyCreated, OnLobbyEntered, etc methods. It does feel awkward that all of these events are compressed into one.
For the PlayerInfo, make a constructor to require the fields to be passed in the parameters if the friend and isDeveloper are needed. This looks like it could give an error if someone just does new PlayerInfo() which you allow them to do
Thanks for pointing out the PlayerInfo error! I would like the user to get access to those lobby events because they are more than likely needed to create your lobby ui. But is there a better way to handle this?
I don't think you need to expose them at all since its under SteamMatchmaking
if you just want to ensure that your methods are called first, then id just make separate events mimicing the steam ones like an OnLobbyCreated, OnLobbyEntered etc