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.

Program Announcements / Multisync v1.0 - Multiplayer plugin

Author
Message
Silvester
18
Years of Service
User Offline
Joined: 7th Dec 2005
Location: Netherlands
Posted: 17th Aug 2009 22:20
Mind explaining that in a kindergarten way? I'm still trying to learn C++.

It's not the world that turns against you, it's you that turns against the world.
Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 18th Aug 2009 06:21 Edited at: 18th Aug 2009 06:21
Silvester
18
Years of Service
User Offline
Joined: 7th Dec 2005
Location: Netherlands
Posted: 18th Aug 2009 10:19
Ah! That did the trick! So it has to be defined with a maxmimum amount of Characters! Thanks

It's not the world that turns against you, it's you that turns against the world.
CokeBoi
14
Years of Service
User Offline
Joined: 19th Jun 2009
Location:
Posted: 24th Oct 2009 21:26
Does this work with Dark GDK? If so, how do I integrate it into my game?

LOL
Silvester
18
Years of Service
User Offline
Joined: 7th Dec 2005
Location: Netherlands
Posted: 31st Oct 2009 18:02
I got bored and made this very simple wrapper-ish thingy in DBP which utilises a way of sending/receiving data the way I used to do it in Visual Basic 6 with WinSock. It sends full strings which contains a packetID and the other data seperated by a character defined as SEP_CHAR and can be retrieved by using Parse(), Parse(0) returns the PacketID and the others return the other values you've sent... If you seperated them that is.

Here's the client wrapper:


The server wrapper:


The Server test code:


The Client test code:


I know it's nothing fancy or usefull, but I just figured I'd share my weird way of sending/receiving data.


EDP Map Editor[2D]
Awesomest
14
Years of Service
User Offline
Joined: 13th Oct 2009
Location:
Posted: 4th Dec 2009 16:35
Hey benjamin, multisync is working pretty good, but I've ran into a problem and was wondering if you could take a look at the thread I posted and show me what I might be doing wrong.

http://forum.thegamecreators.com/?m=forum_view&t=161765&b=22

alalala
zydeoN
14
Years of Service
User Offline
Joined: 25th Sep 2009
Location:
Posted: 10th Jan 2010 19:55
Hey! Does NetGetError() work for those who use DarkGDK ? Cause it doesnt work for me... If something goes wrong when connecting/hosting a server, it freezes and gives me a Microsoft error -.-
Hassan
14
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 11th Jan 2010 12:58
dunno, but it works for me

Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 12th Jan 2010 08:56
Quote: "Cause it doesnt work for me... If something goes wrong when connecting/hosting a server, it freezes and gives me a Microsoft error -.-"


Care to show us some code? As far as I'm aware there are no problems with it.
zydeoN
14
Years of Service
User Offline
Joined: 25th Sep 2009
Location:
Posted: 12th Jan 2010 20:35
char* buffer;
unsigned long buffer_size = 512;

result = NetConnect(ip);
if(!result)
{
NetGetError(buffer, buffer_size);
dbText(0,0,"Unable to connect server: ");
dbText(0,10,buffer);
dbSync();
dbWaitKey();
return;
}

This inside void DarkGDK(void) function
Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 12th Jan 2010 21:40
You have to point 'buffer' to some memory, or declare it as an array instead of simply a pointer:

zydeoN
14
Years of Service
User Offline
Joined: 25th Sep 2009
Location:
Posted: 12th Jan 2010 23:36
Quote: "You have to point 'buffer' to some memory, or declare it as an array instead of simply a pointer:"

Perfect
PEH
18
Years of Service
User Offline
Joined: 18th Dec 2005
Location: usa
Posted: 16th Jan 2010 18:33 Edited at: 16th Jan 2010 18:35
Made a better keywords file for multisync. It now links to the help file and will automatically scroll to the command's location.

I have tested every command's link and they all work perfectly except for "net set connection server" which apparently it is not documented or is obsolete.

Hope this helps.

Attachments

Login to view attachments
Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 17th Jan 2010 01:16 Edited at: 17th Jan 2010 01:17
Thanks, I hadn't really thought about doing it that way!

Just one question - where do I put the manual? I've tried putting it in help and commands but it doesn't seem to want to work.

Quote: "except for "net set connection server" which apparently it is not documented or is obsolete."


Yeah, it was just an experiment some time ago.
Freedom Fighters
14
Years of Service
User Offline
Joined: 2nd Nov 2009
Location:
Posted: 17th Jan 2010 06:51
well its just awesome. i like it. i've seen an older one you made with UDP and i was wondering if you might say some commands for say lan networks for like searching for games.
i found the old thread for the multisync plug in that used UDP.

Multisync awesome for games but when on lan and im looking for games its isn't much help. any thoughts on implementing functions as such?

Problem Solution That Never Fails: "Build A Bridge And Get Over It"
Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 18th Jan 2010 16:56
I've written one or two plugins that allow searching for games on a LAN, I'll see if I can find one and post it up here.
FireIndy
17
Years of Service
User Offline
Joined: 17th Jan 2007
Location: US of A
Posted: 19th Jan 2010 01:35
Just like to say Benjamin that I LOVE Multisync now. Ever since that first time my friend and I connected to each other over the internet, I cant stop using it. It works great! Right now I'm using it to write a "lobby" for my game. Great stuff dude

Freedom Fighters
14
Years of Service
User Offline
Joined: 2nd Nov 2009
Location:
Posted: 22nd Jan 2010 00:28 Edited at: 22nd Jan 2010 01:29
Quote: "I've written one or two plugins that allow searching for games on a LAN, I'll see if I can find one and post it up here. "


ok cool. that would be a big help to me. thank you. i use GDK so if you have a plug in for that it would be great.

Problem Solution That Never Fails: "Build A Bridge And Get Over It"
PEH
18
Years of Service
User Offline
Joined: 18th Dec 2005
Location: usa
Posted: 22nd Jan 2010 00:45
This is the folder that I put it in:
C:\Program Files (x86)\The Game Creators\Dark Basic Professional\Help

If you have a different version of the manual called anything other than "Multisync v1.4 Manual.html" then you will have to replace "Multisync v1.4 Manual.html" with whatever it is called.

Just tested it again and it works for me. Let me know if it still doesn't work.
Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 1st Mar 2010 10:32
@Freedom Fighters: Sorry about the lack of activity, but I've been very busy lately and haven't had time to do much programming. However, I've taken a look at a suitable plugin I had written a while ago, and I'm writing an updated version. Should be ready in a few days I think.
Lucka
19
Years of Service
User Offline
Joined: 1st Oct 2004
Location:
Posted: 5th Mar 2010 13:08 Edited at: 5th Mar 2010 13:10
Hi, guys.
First: sorry for my bad eng..
Then: Thanks a lot for your plugin Ben, i really appreciate it!

I have a "big lag" problem, maybe you can help me.
I made a little prg with a couple of object that are flyng all over, i simply pass true the TCP/IP host/Client connection 3 values:

a X position, a y position and a angle.

I use an INTEGER and not a FLOAT (maybe they are "lighter") but what we see (from client to host) is something like 4/5 seconds lag..

this is what i send / receive:


the host have:



the client have:



I send it 60 times a second, it's too much?

what is wrong?
all works properly, we can see each other, but with wrong (in time) positions.. 4/5 secs later!

Lucka - gawteam coder - www.gawgames.com
CODY_OEBEL
13
Years of Service
User Offline
Joined: 28th Feb 2010
Location:
Posted: 5th Mar 2010 21:29
A beginner tutorial on this would be great for c++. I have been studying the use of this on different sites and have some code compilated from another programmer that should work and am breaking that down, but a step by step walk through on this would really increase it's overall use for those tgrying to quickly get familiar with the structure of its use.

Thank you, and it is much appreciated Benjamen on your time spent creating this for the community.

-Cody Oebel
*Currently I am tediously trying to translate a German website that does a step by step using Multisync, but it's just not translated enough to disinguis the steps.

CODY C++ Oebel
Masqutti
14
Years of Service
User Offline
Joined: 8th Jan 2010
Location: insanity
Posted: 16th Mar 2010 11:26 Edited at: 16th Mar 2010 11:29
Hi!

I tried yesterday to connect with this. I did a fast program to send a simple message over the internet to my friend. I hosted and he was a client. He could send the message to me but my messages didn't show to him. Any ideas? Here's a snippet i've made today that has the host&client on the same program. Does it look wrong?

It views max. 20 messages and it scrolls them thru finally dropping the last one away. works with an array of strings..



hmmmh.. that didn't compile
Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 16th Mar 2010 13:12
A couple of things:

* Always check for NET HOST and NET CONNECT returning zero, indicating failure.

