Jump to content


Photo

Faucet Networking


  • Please log in to reply
379 replies to this topic

#361 thecrazygamemaster

thecrazygamemaster

    Devcodier

  • GMC Member
  • 670 posts
  • Version:GM:Studio

Posted 13 April 2013 - 07:01 PM

Well, I happen to have GM:S, so I decided to go the internal route and simply export the .gex from GM itself. All the functions now have fct_ added to the beginning of their names. The external call names have NOT changed, so it will most likely still work for everyone. It works for me.

 

https://dl.dropboxus... fct_ added.gex


  • 1

#362 darknessspliter

darknessspliter

    GMC Member

  • GMC Member
  • 40 posts
  • Version:GM8

Posted 14 April 2013 - 12:06 AM

Hey medo,I have a question about player movement.I want to make a smooth server sided movement.I made already a client sided movement by using the method of sending speed and coordinates on key press and release and wonder if I can have the same good results,by using a similar method,while having all the player variables and stuff on server.I really need to do this to make free from cheaters...Thanks!


  • 0

#363 Medo42

Medo42

    GMC Member

  • GMC Member
  • 219 posts

Posted 14 April 2013 - 09:14 PM

Hey medo,I have a question about player movement.I want to make a smooth server sided movement.I made already a client sided movement by using the method of sending speed and coordinates on key press and release and wonder if I can have the same good results,by using a similar method,while having all the player variables and stuff on server.I really need to do this to make free from cheaters...Thanks!

Short answer: Yes, you can simulate everything serverside and still have things smooth client side.

Long answer: The is done using techniques like interepolation / extrapolation that I really can't do justice here. Try to find information about it on the 'net, this is pretty universal to game networking and not specific to this extension.


  • 0

#364 Medo42

Medo42

    GMC Member

  • GMC Member
  • 219 posts

Posted 14 April 2013 - 09:15 PM

i took to trying to fix the names on the functions but the .GED file you have provided on github will not work in the package builder :S

What's not working? Are you missing the .dll file?

 

TCGM, can you give me the corresponding .ged? Otherwise I'll edit it myself for the repository.


  • 0

#365 thecrazygamemaster

thecrazygamemaster

    Devcodier

  • GMC Member
  • 670 posts
  • Version:GM:Studio

Posted 15 April 2013 - 12:03 AM

I have no idea what a .ged is or how to create it. Sorry :/


  • 0

#366 darknessspliter

darknessspliter

    GMC Member

  • GMC Member
  • 40 posts
  • Version:GM8

Posted 15 April 2013 - 06:56 PM

Hey medo,I have a question about player movement.I want to make a smooth server sided movement.I made already a client sided movement by using the method of sending speed and coordinates on key press and release and wonder if I can have the same good results,by using a similar method,while having all the player variables and stuff on server.I really need to do this to make free from cheaters...Thanks!

Short answer: Yes, you can simulate everything serverside and still have things smooth client side.

Long answer: The is done using techniques like interepolation / extrapolation that I really can't do justice here. Try to find information about it on the 'net, this is pretty universal to game networking and not specific to this extension.

Medo,I think that it will be better if movement comes from client.Thanks anyway...My problem is speedhacking,but I think I found a way to fix it. ;)


  • 0

#367 Pokefab

Pokefab

    GMC Member

  • GMC Member
  • 232 posts

Posted 19 April 2013 - 10:56 PM

Great engine, but I have a question:

 

How can I send/update the position of multiples of the same objects? For example, there are trees on the map, all the same object. I need to update the position of each one. How can this be achieved? Thanks.


  • 0

#368 T-bond

T-bond

    GMC Member

  • GMC Member
  • 2 posts
  • Version:GM8

Posted 21 April 2013 - 10:09 AM

Hello.
 
I made a chat with this extension. It's working very well.  :rolleyes:
 

My goal is, creating a multiplayer game with everybody can use, without port-forwarding.

I searched a lot on the internet, how can I do this, and I found the possibility about the "hole punching".

Can anybody help me, how can use "hole punching" with faucet networking?

 

I know I have to send an UDP message in every 3rd or 5th second in each program to the other.

But, I don't have any idea, how will my program know who want to join to the server.

 

Thanks in advance.


  • 0

#369 Medo42

Medo42

    GMC Member

  • GMC Member
  • 219 posts

Posted 23 April 2013 - 09:42 PM

Great engine, but I have a question:

 

How can I send/update the position of multiples of the same objects? For example, there are trees on the map, all the same object. I need to update the position of each one. How can this be achieved? Thanks.

Generally, loop over all the instances and send the position, then on the receiving end loop over all the instances again and receive the position. The trick is that the count and order of the instances needs to be in sync between server and client for this to work. For example, you could send a message each time an instance of that object is created on the server, and ONLY create it on the client when a message like that is received. Since GM loops over instances in instantiation order if you use with(object), the order between server and client should be consistent too if you use that. If you don't want to rely on this, you could also have a ds_list with all the instances on client and server and loop over that.


  • 0

#370 thecrazygamemaster

thecrazygamemaster

    Devcodier

  • GMC Member
  • 670 posts
  • Version:GM:Studio

Posted 23 April 2013 - 11:23 PM

Another method is to use multiplayer IDs, a system I use frequently. Basically, assign everything an id, then check everything for that id upon a message from the server (the server must send the id, of course).


  • 0

#371 Dinn D Lunnet

Dinn D Lunnet

    GMC Member

  • New Member
  • 2 posts
  • Version:GM8

Posted 03 May 2013 - 03:00 AM

Good Day.

I've been working with this extension on a rather big project and it works awesome, thank you very much for all your work.
Alas, I'm having a quite weird problem:

My game has a session set of rooms wich works with tcp to take information of 4 users max to then shift into udp and start a real time action gameplay. I have a function that works this way:

When somebody enters the session (there's only one per host), it sends info of his username to the host, then the host sends info of the session to the new client (how many players are in, which is his player ID, which map are they going to play on, length of the player 1 [host] username, player 1 username, length of the player 2 username, ... and the rest of them). Finally this info is also sent to the other players so they can know the new number of players and the username of the new player. This is hardly more than 40 bytes per user.

When the 4º player arrives, weird info is sent to player 2 (like his player ID is 109 instead of 2), after checking my code I thought I might been saturating the bandwidth so I splitted the info for every player into 3 steps (one for each) but that doesn't seem to work. Should I give more steps between piece of info and piece of info? or could it be that the problem is somewhere else? 

Thank you very much in advance.


  • 0

#372 Medo42

Medo42

    GMC Member

  • GMC Member
  • 219 posts

Posted 03 May 2013 - 06:34 PM

Hmm, I don't know what is happening. I assume the problem happens when still using TCP communication. In that case bandwidth / message length issues should not cause wrong data to be received - either you get an explicit error or you get the data that was sent*.

 

Whether it was in the TCP or UDP communication, you can probably learn more by recording your network activity with Wireshark to check what is actually sent / received. Wireshark only records actual network traffic though, so you probably have to put one game client on a different PC to make it work.

 

If you can't find the problem that way, make a copy of your game and try to throw out all the code that's not needed to reproduce the problem (or alternatively, just copy the things you need to get the problem). Try to make it as small as possible. If you still don't know what's going on by then, post that code here.

 

* Pedantic disclaimer: That's up to the reliability of TCP which can sometimes fail (it does have a somewhat weak checksum), but it's so rare that you probably don't need to worry about it when writing a game.


  • 0

#373 Dinn D Lunnet

Dinn D Lunnet

    GMC Member

  • New Member
  • 2 posts
  • Version:GM8

Posted 04 May 2013 - 07:00 AM

Thank you for the quick answer!
I solved the problem: following the code line by line I found a little mismanaged condition that led the game to read a ubyte it shouldn't be reading, and to its doom.
The detail about TCP sending an explicit error if there are issues will help me a lot detecting future problems, I will also have Wireshark close when we start doing extensive testing.
Thank you very much for your help! I will be sure to let you know when our project is finished.


  • 0

#374 T-bond

T-bond

    GMC Member

  • GMC Member
  • 2 posts
  • Version:GM8

Posted 06 May 2013 - 09:41 AM

Hello.
 
I would like to make a network scanner, too.
I have this code: (I call this script in create event.)

tb_LAN=udp_bind(23535);
write_ushort(global.tb_BUFFER,1);
write_ubyte(global.tb_BUFFER,0);
udp_send(global.tb_BUFFER,filename_change_ext(mplay_ipaddress(),".255"),23535);
buffer_clear(global.tb_BUFFER);

The server's step event has got this script:

while(udp_receive(tb_LAN)) {
    tb_Bytesize=socket_receivebuffer_size(tb_LAN);
    while(tb_Bytesize>0) {
        tb_Bytesize-=read_ushort(tb_LAN)+2;
        tb_MessageType=read_ubyte(tb_LAN);
        switch(tb_MessageType) {
            case 0: //Lan üzenet
                write_ushort(global.tb_BUFFER,11+string_length(global.tb_NAME));
                write_ubyte(global.tb_BUFFER,1);
                write_ushort(global.tb_BUFFER,string_length(global.tb_NAME));
                write_string(global.tb_BUFFER,global.tb_NAME);
                write_int(global.tb_BUFFER,global.tb_PORT);
                write_ushort(global.tb_BUFFER,Get_Players_Count()); //Get_Players_Count(); how many player is active
                write_ushort(global.tb_BUFFER,global.tb_PLAYERS[0,0]); //global.tb_PLAYERS[0,0]; ==10
                udp_send(global.tb_BUFFER,socket_remote_ip(tb_LAN),23535);
                buffer_clear(global.tb_BUFFER);
                break;
            default: //Ismeretlen üzenet
                break;
        }
    }
}

End this script is in the client's step:

while(udp_receive(tb_LAN)) {
    tb_Bytesize=socket_receivebuffer_size(tb_LAN);
    while(tb_Bytesize>0) {
        tb_Bytesize-=read_ushort(tb_LAN)+2;
        tb_MessageType=read_ubyte(tb_LAN);
        switch(tb_MessageType) {
            case 1: //Lan üzenet
                //return ip|játékos neve|port|játékosszám|max szám
                return socket_remote_ip(tb_LAN)+"|"+read_string(tb_LAN,read_ushort(tb_LAN))+"|"+string(read_int(tb_LAN))+"|"+string(read_ushort(tb_LAN))+"|"+string(read_ushort(tb_LAN));
                break;
            default: //Ismeretlen üzenet
                break;
        }
    }
}

 

If the server is running on ,,A" computer and the client is running on the ,,B" computer, the client will get the message.
But, if the server and the client is running on the same computer, the client doesn't recieve the UDP message

or if two clients are scanning only the first will get the message.

 

I think when the udp_send(buffer,xxx.xxx.x.255,12345) is start it will go until the message will send to an ip.
If it find an ip, it sends and the script is stop running.

 

And I have an other problem with UDP sending:

tb_LAN=udp_bind(12345);
write_ushort(tb_LAN,1);
write_ubyte(tb_LAN,1);
udp_send(tb_LAN,"xxx.xxx.x.xxxx",12345);

It doesn't send the message.

 

Can anybody help me?


  • 0

#375 Medo42

Medo42

    GMC Member

  • GMC Member
  • 219 posts

Posted 06 May 2013 - 09:28 PM

I can see one obvious problem with your code: Apparently, you are binding your UDP sockets to the same port everywhere.

Remember that a UDP message has two pieces of information to find the recipient: IP address and port number. If you have server and one client running on one PC and both try to bind a UDP socket to port 23535, both sockets represent the same [ip, port] pair so Windows would not know which application to send it to.

 

Use a random port on the client instead, by calling udp_bind(0) there. See the help.pdf for details, it should have something in the section about udp_bind.


  • 0

#376 Ruub

Ruub

    GMC Member

  • GMC Member
  • 426 posts
  • Version:GM:Studio

Posted 07 May 2013 - 09:32 AM

Hey Medo,

 

I've been having an eye on this topic, almost literally. Any updates planned for the (near) future? :)


  • 0

#377 Medo42

Medo42

    GMC Member

  • GMC Member
  • 219 posts

Posted 07 May 2013 - 08:01 PM

Not for the near future, sorry. I hope I'll find some more time for this again...


  • 0

#378 Black Doomer

Black Doomer

    GMC Member

  • GMC Member
  • 21 posts
  • Version:GM8.1

Posted 10 May 2013 - 04:06 AM

Hello, MedO,

 

We make a new version of Doom 2D Multiplayer with your FaucetNET extension and it works great. Excellent job, thanks!
But I have only one question: why the one function was named tcp_eof()? As I know, EOF abbreviation means "End-Of-File", and it's not appropriate here. :)


Edited by Black Doomer, 10 May 2013 - 04:08 AM.

  • 0

#379 Medo42

Medo42

    GMC Member

  • GMC Member
  • 219 posts

Posted 10 May 2013 - 07:17 AM

"End of stream" would probably be more appropriate, but it is called "End of file" in more than one networking API.

For example, see http://stackoverflow...n-a-socket-mean


  • 1

#380 Black Doomer

Black Doomer

    GMC Member

  • GMC Member
  • 21 posts
  • Version:GM8.1

Posted 10 May 2013 - 09:20 AM

Oh, I forgot the true meaning of word "file". Thanks for explanation.

And one more question. Can I get somewhere the raw version of the extension (that is, compiled but non-packaged DLL)? Thanks for advance.


Edited by Black Doomer, 12 May 2013 - 04:57 AM.

  • 0




2 user(s) are reading this topic

1 members, 1 guests, 0 anonymous users