Cubyz icon indicating copy to clipboard operation
Cubyz copied to clipboard

GUI Server List

Open bagggage opened this issue 2 months ago • 12 comments

Fixes #1992 (not yet, but will be).

At the moment, a client-side server list has been implemented, which is stored in server_list.zig.zon. The user can add and remove a server from the list via the GUI by opening the "Multiplayer" window from the main menu. To connect to a server, you need to select it from the list and press "Join". Currently, the user manually specifies the server's name and its address.

This approach can be changed and extended to add support for automatically fetching the server list from remote sources. It might also be worth implementing pinging of the servers in the list so that the user can assess the availability and quality of the connection to the server.

The not entirely obvious (?) text-prompt "Please send your IP to the host of the game and enter the host's IP below." and the display of the client's public IP address have been removed; now connection is initialized only in the join function (please let me know what this was needed for if it was indeed useful).

The GUI implementation depends on #2008 and #2016.

image_2025-10-15_16-35-38 image_2025-10-15_16-44-51 image_2025-10-15_16-42-27 image_2025-10-15_16-43-33

bagggage avatar Oct 15 '25 14:10 bagggage

This looks to remove the ability to connect directly without adding an entry to this server list, is that correct? A direct connect option would still be nice.

The not entirely obvious (?) text-prompt "Please send your IP to the host of the game and enter the host's IP below." and the display of the client's public IP address have been removed

The purpose of this is to allow for NAT punch-through to work, without requiring port forwarding. It's a bit confusing and could need UX improvement, but it should not be removed.

Also, what about #1929 / #1933?

copygirl avatar Oct 15 '25 16:10 copygirl

The purpose of this is to allow for NAT punch-through to work, without requiring port forwarding. It's a bit confusing and could need UX improvement, but it should not be removed.

Thank you for the explanation. I'll leave it as it was for now, and if there is a better way to handle this, I will do it later.

As for the direct connection by host address and the address obfuscation, I'm going to work on both of those. I will commit an updated version soon.

bagggage avatar Oct 15 '25 19:10 bagggage

The purpose of this is to allow for NAT punch-through to work, without requiring port forwarding. It's a bit confusing and could need UX improvement, but it should not be removed.

I think we should have two separate windows, one for joining public servers and one for playing with friends.

IntegratedQuantum avatar Oct 15 '25 20:10 IntegratedQuantum

And of course, a direct connect option and option to hide the IPs

ikabod-kee avatar Oct 16 '25 03:10 ikabod-kee

I think we should have two separate windows, one for joining public servers and one for playing with friends.

For a while, I've been trying to figure out the best way to handle these two separate windows. The most suitable approach for me seems to be using two tabs, but... we don't have tabs. So, I created "tabs" using buttons:

image image

If we go with windows, we could have two buttons in the menu, something like "Multiplayer" and "LAN":

image

But in fact, the name "LAN" isn't quite accurate, since we're not talking about a local network, but about playing with friends. And "Multiplayer" is too broad - it essentially includes playing with friends as well. So, we need more appropriate names, and then I think it will be just right.

bagggage avatar Oct 16 '25 13:10 bagggage

If we go with windows, we could have two buttons in the menu, something like "Multiplayer" and "LAN":

I think that's easier. Using tabs makes the window more cluttered. I would call them Join a Server and Play with Friends

Another option would also be to make a submenu. This could also allow for other far future options like playing via steam or discord APIs instead of sharing the IP manually.

IntegratedQuantum avatar Oct 16 '25 15:10 IntegratedQuantum

Another option would also be to make a submenu.

I thought about that too, but it would add an extra level of nesting, and the user would have to click through several windows every time before he can connect.

I think a good solution would be to have two separate windows. Features like playing via Steam or Discord could then be added inside the "Play with Friends" window, where we could implement buttons that, for example, open a friends list from Steam or something similar.

bagggage avatar Oct 16 '25 15:10 bagggage

Almost done. I've implemented two separate windows and added obfuscation #2029, but it needs refinement – a corresponding "streamer mode" should be added and made toggleable via settings. Also, the addresses in the "Invite Players" window available to the host need to be hidden.

For now, I've moved the server connection logic from the window code into main.game (but if a better place is found for it, I'd be happy to hear suggestions) so it's accessible to all windows and isn't duplicated. Some code and commit history cleanup is still needed, but the history is currently necessary for quick testing cycles of different options to allow rollbacks, so I'll handle that later, at least once the other dependent PRs are resolved: #2008, #2016, #2029.

Join a Server: image_2025-10-17_01-26-38

Play with Friends: image_2025-10-17_01-26-56

image_2025-10-17_01-27-23

bagggage avatar Oct 16 '25 22:10 bagggage

What are the reasons to implement it with a selectable list, instead of using the same style as the save selection?

IntegratedQuantum avatar Nov 13 '25 18:11 IntegratedQuantum

For the GUI why don't we do something like Factorio does?

image

but instead of having two browsers we just have one

image

And then have a place in settings where users can add the server registries for the server browser

SafeShows avatar Nov 16 '25 21:11 SafeShows

So here's how it would look with the games UI style MP menu

this is just a rough mockup

SafeShows avatar Nov 16 '25 22:11 SafeShows

For the GUI why don't we do something like Factorio does?

lol, factorio was the origin of the "everything is a window" idea in the first place xD

tillpp avatar Nov 16 '25 23:11 tillpp