* Only the server has a list of players (thus commands such as NET PLAYER CONNECTED do not work for the client), the client just sees the server and no one else.
Masqutti
14
Years of Service
User Offline
Joined: 8th Jan 2010
Location: insanity
Posted: 16th Mar 2010 18:10 Edited at: 16th Mar 2010 18:44
Hi! Thanks for the input! I considered those, now the program looks like this:



Don't mind the joined1&2&3... I'm confused and I tried to overcome a problem. I got to send 1(!) message to my client, and that was the "welcome to the room!!" message. I put a player ID after it so my friend could pass it to me.


My friend told that he has ID = 1.

Confusion was great when i recieve the same message "welcome to the room!! Your ID is: 1" when I host. That means the player id was 1 when he got the message, but after that suddenly I was the ID 1, and received welcomes with continued loop. At this point, I couldn't send another message to my pal as he(i guess) wasnt the 1 anymore. What's the deal?? I was hosting. Any ideas :? :F

edit: I realized that the checkplayer function runs on the client also, that's why to looping for me. But what about the host sending a message to client.. That doesn't work ??

hmmmh.. that didn't compile
Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 16th Mar 2010 19:09 Edited at: 16th Mar 2010 19:09
I think the problem is this line:



You should use the zero-argument form of net send when sending from the server to the client, and vice versa.

Also, note that the server doesn't have an ID.
Masqutti
14
Years of Service
User Offline
Joined: 8th Jan 2010
Location: insanity
Posted: 17th Mar 2010 08:36
Hi! Thanks for your patience It must've been a horror to read thru my messy code ;D

Ok so you mean instead of "net send ID" I should use just "net send" ? How the host knows which client to send the message, or does it automatically just send it to all the clients? Is there a way to send a message to a specific client ? :o

hmmmh.. that didn't compile
Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 17th Mar 2010 13:09
I mean the host should use "net send ID" whereas the client should just use "net send".
Masqutti
14
Years of Service
User Offline
Joined: 8th Jan 2010
Location: insanity
Posted: 17th Mar 2010 14:17 Edited at: 17th Mar 2010 14:19
hmm I think I used that, as if host = 1 it means a program is hosting, so if host = 0(client) happens net send, else happens net send joined3, and joined3 is supposed to be a client ID :S

if host = 0 then net send else net send joined3

I guess there is something that messes up joined3 value.. I'm pretty confused as the first message arrives, but then the next ones that are sent with the same ID doesn't get recieved anymore :F

still the host recieves the messages always... Oh my god.. Do I see right I haven't declared the "host" variable as global !!! I hope that's the issue

hmmmh.. that didn't compile
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 21st Mar 2010 22:31
@Benjamin
I recently downloaded 1.4.1 and it's great. I have used it to make a LAN app, but how do I make it work over the internet?

I have tried asking that specific question on the DBP forrum with no luck.... I don't think anyone knows how to answer it. I know I need to do something with my router, but what IP do I use for the server and what IP do I use for the client?
I know I need to do port forwarding. I have a port set as:
Ext port:7777 Internal port:7777 protocal:TCP and the IP is set to the computer I am using (192.168.1.104). Is that set correctly?
So, I run the server program and set the IP to 192.168.1.104

Now what? If I simply run the client on the same machine and use the same IP as the server, that doesn't show me anything new.
I tried using the Internet IP Address, Default Gateway, and DNS. None of them work.... Obviously I'm doing something wrong, but what?

The fastest code is the code never written.
Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 22nd Mar 2010 06:18
For the server you must use your computer's LAN address (as you are currently doing), although remember that there's a version of net host without an IP address parameter that you could alternately use.

For the client: If connecting from the same machine or another machine on the network, specify the server's LAN address. If connecting from another computer on the internet, specify the computer's internet address (which can be obtained from whatsmyip.net). The latter requires that port forwarding be set up, which you've already done.
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 22nd Mar 2010 15:02
Dude, that's the most help I've received on this topic. Apparently you and those on this thread are the only ones knowlegable enough to even attempt to answer.
I had set it up the way you were describing, but I had no way of knowing if I had it right. I think I may be able to get someone to log in to me later on today. Thanks for the help.

The fastest code is the code never written.
Freedom Fighters
14
Years of Service
User Offline
Joined: 2nd Nov 2009
Location:
Posted: 23rd Mar 2010 13:06
Quote: "Sorry about the lack of activity, but I've been very busy lately and haven't had time to do much programming. However, I've taken a look at a suitable plugin I had written a while ago, and I'm writing an updated version. Should be ready in a few days I think. "


