Not logged inGosu Forums
Forum back to Help Search Register Login
Up Topic Gosu / Gosu Exchange / Direct IP Multiplayer over LAN And/Or Internet
- - By BlueScope Date 2010-09-13 15:47
As the title already says, I'm wondering how I'd approach doing that... I can't imagine it to be hard in general, however, I don't think it'll be that easy... XD

Just to make myself clear (in case I got the terminology or anything wrong): What I'm looking for is something enabling me to either select "Wait for incoming Request", or "Send request to IP", which should work by putting in an IP address. I can take care of all the frontend parts, but what I'm wondering is the code stuff behind it. I really have no idea about that section, other than I've already played games like that :p So yeah, some explanations would help me as well.

The other part not quite clear to me is how interaction would work... obviously, you have to check for multiple input devices of the same kind (multiple keyboards, for example), so how'd you do that? I can't really imagine that needing a new input module, but I can't imgine it working "just like that" either...

Any help is apprechiated!

Other than that, I've been away for some time now, but I should be here for a while again... (I guess that's what I do... happened to me for as well :/ )
Parent - - By RunnerPack Date 2010-09-13 19:04
I've never done a networked, multi-player game either, but I think what you want is a "socket" library. Ruby has sockets built-in, but I can't make any recommendations for C++ (you didn't specify what you'd be using) other than SDL (which, like I said, I've not used for networking).

I do know that, as far as the actual game mechanism goes, you need to transfer more data than just the two users' inputs to keep them properly synchronized.

Since this isn't really directly Gosu-related, you should look elsewhere to find a proper tutorial. I would check and and then a general search engine.
Parent - - By jlnr (dev) Date 2010-09-14 05:57
Actually, C++ Gosu comes with sockets, but there is sadly no example game. Maybe the doxygen is good enough though. Classes: ListenerSocket (TCP server), CommSocket (TCP client&server), MessageSocket (UDP). :)

Of course, for the general idea behind designing multiplayer games, all other resources are valid too. It is just worth keeping in mind that Gosu, as usual, keeps everything within a single thread with polling instead of threading and forking like mad. But designing a protocol, predicting movement etc. is the same.
Parent - By Quit Date 2010-09-14 15:56
Well, Chuadrat was one. But I left its code in the middle of a transition (P<->P to Server-Client with as many clients as possible), rendering it itself unusable. As far as I can tell is TCP pretty well.

Main reasons that something does not work with sockets are "I forgot to update() every socket", "I forgot necessary bindings (onReceive)".
- - By BlueScope Date 2010-09-15 11:42
Well, I always seem to forget to add that I'm using Ruby Gosu ^^"

So, I've been redirected to eventmachine in IRC, which is a network gem for Ruby... I'll have a look into it in the near future. Also, Thanks for the links provided in the first reply, that's very interesting stuff with nice means of downloading :o
Parent - By erisdiscord Date 2010-09-15 17:42
Event Machine is really awesome but I'm afraid I haven't found a good way to integrate with Gosu. You'll have to resort to multithreading (one for Gosu, one for EventMachine) and you need to make sure not to make any Gosu calls on any but the main thread. :(
Up Topic Gosu / Gosu Exchange / Direct IP Multiplayer over LAN And/Or Internet

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill