Midgardo Posted August 5, 2017 Author Share Posted August 5, 2017 Hi, is there a way to make a window where you can select or create a server just like in previous versions?Thanks Link to comment Share on other sites More sharing options...
Shina Posted August 5, 2017 Share Posted August 5, 2017 is that Multi Server?likeSelect Server:GoldYellowBlueand you won't see the players on different server?If that's what you are talking about, it require a little bit modification regarding with the account login setup on server side, since you need to have a main server that connect all sub server together or you can just make the server connect with each other but that's really not a decent idea, so having a main server is a good idea, and let main server handle the account loading and saving, so you can switch between server.. but if you don't need the account to be able to switch between server..Just open another server, change port.. then add a option on client side that change the port and ip and match the server it will login to Link to comment Share on other sites More sharing options...
SolidLink Posted August 5, 2017 Share Posted August 5, 2017 try adding Optionboxes. Lets say we added 2 optionboxes. One is blue and one is reddouble click on blue and add a code like```Options.IP = "Blue's IP"Options.Port="Blue's Port"```Double click on Red and do the same thing but with Red's server. Then create a copy of your server but this time it loads the red's server and then keep both of those server open. No idea how to sync with other servers though. Link to comment Share on other sites More sharing options...
Shina Posted August 5, 2017 Share Posted August 5, 2017 @solidlink said in [Different servers](/post/699836):> try adding Optionboxes. Lets say we added 2 optionboxes. One is blue and one is red> double click on blue and add a code like> ```> Options.IP = "Blue's IP"> Options.Port="Blue's Port"> ```> Double click on Red and do the same thing but with Red's server. Then create a copy of your server but this time it loads the red's server and then keep both of those server open. No idea how to sync with other servers though.Changing those while the client already opened won't change itthe moment you pass the TCPInit or whatever it called on the engine where you setup the remotehostip and remotehostport of the winsocket, even if you change those, the socket destination won't change.. it must be reinit again or just change the winsocket destination Link to comment Share on other sites More sharing options...
Coyote Posted August 5, 2017 Share Posted August 5, 2017 @shina said in [Different servers](/post/699837):> @solidlink said in [Different servers](/post/699836):> > try adding Optionboxes. Lets say we added 2 optionboxes. One is blue and one is red> > double click on blue and add a code like> > ```> > Options.IP = "Blue's IP"> > Options.Port="Blue's Port"> > ```> > Double click on Red and do the same thing but with Red's server. Then create a copy of your server but this time it loads the red's server and then keep both of those server open. No idea how to sync with other servers though.> > > Changing those while the client already opened won't change it> the moment you pass the TCPInit or whatever it called on the engine where you setup the remotehostip and remotehostport of the winsocket, even if you change those, the socket destination won't change.. it must be reinit again or just change the winsocket destinationThen simply make another form with Server selection or make login form work offline before tcpinit is called.It should be pretty simple. Link to comment Share on other sites More sharing options...
Shina Posted August 5, 2017 Share Posted August 5, 2017 @coyote said in [Different servers](/post/699838):> @shina said in [Different servers](/post/699837):> > @solidlink said in [Different servers](/post/699836):> > > try adding Optionboxes. Lets say we added 2 optionboxes. One is blue and one is red> > > double click on blue and add a code like> > > ```> > > Options.IP = "Blue's IP"> > > Options.Port="Blue's Port"> > > ```> > > Double click on Red and do the same thing but with Red's server. Then create a copy of your server but this time it loads the red's server and then keep both of those server open. No idea how to sync with other servers though.> > > > > > Changing those while the client already opened won't change it> > the moment you pass the TCPInit or whatever it called on the engine where you setup the remotehostip and remotehostport of the winsocket, even if you change those, the socket destination won't change.. it must be reinit again or just change the winsocket destination> > Then simply make another form with Server selection or make login form work offline before tcpinit is called.It should be pretty simple.as long asSocket.RemoteHost = "ip"Socket.RemotePort = Portare being changedit's possible to connect to different server without restarting the clientbut of course you should disconnect the socket first, before reconnecting..But it is possible to add another socket, but it just waste additional line of codes rather than changing those Link to comment Share on other sites More sharing options...
Midgardo Posted August 6, 2017 Author Share Posted August 6, 2017 I thought It could be done just as easy as previous options, with no coding, just with note pad files, for example, the other versions at config.ini you just has:[Servers]ServerCount= 2[Server1]Game_Name=XXXXXXIP=localhostPort= 8000[Server2]Game_Name=XXXXXX2IP=localhostPort= 8000 Link to comment Share on other sites More sharing options...
alextoti99 Posted August 6, 2017 Share Posted August 6, 2017 You can make the client to start at the server selector, where you can make it to open the same client but with different ip make 2 new variables:ServerIp As String and ServerPort As Integer and change the Options.IP = "Blue's IP"Options.Port="Blue's Port" to the variables (delete from the option file too)and if the player choose blue server the ServerIp = "blue" and port else to yellow etc etc Link to comment Share on other sites More sharing options...
Coyote Posted August 7, 2017 Share Posted August 7, 2017 Gonna end this:In client make a new form and call it frmServers.Next add new OptionButton and leave its name Option1.Now copy that OptionButton and when it asks you to duplicate it (Make an array of controls) click **YES**.When you do that add a command button.Should look like this:![alt text](https://image.prntscr.com/image/5U_fCNdFTVSf26CsJmYcIA.png)Now next thing that you wanna do is really important , go to Project (At the top bar) and then to last option (Its EO Properties to me) and then change Startup Object from Sub Main to frmServers.After you've done that go to modGlobals and add this at the end of module: Public ServerSelected As BooleanAfter u've done that go to frmServers again and double click command button you made to view its code.Now paste this into its code: If Option1(0).Value = True Then Options.IP = "RED SERVER IP" 'IP as a string Options.Port = 7001 'port in number ServerSelected = True End If If Option1(1).Value = True Then Options.IP = "GREEN SERVER IP" 'IP as a string Options.Port = 7001 'port in number ServerSelected = True End If If Option1(2).Value = True Then Options.IP = "BLUE SERVER IP" 'IP as a string Options.Port = 7001 'port in number ServerSelected = True End If If ServerSelected = False Then MsgBox ("Please select a server!") Exit Sub End If Call Main Unload MeChange "RED/GREEN/BLUE SERVER IP" string with IPs you want client to connect to when server is selected. Same with the portNow final thing is to look for Sub LoadOptions in modDatabase and replace few lines of code:Replace: Options.IP = "127.0.0.1" Options.Port = 7001 With: If ServerSelected = False Then Options.IP = "127.0.0.1" Options.Port = 7001 End IfAnd Replace: Options.IP = GetVar(fileName, "Options", "IP") Options.Port = Val(GetVar(fileName, "Options", "Port")) With: If ServerSelected = False Then Options.IP = GetVar(fileName, "Options", "IP") Options.Port = Val(GetVar(fileName, "Options", "Port")) End IfThats it you are ready to run! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now