Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411273 Posts in 69323 Topics- by 58380 Members - Latest Member: bob1029

March 28, 2024, 02:57:11 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityDevLogsFaucet Networking, a Game Maker extension
Pages: [1] 2
Print
Author Topic: Faucet Networking, a Game Maker extension  (Read 10473 times)
MedO
Level 1
*


View Profile
« on: January 15, 2011, 04:52:22 PM »

This is a new project which I started to work on about two months ago. It's a Game Maker extension that allows you to use TCP (and in the future, UDP) networking in your game.

Originally I just wanted to make some improvements to 39dll, which we have been using in the Gang Garrison project so far, and which (as far as I know) is the most prominent networking library for Game Maker currently in use. After a short while I decided to start from scratch and rethink the entire API, to provide the functionality game programmers actually need, as simply and robustly as possible.

I'm quite happy with the result so far, and managed to create a working version of Gang Garrison 2 built on that library. The extension should still be considered experimental for now however, because I'll probably change some of the functions or subtly alter how they work.

To do this fine tuning, I'll need some feedback though. So if you're interested in making multiplayer games with Game Maker, please have a look, try it out and then tell me what you think, and what could be improved.

You can find more information in the forum thread on ganggarrison.com.

Or directly download the current version (V1.0b2, includes documentation).
« Last Edit: March 23, 2011, 03:34:43 AM by MedO » Logged
deathtotheweird
Guest
« Reply #1 on: January 15, 2011, 05:00:04 PM »

this is awesome, considering the compo coming up is possibly multiplayer oriented. this couldn't have come at a better time.
Logged
MedO
Level 1
*


View Profile
« Reply #2 on: January 18, 2011, 11:32:12 AM »

Here's some information for people who are considering to use this for the compo. Please give it a try, I'd love to get some early adopters, but read through this info so you'll know what you're signing up for.

The extension is still in development and not feature-complete yet. For example, UDP support is planned but not added yet, and probably won't be in time for the compo. It's also not very well tested, but my modified version of Gang Garrison 2 which uses it works.

So why would you want to use an unfinished library? Essentially, because you can help maket it better, so that it will be completely awesome when it's finished. I will be available most days for the duration of the compo, to give support if you stumble over a bug, if you're missing a feature, or if you have a suggestion how to change the API to make some common task easier. I don't expect any bugs to show up that I can't fix within a day or two.

On the downside, this means that the functions of the extension might still change a bit, so you would have to change your code if you decide to use a updated version. I will try to prevent incompatible changes for the duration of the compo, but there are some improvements I'd like to implement first. Take a look now - it's already well documented and should be quite stable - but please give me until Monday to release an improved version with some modified functions before you start using it in earnest.

And please reply here if you are using or considering it. Smiley

Thanks for pointing me to the compo allen, or I might not have reacted as quickly.
Logged
ink.inc
Guest
« Reply #3 on: January 18, 2011, 11:55:31 AM »

I will definitely fucking check this out.

+1 to your userbase.
Logged
Paint by Numbers
Guest
« Reply #4 on: January 18, 2011, 12:09:43 PM »

The same goes for me! Definitely gonna try this out.
Logged
berareu
Level 0
**



View Profile
« Reply #5 on: January 19, 2011, 02:37:59 PM »

I'm trying this now and looks veeery nice! Good job!  Grin
Hope I can make you some questions about the extension in the near future! Thank you very much!
« Last Edit: January 19, 2011, 02:49:09 PM by RedSnake » Logged
MedO
Level 1
*


View Profile
« Reply #6 on: January 20, 2011, 10:19:03 AM »

New version (V0.4):
Download

Changes:
- socket_destroy always closes the connection gracefully now, for abortive closing use the new socket_destroy_abortive
- Added functions to set the desired byte order. The default is big endian now, which is incompatible to 39dll (You can change it with a single call though)
- tcp_receive and tcp_receive_available don't return a buffer anymore, but store the result in an internal receive buffer of the socket.

I think that I can keep the API stable now, but don't count on it yet. Smiley
Logged
Ozoh
Level 1
*


View Profile
« Reply #7 on: January 20, 2011, 10:22:57 AM »

Ohai Med0.
Anyways, going to check it out now, haven't done it yet.
Logged

berareu
Level 0
**



View Profile
« Reply #8 on: January 20, 2011, 02:50:11 PM »

I successfully established a connection between a server and a client and sent some data through the socket! That was a triumph!  Tears of Joy
Anyway thanks for the new version! But remember to check the examples, they didn't work for me with version 0.4  Smiley
Thanks again!
Logged
MedO
Level 1
*


View Profile
« Reply #9 on: January 20, 2011, 03:23:10 PM »

Huh? I thought I fixed them up, let me check.

Edit: I tested the examples again and they work for me. Are you sure you used the ones in the 0.4 zip file? And if so, what error did you get?

Anyway, congrats on getting connected Smiley
« Last Edit: January 20, 2011, 03:29:12 PM by MedO » Logged
berareu
Level 0
**



View Profile
« Reply #10 on: January 20, 2011, 05:34:14 PM »

Durp, sorry my fault!  Durr...?
Forgot to add the extension, everything works now!
Logged
berareu
Level 0
**



View Profile
« Reply #11 on: January 21, 2011, 02:41:48 PM »

Sorry for double posting but I have a question! Bear with me please, I'm a complete rookie with network coding  Tongue
I'm trying to make a game where one player is the host and the other is the client. Of course their game sceen needs to be synchronized. I started modyfing the code you provided us in the nettest example.. so i noticed that after the server accepted the connection
[ socket = socket_accept(acceptor) ]
the IF statement next to that line of code works only once... in fact I wasn't able to read anymore data with the server, like the socket accept function continued to return a negative. So i tried to modify the Step Event of the server object like this
[ if (socket<0) socket = socket_accept(acceptor) ]
And everything worked!
My question is... is that a right way to receive data with the server o am I doing it all wrong?  Cheesy
Sorry for bothering you, hope you can help me!
« Last Edit: January 21, 2011, 03:02:20 PM by RedSnake » Logged
MedO
Level 1
*


View Profile
« Reply #12 on: January 21, 2011, 07:41:27 PM »

socket_accept() will accept an incoming connection and return a socket which can be used to communicate over that connection. You are only opening one connection, so tcp_accept will only return a socket once. The idea is to keep this socket (which represents your end of the connection) for the whole time that the client is playing on the host.

The example code might give a wrong idea here, because it destroys the socket (and thus closes the connection) as soon as it's accepted. To be honest I wrote the examples more to test the extension than to demonstrate how to use it in a game.
Logged
MedO
Level 1
*


View Profile
« Reply #13 on: January 24, 2011, 03:14:12 PM »

I didn't manage to get the new version ready today, but the only remaining change from an API point of view is that it would remove the socket_handle_io()-function.

In order to give you the security you need to really start using this extension, I'll try to keep all further changes backwards compatible with the current version (V0.4) for at least the duration of the Versus competition.
Logged
Sean A.
Level 8
***



View Profile
« Reply #14 on: January 29, 2011, 01:33:44 PM »

I started using this yesterday for my compo entry but its my first time doing anything online, do you think you could include an example of just setting up a connection and have to people just moving around, it would really help me. I got a connection going already but now I'm not really sure how the send data and stuff.
Logged
MedO
Level 1
*


View Profile
« Reply #15 on: January 29, 2011, 02:22:51 PM »

I'll try to whip up a small example over the next few days.
Logged
Sean A.
Level 8
***



View Profile
« Reply #16 on: January 29, 2011, 04:43:17 PM »

Alright thanks a lot, it would really help me out because I've been going based off of the nettest.gmk and it isn't really the same setup as a player vs. player
Logged
MedO
Level 1
*


View Profile
« Reply #17 on: January 31, 2011, 01:30:03 PM »

Here's a small demo game I whipped up over the afternoon. It took a bit longer to make than I had thought it would, but I don't think it's quite original enough for submitting it to the Versus compo  Wink. I hope you can find your way around the source and see how it all fits together, but it's not all that big, so I trust in your abilities. Smiley

Also, keep in mind that this was just done quickly to give you a general idea. It's kinda ugly, probably has some bugs and it handles many situations (e.g. player disconnect, instant game start for the client without waiting for the connection) in a very simplistic way that you probably wouldn't want in a real game.

It runs on TCP port 12345. If you want to host and you're behind a firewall / NAT router, you have to forward that port to your PC.

http://www.ganggarrison.com/filehost/pong.zip
« Last Edit: January 31, 2011, 01:48:43 PM by MedO » Logged
MedO
Level 1
*


View Profile
« Reply #18 on: February 02, 2011, 08:04:53 AM »

V1.0a2 released

http://www.ganggarrison.com/filehost/Faucet Networking Extension v1.0a2.zip

Changes:
- socket_handle_io() is deprecated. Background tasks are performed by a worker thread now.
- IPv4 is now preferred when connecting by hostname.
- Some internal restructuring.

As promised, this is compatible with V0.4. It is still an alpha, mostly because I might have introduced some regressions during the restructuring.
Logged
Sean A.
Level 8
***



View Profile
« Reply #19 on: February 02, 2011, 09:17:44 PM »

Thanks a lot for putting that example out, I really appreciate it. I've been looking through it and learning a lot so hopefully I can get online play working in my compo game.
Logged
Pages: [1] 2
Print
Jump to:  

Theme orange-lt created by panic