OK thanks. I've been in active and haven't had a look back for a while cause of some school work. but im looking forward to when you release it.

Problem Solution That Never Fails: "Build A Bridge And Get Over It"
bergice
16
Years of Service
User Offline
Joined: 5th Jun 2007
Location: Oslo,Norway
Posted: 26th Mar 2010 04:48
Hi my game stops working when i use the command: NetConnect("127.0.0.1");



Help plox ^_^

Dont mess with me, i have cookies!
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 26th Mar 2010 18:18
Did you start the server with that IP on the same machine? As you know, 127.0.0.1 is the internal IP.... A NetConnect() to an IP that doesn't have a server program running, will wait for a time-out before exiting the search.

The fastest code is the code never written.
bergice
16
Years of Service
User Offline
Joined: 5th Jun 2007
Location: Oslo,Norway
Posted: 27th Mar 2010 20:40
Yes i use

NetHost_IP(24,"127.0.0.1");

Dont mess with me, i have cookies!
bergice
16
Years of Service
User Offline
Joined: 5th Jun 2007
Location: Oslo,Norway
Posted: 28th Mar 2010 00:13
Fixed it, using NetHost and NetConnect on the same program is a bad idea :3

Dont mess with me, i have cookies!
bergice
16
Years of Service
User Offline
Joined: 5th Jun 2007
Location: Oslo,Norway
Posted: 28th Mar 2010 18:57
I have another question, by the way i love this plugin, its the first one i have successfully connected a host and a client and made it work ^_^

But i send message from client to host everytime the client moves, and the host sends his movement data when he moves, and they both receive that.

But if i want to get other data how can i know which data is which?

Dont mess with me, i have cookies!
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 28th Mar 2010 21:11
You make a "tag" at the beginning of the data string.

These constants are used when you send a message for the receiver to know how to interprit the data.

Just make sure that you keep the same format ALLWAYS! If a message type of MESSAGE_ID_CHARACTERDATA has the following:
name$
locationX
locationZ
facingAngle

Then MESSAGE_ID_CHARACTERDATA should have no more and no less than that exact format. Make up your own, but be consistant. Both server and client need to have the same message formats.

The fastest code is the code never written.
bergice
16
Years of Service
User Offline
Joined: 5th Jun 2007
Location: Oslo,Norway
Posted: 29th Mar 2010 02:41
Aha i see, thats pretty cool

Dont mess with me, i have cookies!
Jonas
18
Years of Service
User Offline
Joined: 10th Aug 2005
Location: What day is it?
Posted: 1st Apr 2010 18:54 Edited at: 2nd Apr 2010 18:52
Ben or Random_Helpful_Person,

Using the plugin with DarkGDK.

Meh, so what am I doing wrong here? I did up a quick server and simply added a NetConnect( ) command to the entry of one of my pieces of source code. The server picks up the connection, then after about 30 seconds... it crashes. The error code is literally for app_crash. No info on the debugger or anything.

Hosting from the same computer I'm running the client from. I've tried using 127.0.0.1 and my computer's actual wireless ip address. Running wireless over a Linksys WRT54G V5.1 with DD-WRT blown on. I have Win7 Pro x64. Need anything else just let me know.

So here's the source for the server:



BTW, love the concept. Are you planning on adding support for UDP?

Edit: Okay, so I know I posted this on April 1st... but it wasn't an April Fools joke. Was just noticing that.

Edit/Fix: Wow, so I completely didn't see this:



There might have been sort of an infinite loop problem occurring. Why the debugger didn't catch it is beyond me... but I found it at least. Server is 100% stable now. In fact, now it's just my client that's crashing. Gonna go have fun finding out why.

The question about UDP still stands though.

Update:

The client is crashing after I lock then unlock my computer. I also found out the connection will time out and disconnect the client after 30 seconds (oh hey look!) so I added a line to send up a 1 byte char (Z) every loop. Gonna let this post die. Its gotten kind of big. Sorry about that.

Here's the C++ source for all those requesting it. You'll notice the char consts at the beginning. I just kind of left them there to give people ideas. If you don't need them you know what to do.

Server:


Client:
bergice
16
Years of Service
User Offline
Joined: 5th Jun 2007
Location: Oslo,Norway
Posted: 2nd Apr 2010 18:33
Yo i got this thing working and im really happy with it etc

But i have made a server/client app where the server checks for connections and if a new player joins or leaves it will be processed to the player database with coordinates and if its used etc.

Then there is the client program that i can run several of (up to 24 for my server) and they will always send their player data to the host which processes it and sends all player data to all clients, so other clients can see eachother.

Now here is the problem, if i have more than 1 client it will lag for the host every 5-10 second and stop working until i deselect the window and reselect it. I dont understand why this is happening, and the more clients i connect the faster it seems to happen. This doesnt neccesarily have to be a problem as long as i dont need to do something in the server program or if it still keeps processing player data etc...

So i feel kinda stuck here

Dont mess with me, i have cookies!
Jonas
18
Years of Service
User Offline
Joined: 10th Aug 2005
Location: What day is it?
Posted: 2nd Apr 2010 19:02
bergice,

Got source? I'm bored and will be more than happy to take a look at it.
bergice
16
Years of Service
User Offline
Joined: 5th Jun 2007
Location: Oslo,Norway
Posted: 2nd Apr 2010 19:23
Um its pretty much a mess cause i havent put all of it into functions n stuff yet but sure ^_^

A good game designer can make all the diff-erence in the world mister freeman
bergice
16
Years of Service
User Offline
Joined: 5th Jun 2007
Location: Oslo,Norway
Posted: 2nd Apr 2010 19:24 Edited at: 2nd Apr 2010 19:27


You wont need the client code cause it only interacts by sending that data we receive

A good game designer can make all the diff-erence in the world mister freeman
Jonas
18
Years of Service
User Offline
Joined: 10th Aug 2005
Location: What day is it?
Posted: 3rd Apr 2010 08:28 Edited at: 3rd Apr 2010 13:19
Well a lot of your functions and some of your variables seem to be getting handled in your header files. But it would seem you're only handling messages when the application is not in focus.



Could it be that, while in focus, it's filling the receive buffer to the point where its too much? Then when you drop focus it handles it all? That would clear the received messages thereby freeing up memory and your server would return to normal until the buffer fills again while in focus.
Jonas
18
Years of Service
User Offline
Joined: 10th Aug 2005
Location: What day is it?
Posted: 3rd Apr 2010 17:22
So I threw together a 3D world and fixed some garbage (the source above won't work) and it's working pretty well. It doesn't show other players yet, but it does a good job of returning my own coordinates to me. Only a tiny bit of lag. Now I can only pray for UDP!

Thanks for a great plugin. I'll try to finish this client-server, but even if I don't, it was a fun new toy to play with.

Other thoughts: I was using Barnsky's Winsock plugin for DBPro. This plugin is most definitely up to snuff with his except for the UDP capabilities. But this one works for GDK, so great work and thanks again.
bergice
16
Years of Service
User Offline
Joined: 5th Jun 2007
Location: Oslo,Norway
Posted: 4th Apr 2010 14:03
Nice doesnt seem to crash now but this lags now if i run more than 1 instance (thats not so weird), so i will put that command back on when its finished thanks ;D

A good game designer can make all the diff-erence in the world mister freeman
Jonas
18
Years of Service
User Offline
Joined: 10th Aug 2005
Location: What day is it?
Posted: 4th Apr 2010 18:41
bergice,

I was getting some lag too. Those 1 byte packets I was sending as a connection keep-alive were just kind of building up in the buffer and the longer the client was connected, the greater the lag got (go figure 54mbit/s wireless couldn't keep up huh?) so I added a variable that counts up once per loop, and when it gets to 1500 (25 seconds at 60fps) it sends one packet. As you can imagine, this should be done with the system timer as, if the framerate drops, 1500 will take a longer time to get to and I'll miss my 30 second window. I'll fix that later. But the point is that as long as you aren't murdering the buffer, even tcp is relatively quick. Just remember to put yourself in your buffer's shoes. "How much is this guy asking me to do?! WHAT?!" TCP relies on that it waits for, and gets, a response or a timeout before it sends the next packet. Good luck to you on your project.
bergice
16
Years of Service
User Offline
Joined: 5th Jun 2007
Location: Oslo,Norway
Posted: 9th Apr 2010 19:27
Have been using the Net_Host_IP command for some time now and it has worked fine until i built the program today :/



A good game designer can make all the diff-erence in the world mister freeman

Login to post a reply

Server time is: 2024-02-27 04:21:19
Your offset time is: 2024-02-27 04:21:19