About not being able to play Single player when disconnected

Programmers discuss here anything related to FreeOrion programming. Primarily for the developers to discuss.

Moderator: Committer

Post Reply
Message
Author
User avatar
Rydra
Space Squid
Posts: 55
Joined: Fri Jun 28, 2013 6:15 pm

About not being able to play Single player when disconnected

#1 Post by Rydra »

Hi there,

I remember some time ago I've read (and experienced myself) that when I'm offline with my laptop (for instance, at train) I couldn't play freeorion as it didn't connect to localhost.

After doing some debugging, I realised that the problem relies on boost libraries (I think the library is called Asio or sthing similar). Googling around, I've arrived to some of webpages explaining the issue:

https://svn.boost.org/trac/boost/ticket/8503
http://thread.gmane.org/gmane.comp.freedesktop.xcb/6973
https://fedoraproject.org/wiki/Networki ... ADDRCONFIG

It seems that dropping that ADDRCONFIG could solve the issue. I've arrived to the following line of code in freeorion which probably prepares the connection and the flags (not sure of that...)

Code: Select all

file network/ClientNetworking.cpp, line 172

    tcp::resolver::query query(tcp::v4(), ip_address,
                               boost::lexical_cast<std::string>(MESSAGE_PORT),
                               boost::asio::ip::resolver_query_base::address_configured |
                               boost::asio::ip::resolver_query_base::numeric_service);
I'm not experienced nor skilled in C++ and boost libraries. Does someone know of a way to disable that flag and try if now boost is able to connect to localhost while offline?

Thank you and kind regards.

User avatar
adrian_broher
Programmer
Posts: 1156
Joined: Fri Mar 01, 2013 9:52 am
Location: Germany

Re: About not being able to play Single player when disconne

#2 Post by adrian_broher »

Rydra wrote:Hi there,

I remember some time ago I've read (and experienced myself) that when I'm offline with my laptop (for instance, at train) I couldn't play …
You're talking about this thread viewtopic.php?f=25&t=7793
Does someone know of a way to disable that flag and try if now boost is able to connect to localhost while offline?
Remove the address_configured flag (whole line). That should allow the server to connect to pure loopback device setups.
Resident code gremlin
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: About not being able to play Single player when disconne

#3 Post by Dilvish »

Hmm, I had never noticed that before, that simply pulling my ethernet cable prevents the game from working. You do seem to have correctly identified the issue, removing that flag from the query let FO run fine without the ethernet cable attached, on Linux. Attached is a patch file (a mere one line deletion) so that someone can more easily test it on Windows and Mac. It would also be good if someone could run at least a few turns of a multiplayer game to make sure that this change doesn't interfere with actual network play.
Attachments

[The extension patch has been deactivated and can no longer be displayed.]

If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
Rydra
Space Squid
Posts: 55
Joined: Fri Jun 28, 2013 6:15 pm

Re: About not being able to play Single player when disconne

#4 Post by Rydra »

Dilvish wrote:Hmm, I had never noticed that before, that simply pulling my ethernet cable prevents the game from working. You do seem to have correctly identified the issue, removing that flag from the query let FO run fine without the ethernet cable attached, on Linux. Attached is a patch file (a mere one line deletion) so that someone can more easily test it on Windows and Mac. It would also be good if someone could run at least a few turns of a multiplayer game to make sure that this change doesn't interfere with actual network play.
I will test application of this patch tomorrow in my train travel on the morning and come with the results at afternoon (on Linux)

Thank you adrian and Dilvish!

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: About not being able to play Single player when disconne

#5 Post by Geoff the Medio »

Dilvish wrote:Attached is a patch file (a mere one line deletion) so that someone can more easily test it on Windows and Mac.
Single player game runs fine on Windows.

User avatar
Rydra
Space Squid
Posts: 55
Joined: Fri Jun 28, 2013 6:15 pm

Re: About not being able to play Single player when disconne

#6 Post by Rydra »

Alright, I've tested Dilvish's patch and FreeOrion works well on single-player (played some turns no problemo) when off-line. It should be tested whether multiplayer online gaming has been broken with this change or works out of the box.

Is someone willingful to test it or can test it easily?

User avatar
Vezzra
Release Manager, Design
Posts: 6095
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: About not being able to play Single player when disconne

#7 Post by Vezzra »

Rydra wrote:Is someone willingful to test it or can test it easily?
I intend to (also to check if everything is alright on OSX), but might not get to it before the weekend.

User avatar
Rydra
Space Squid
Posts: 55
Joined: Fri Jun 28, 2013 6:15 pm

Re: About not being able to play Single player when disconne

#8 Post by Rydra »

Vezzra wrote:
Rydra wrote:Is someone willingful to test it or can test it easily?
I intend to (also to check if everything is alright on OSX), but might not get to it before the weekend.
I've tested the game with the patch on a local LAN home and multiplayer works fine. Next step should be testing on a real use case of outside and different IPs.

We could arrange a sample game at some point on time, here I'm at GMT+1.

User avatar
Vezzra
Release Manager, Design
Posts: 6095
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: About not being able to play Single player when disconne

#9 Post by Vezzra »

Rydra wrote:We could arrange a sample game at some point on time, here I'm at GMT+1.
Should be doable, as I'm also at GMT+1. I just don't know when I'll have time for that. Tomorrow evening might be possible - we'll need to coordinate... are you on Skype? My Skype name is (surprise!) "vezzra".

User avatar
Rydra
Space Squid
Posts: 55
Joined: Fri Jun 28, 2013 6:15 pm

Re: About not being able to play Single player when disconne

#10 Post by Rydra »

Vezzra wrote:
Rydra wrote:We could arrange a sample game at some point on time, here I'm at GMT+1.
Should be doable, as I'm also at GMT+1. I just don't know when I'll have time for that. Tomorrow evening might be possible - we'll need to coordinate... are you on Skype? My Skype name is (surprise!) "vezzra".
I'll have some time at Thurday evening or Sunday night.

Allright, see you on Skype. I'll add you, then we'll talk whenever I've got a moment :)

User avatar
Vezzra
Release Manager, Design
Posts: 6095
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: About not being able to play Single player when disconne

#11 Post by Vezzra »

Rydra wrote:I'll have some time at Thurday evening or Sunday night.
Unfortunately I won't have spare time on Thursday evening, so Sunday night is going to be it ;) Although I've to ask: What do you mean by "night"? 2am in the morning...? :mrgreen:
Allright, see you on Skype. I'll add you, then we'll talk whenever I've got a moment :)
Well, the adding has been successful :D However, I'm usually not online with my "vezzra" persona, only when explicitely required, and only when I'm at home (I'm at work now). I'll try to be online with my "vezzra" account as much as possible the next few days though when I'm at home, especially on Sunday, so you should be able to get me at some point :)

User avatar
Rydra
Space Squid
Posts: 55
Joined: Fri Jun 28, 2013 6:15 pm

Re: About not being able to play Single player when disconne

#12 Post by Rydra »

Vezzra wrote:
Rydra wrote:I'll have some time at Thurday evening or Sunday night.
Unfortunately I won't have spare time on Thursday evening, so Sunday night is going to be it ;) Although I've to ask: What do you mean by "night"? 2am in the morning...? :mrgreen:
Allright, see you on Skype. I'll add you, then we'll talk whenever I've got a moment :)
Well, the adding has been successful :D However, I'm usually not online with my "vezzra" persona, only when explicitely required, and only when I'm at home (I'm at work now). I'll try to be online with my "vezzra" account as much as possible the next few days though when I'm at home, especially on Sunday, so you should be able to get me at some point :)
I'll have some spare time at 20:30 today Thursday. If you are on skype by that time I'll speak to you :)

User avatar
Vezzra
Release Manager, Design
Posts: 6095
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: About not being able to play Single player when disconne

#13 Post by Vezzra »

Rydra wrote:I'll have some spare time at 20:30 today Thursday. If you are on skype by that time I'll speak to you :)
I'm not at home at that time, sorry. I'll come home quite late today. Maybe, if you're still online then, I'll try to contact you. Otherwise let's try again on Sunday. I'm really swamped with work at the moment, there probably won't be a free moment before...

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: About not being able to play Single player when disconne

#14 Post by Geoff the Medio »

I may have accidentally committed this change already...

http://sourceforge.net/p/freeorion/code/6436/#diff-4

User avatar
Vezzra
Release Manager, Design
Posts: 6095
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: About not being able to play Single player when disconne

#15 Post by Vezzra »

Geoff the Medio wrote:I may have accidentally committed this change already...

http://sourceforge.net/p/freeorion/code/6436/#diff-4
We already noticed that during our test sessions, as it turned out, this change didn't cause any problems (that weren't already there). However, there are some strange issues going on in multiplayer, Rydra and I are trying to figure that out, it's just a very slow process because it's not easy to find an opportunity where both of us have some spare time.

Post Reply