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 hbgames.org as well :/ )
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 http://www.gamedev.net/reference/list.asp?categoryid=30
and then a general search engine.
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.
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)".
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
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. :(
Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill