Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Possibility to search for LAN games #3760

Open
qwc opened this issue Oct 16, 2019 · 16 comments
Open

Feature: Possibility to search for LAN games #3760

qwc opened this issue Oct 16, 2019 · 16 comments
Labels
Good First Issue Good for learners that are new to Terasology Multiplayer Affects aspects not visible in Singleplayer mode only Topic: UI/UX Requests, Issues and Changes related to screens, artwork, sound and overall user experience Type: Improvement Request for or addition/enhancement of a feature

Comments

@qwc
Copy link
Contributor

qwc commented Oct 16, 2019

It should be possible to search for local area network games automatically.
Some extra button in the server list.

So question here is should we put a algorithm into action which searches all available IP addresses of the local network for terasology servers or do we let a opened server just broadcast every now and then some message, like "Hey guys I am running on this IP with that port and got that modules flying around, wanna join?". @Cervator Waddayathink?
I personally would go for second option, broadcasting in a defined interval (5 seconds maybe, of course it should be possible to disable that advertisement), and clients list those then.

@qwc qwc added Multiplayer Affects aspects not visible in Singleplayer mode only Type: Improvement Request for or addition/enhancement of a feature labels Oct 16, 2019
@qwc qwc self-assigned this Oct 16, 2019
@Cervator
Copy link
Member

Cervator commented Nov 3, 2019

Since this is a fairly well understood topic I think I'd just go search for and steal draw inspiration from any sort of similar implementation we can find :-) There might even be some useful snippets in Java somewhere already!

This might be easy enough to do if such a search finds a good example and we can just plug in another tab or button on the join game screen

@Cervator Cervator added Good First Issue Good for learners that are new to Terasology Topic: UI/UX Requests, Issues and Changes related to screens, artwork, sound and overall user experience labels Nov 3, 2019
@qwc qwc removed their assignment Nov 6, 2019
@sladyn98
Copy link
Contributor

I would like to work on this issue
https://www.baeldung.com/java-broadcast-multicast This looks like a decent implementation for broadcasting.

@pollend
Copy link
Member

pollend commented Jan 22, 2020

go ahead, we always like new PR's :P.

@sladyn98
Copy link
Contributor

I thought of the following approach for this.
We could add a broadCastServer.java class which would broadcast the game on the local area network, along with the port and the modules available. This list of servers would then show up in the join game server. This could be supported by a button that says Find local area games and a button to activate/deactivate the broadcast.
cc @DarkWeird

@DarkWeird
Copy link
Contributor

@sladyn98 yeah. Sounds nice.
What about ipv4/v6, headless server and broadcast ip (nitpick, ICANN determinate some ip addresses for broadcast)?

@sladyn98
Copy link
Contributor

sladyn98 commented Jan 23, 2020

@DarkWeird IPV4 supports broadcasting, In IPv6, multicast support has been made mandatory, and there is no explicit concept of broadcasting,in multicasting unfortunately we have to make the recipients get added to the group to be able to receive the messages so we might have to stick with just broadcasting.
For headless servers the code for stays the same with the ip.getHostAddress() becoming the host IP

@DarkWeird
Copy link
Contributor

@sladyn98 wait your PR :3

@ahv15
Copy link
Contributor

ahv15 commented Aug 1, 2020

Could I try working on this issue, based off how the previous assignee had attempted it. To be honest I am not too sure how this works exactly but this seemed like one of the few beginner issues that nobody is working on for the time being and any help would be appreciated.

@Cervator
Copy link
Member

Cervator commented Aug 1, 2020

Heya @ahv15 - yes, please! In this case there's an existing PR you can look at for inspiration, and all the comments to learn more about it, what it missing, and so on. Plus it would be great to get that work salvaged and the feature completed :-)

@ahv15
Copy link
Contributor

ahv15 commented Aug 2, 2020

Ok sure, I will take a shot at it.

@skaldarnar
Copy link
Member

skaldarnar commented Aug 4, 2020

@ahv15 also, make sure to hop on Discord if you have questions or are stuck somewhere 😉

@ahv15
Copy link
Contributor

ahv15 commented Aug 5, 2020

Sure, it is just that I haven't started working on it yet as I was busy with some work, but as soon as I start working on it(hopefully today) I am sure I will be stuck somewhere 😁 so I will head over to the discord server then.

@ahv15
Copy link
Contributor

ahv15 commented Aug 5, 2020

So while starting out from the previous PR I found out that the game crashed when i tried to enter the join game screen due to the fact that the broadcast server object was null, so I modified that part a bit so that at least the game doesn't crash when we go to the join screen. After that I tried initializing the object right when the broadcast server button was clicked and this time it was able to send the package and start the broadcast but the success was short lived as the game immediately stopped responding for some reason.
Screenshot (262)
Screenshot (263)

So I just wanted to know if there is anything specific that needs to be done with the constructor and how it initializes an object to prevent such issues. I had initialized the object in a makeshift manner so that I could check out if the broadcast part was working fine.

@ahv15
Copy link
Contributor

ahv15 commented Aug 5, 2020

Screenshot (266)
Screenshot (267)

The relevant code and the error most probably lies in the object initialization part so it could be due to the constructor or maybe I am doing something else that is completely wrong but cant seem to understand what exactly it is. Any help would be appreciated.

@skaldarnar
Copy link
Member

@ahv15 I'm not sure if any multi-threading is involved here, but the game becoming unresponsive when starting the broadcast feels like the broadcast is blocking everything else 🤔
A PR would help a lot to discuss details in the code - and don't worry too much about commits, we can squash merge in the end to clean up any mess 😉

@ahv15
Copy link
Contributor

ahv15 commented Aug 5, 2020

Ohhhk, this makes a lot more sense, so the issue probably lies during the broadcasting, but the problem is that as the game turned unresponsive and could not give any sort of feedback to troubleshoot the error, I was kind of stuck there 😟 . So for the time being I will just start a PR regarding this issue.

@ahv15 ahv15 mentioned this issue Aug 6, 2020
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good First Issue Good for learners that are new to Terasology Multiplayer Affects aspects not visible in Singleplayer mode only Topic: UI/UX Requests, Issues and Changes related to screens, artwork, sound and overall user experience Type: Improvement Request for or addition/enhancement of a feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants