Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / I need help please with multisync

Author
Message
Starbuzzzz
15
Years of Service
User Offline
Joined: 5th Dec 2010
Location: France
Posted: 20th Feb 2012 16:58
Hi all!
I've got a big problem...
For my Starbuzzz Soccer Club program, I'm working on the multi with multisync.
Everything is ok. The client sends datas about keys pressed, and the host send informations by integers and floats(Players positions, object frames, etc.)
Everything is working perfectly... But, at the halftime, the program shows highlights of the match. Each computer makes this operation itself(there are no datas transfering in this part...)
When one player is pressing a key, the program calls the Team management menu... But if one player has pressed the key, he has to wait that the second player press too this key to go to the Team management menu...
For that, I use this part in my program :

if rezo=2
attentat:
sync
k$="":dec$="MAISOUI"
if net get message()=0 then goto attentat
k$=net get string():if k$<>"MAISOUI" then goto attentat
net put string dec$
net send 1
endif

if rezo=1
k$="MAISOUI"
net put string k$:net send all
attentat2:
sync
if net get message()=0 then goto attentat2
k$=net get string()
if k$<>"" then goto attentat2
ENDIF

Rezo = 1 for the host... Rezo=2 for the client.
But there is a problem with that. Sometimes, is a player is pressing the key, he'll wait that the second player press it too. But when this once does it, the first player goes to the menu (that's what I want...) but the second player is still waiting :S
I don't know why... Can this problem comes from "time" ? Because it seems to me that it appears when the second player waits a "long" time before clicking...
If anybody has an idea, I'll be very very very happy because that's the only thing that screw my game :S
(Sorry if what I say is not very clear... I'm french you know )
Thanx

Starbuzzzz
Sergey K
22
Years of Service
User Offline
Joined: 4th Jan 2004
Location:
Posted: 21st Feb 2012 01:06
not sure i understood your problem
but what you mean, is that player A press "M" key, and server needs to send a command to the Player B, that the "M" key is pressed, right?

more 3d models .x/.obj and more foramts here:
[href]https://www.turbosquid.com/Search/Index.cfm?keyword=gogetax1&x=0&y=0[href]
MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 21st Feb 2012 02:22
I have never understood what Multisync was about... is it just for LAN's?

[Please throw me in the right direction ... linky]

TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 22nd Feb 2012 22:08 Edited at: 22nd Feb 2012 22:09
Yes Multisync is just for LAN. You can use programs such as hamachi to create a VPN tunnel between two computers in order to play over the internet.

@ starbuzzzz

There is a bare minimum of code in order for multisync to work. You need to handle players joining, leaving, and disconnects. Here's the "core" code:



I'd like to help you further, but first I need to ask something myself. How does the client get his ID when he joins? I mean, I know that when you're the host your ID = 0, and when client1 joins, his ID = 1, client2's ID = 2 etc. But how does the client know what ID he is?

TheComet

The TOTAL size of your sig can only be 600x120, including text and links.
Benjamin
23
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 22nd Feb 2012 22:51
Quote: "is it just for LAN's?"


No, it's meant for both internet and LAN. It doesn't have any built-in port forwarding facilities however, so you have to do it manually.



Support a charitable indie game project!
MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 22nd Feb 2012 22:56
then its for LAN...

though as with everything programming... moddable you mean right?

Sergey K
22
Years of Service
User Offline
Joined: 4th Jan 2004
Location:
Posted: 22nd Feb 2012 23:27
multisync created by someone named Benjamin, not sure if he still here on the forums, but its one of the best multiplayer plugins along with tempest plugin he made..

multisync is simple tcp/ip server/client method plugin, that one all the massive multiplayer games made. the client sends msgs to the server, server recive and send to all other players that connected on save world

tempest is a lil bit different.. its udp protocols, basicly no server/client. all of the players are clients. they can share data with each other althought the players that can connect to eath other are limited.

more 3d models .x/.obj and more foramts here:
[href]https://www.turbosquid.com/Search/Index.cfm?keyword=gogetax1&x=0&y=0[href]
=PRoF=
23
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 23rd Feb 2012 00:21 Edited at: 23rd Feb 2012 00:23
I used to use Tempest, but if you browse the forums closely enough, you will find both a UDP and TCP version of Multisync. I use both of them in my obligatory MMO project.

>Edit<

On closer reading of this thread, I'm surprised so many of you have had problems using Multisync over the net.

TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 23rd Feb 2012 08:05
Is anyone going to answer my question about how the client receives his ID?

TheComet

Benjamin
23
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 23rd Feb 2012 08:59
Quote: "then its for LAN..."


No.

Quote: "Is anyone going to answer my question about how the client receives his ID?"


By default it doesn't, you have to have the server send the IDs if it's strictly necessary.



Support a charitable indie game project!
MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 23rd Feb 2012 09:03
Quote: "No, it's meant for both internet and LAN. It doesn't have any built-in port forwarding facilities however, so you have to do it manually."


I stand confused and perplexed...

Michael P
20
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 23rd Feb 2012 09:42
Quote: "I stand confused and perplexed..."

Google can educate you, have a look at the basics of TCP networking, client/server architecture, NAT enabled routers.

It will work on LAN without any router configuration, but if you want to run a server behind a NAT enabled router then you have to setup port forwarding; clients can connect without port forwarding.

MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 23rd Feb 2012 09:46 Edited at: 23rd Feb 2012 09:48
nevermind...

EDIT

Michael P... you developed DN? {I have it so thats why I am confused with MultiSync}

TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 23rd Feb 2012 09:49
Quote: "No."


I've never managed to connect two computers over the internet with multisync, even after forwarding the ports on both computers...

Quote: "I stand confused and perplexed..."


No chair?

Quote: "By default it doesn't, you have to have the server send the IDs if it's strictly necessary."


Why wouldn't you need to know the IDs? If you're working with multiple clients, everyone needs to know their own ID in order to store their data in the correct slot when it's sent no?

TheComet

MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 23rd Feb 2012 09:51 Edited at: 23rd Feb 2012 09:54
Quote: "No chair?"


WHY YOU LITTLE [strangles The Comet Homer Style]

aaaah feeling much better now...

So is MultiSync free?

EDIT

DOH! [fixed massive errors]

EDIT

Has anybody answered Starbuzzzz's question yet? or has he dissappeared?

also still waiting on that linky...

Millenium7
21
Years of Service
User Offline
Joined: 13th Dec 2004
Location:
Posted: 23rd Feb 2012 10:28
client's do not need to know their ID and i'm pretty sure they can't retrieve their own ID. Depending on the way you've written the program you may not need it. In my project I don't as Player(0) is always the local client's data. I use player numbers rather than ID numbers. The local client can find any player number by checking Player(X).Number. The server forwards messages to wherever it needs to go

Keep in mind that client's only ever communite with the server, they can't communicate directly with the client. If you need to send a text message to all players on the server from a client, the client must first send it to the server. The server then must forward it on to all other clients. This is why client id's should not be necessary for your client

If you absolutely must know the client ID on the client side, then it must be sent by the server to the client as a message, and then stored in a local variable. I'm not going to look into the documentation right now but i'm pretty sure it's obtained when the client connects
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 23rd Feb 2012 11:20
Quote: "but i'm pretty sure it's obtained when the client connects "


Nope.

success = net connect("127.0.0.1")

Will return a 1 if successful, and a 0 if not successful, even if you're client #4 joining.

TheComet

McLaine
20
Years of Service
User Offline
Joined: 20th Feb 2006
Location:
Posted: 23rd Feb 2012 13:37
@Starbuzz

Is the problem here in the rezo=1 section ...



Surely, you want to loop attentat2 until k$ is NOT empty. So the code would be:



@Multisync naysayers

Net Player Joined and Net Player Left are the two commands that will return the ID of a new or leaving client.

Multisync can easily be used over the internet, you just need to remember to supply your EXTERNAL IP address to the clients and not the internal.

For those of us connecting through a router, you will likely have to tell the router that all traffic coming in from outside on the specified port number needs to be directed to the internal IP of the computer running the multisync host app.

Most routers have an admin screen that can be accessed using a browser and browsing to 192.168.0.255
The exact IP of your router for this admin screen will differ dependent on your router model, but it can be found by looking at the properties of your network adapter and looking for the Gateway IP.



It's not my fault!
Benjamin
23
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 23rd Feb 2012 15:13
Quote: "I've never managed to connect two computers over the internet with multisync, even after forwarding the ports on both computers..."


Not knowing how to use it online and it not being capable of being used online are two very different things. You'd have this same problem with most games of an earlier era such as 2000-2006 where there was no firewall cooperation or UPnP feature on routers. In fact some games and applications these days still require you to manually sort out the networking when running a server.

I don't know what the current trend is but back when I wrote MS it was entirely expected to have to do these operations yourself. And as I say, some games and applications still require it even today.

If you're a client, no problem. If you're not using a router (as originally was generally the case back in the '90s) no problem also. It's only when you add the (now standard) hardware that you have to configure it.

I hope that's cleared it up.

Quote: "Why wouldn't you need to know the IDs? If you're working with multiple clients, everyone needs to know their own ID in order to store their data in the correct slot when it's sent no?"


I suppose that's one way of doing it, but you don't necessarily need the client to know its ID to handle this.



Support a charitable indie game project!
Millenium7
21
Years of Service
User Offline
Joined: 13th Dec 2004
Location:
Posted: 23rd Feb 2012 16:20
Quote: "Nope.

success = net connect("127.0.0.1")

Will return a 1 if successful, and a 0 if not successful, even if you're client #4 joining."


actually I was right. From the manual...

Quote: "NET PLAYER JOINED Server only
If a player has newly joined, this will return their ID. If there are no newly joined players since the last call, 0 is returned.

NOTE: It is necessary to call this command in order to let players join the game."


So if you are having problems with people joining, first of all that's your problem right there. You MUST call that command for them to successfully join. Do it in the form of
Player(number).ID=Net Player Joined()

Great success, you now have their ID. But it is only on the 'server' side. So if you want to inform the client of it's ID you need to send a message to them with the ID number, and they can store it in a local variable

Login to post a reply

Server time is: 2026-07-10 12:22:13
Your offset time is: 2026-07-10 12:22:13