Hi there,
I am still looking for a way to program my network game (four players on four different computers collaboratively control the direction of one object, each is responsible to move the object in one of four directions.) I guess one solution would be a server-client approach. Each client sends a value to the server, the server collects the input of the four clients and returns the input of all four to each client. I figured that using the Komhttpserver package I can easily run a server. My problem is now is the communication between clients and server. How can I send a value from each client to the server and get back the inputs from all clients? Thanks a lot Martin This is how I run my server. | ma | ma := ModuleAssembly core. ma serverRoot: FileDirectory default fullName. ma documentRoot: FileDirectory default fullName. ma directoryIndex: 'index.html index.htm'. ma serveFiles. (HttpService startOn: 8080 named: 'httpd') plug: ma rootModule _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
Hi Martin
> > I am still looking for a way to program my network game (four > players on four different computers collaboratively control the > direction of one object, each is responsible to move the object in > one of four directions.) > I guess one solution would be a server-client approach. > Each client sends a value to the server, the server collects the > input of the four clients and returns the input of all four to each > client. > > I figured that using the Komhttpserver package I can easily run a > server. > > My problem is now is the communication between clients and server. > How can I send a value from each client to the server and get back > the inputs from all clients? Have a look at HTTPClient examplePostArgs and HTTPClient httpGet: url As an alternative you might want to have a look at some remote messaging tools like soap opera http://www.mars.dti.ne.jp/~umejava/smalltalk/soapOpera/soapCore.html or rST http://wiki.squeak.org/squeak/2288 or maybe even osc http://map.squeak.org/package/61f807be-83a3-4944-bfa1-686ddac7153c Cheers Markus > > > Thanks a lot > Martin > > This is how I run my server. > > | ma | > ma := ModuleAssembly core. > ma serverRoot: FileDirectory default fullName. > ma documentRoot: FileDirectory default fullName. > ma directoryIndex: 'index.html index.htm'. > ma serveFiles. > (HttpService startOn: 8080 named: 'httpd') plug: ma rootModule > _______________________________________________ > Beginners mailing list > [hidden email] > http://lists.squeakfoundation.org/mailman/listinfo/beginners _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
In reply to this post by Martin Bleichner-2
Hi Martin,
MB> I am still looking for a way to program my network game (four MB> players on four different computers collaboratively control the MB> direction of one object, each is responsible to move the object in MB> one of four directions.) you may try simple Socket connections via UDP. ByteArrays make nice Buffers as ByteArray has methods to stuff in Floats, Integers and Strings. The class to look at is Socket. On the class side newUDP will create a new UD socket, which you assign a port via setPort: Receiving and sending is done via receiveUDPDataInto: and sendUDPData:toHost:port: You query the receiving socket with dataAvailable before actually receiving data. If you search the swiki or the mailing list archives for these method names you will find examples. Cheers, Herbert _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
In reply to this post by Martin Bleichner-2
UDP protocols are a good way to go here. I agree with Herbert. However, you have design work to do beyond just "how will this multiplayer node talk and listen". There's considerable design work involved in "what" these nodes need to be saying. An agreement on how timing and network delays or drops, especially with UDP Sockets, are handled would be part of your networked game design. There are design notes available on the World Wide Web about multiplayer UDP networked game designs that are pretty good reading. These folks aren't likely going to be talking about Smalltalk, but the concepts and general lessons learned are good. - Steve On Jun 5, 2009, at 5:05 AM, Herbert König <[hidden email]> wrote: Hi Martin, MB> I am still looking for a way to program my network game (four MB> players on four different computers collaboratively control the MB> direction of one object, each is responsible to move the object in MB> one of four directions.) you may try simple Socket connections via UDP. ByteArrays make nice Buffers as ByteArray has methods to stuff in Floats, Integers and Strings. The class to look at is Socket. On the class side newUDP will create a new UD socket, which you assign a port via setPort: Receiving and sending is done via receiveUDPDataInto: and sendUDPData:toHost:port: You query the receiving socket with dataAvailable before actually receiving data. If you search the swiki or the mailing list archives for these method names you will find examples. Cheers, Herbert _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
Hi Steve,
SW> There are design notes available on the World Wide Web about SW> multiplayer UDP networked game designs that are pretty good SW> reading. These folks aren't likely going to be talking about SW> Smalltalk, but the concepts and general lessons learned are good. any pointer? Would be interesting to read! Cheers, Herbert _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
In reply to this post by Martin Bleichner-2
Hi there,Here are some pointers to other network games/ stuff http://swikis.ddo.jp/NetMorph/17 http://www.jvuletich.org/Squeak/Scrabble/ScrabbleEng.html Karl _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
In reply to this post by Martin Bleichner-2
I think it was at www.codewhore.com - Steve On Jun 5, 2009, at 6:40 AM, Herbert König <[hidden email]> wrote: Hi Steve, SW> There are design notes available on the World Wide Web about SW> multiplayer UDP networked game designs that are pretty good SW> reading. These folks aren't likely going to be talking about SW> Smalltalk, but the concepts and general lessons learned are good. any pointer? Would be interesting to read! Cheers, Herbert _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
In reply to this post by Markus Gälli-3
Hi all,
thanks for the many suggestions. There does not seem to be THE way to do it. What would be the easiest way, even if that would be not the nicest solutoin. Hi Markus, when I try out the example i get. MessageNotUnderstood: MIMEDocument >>upToEnd the example should run through, shouldn't it? Martin 2009/6/5 Markus Gaelli <[hidden email]> Hi Martin _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
And another question: how do I stop the server again??
2009/6/5 Martin Bleichner <[hidden email]> Hi all, _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
In reply to this post by Steve Wessels
Hi Steve,
SW> I think it was at www.codewhore.com Thanks a lot looks interesting, Herbert _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
In reply to this post by Martin Bleichner-2
Am 05.06.2009 um 21:26 schrieb Martin Bleichner: > > Hi Markus, > > when I try out the example i get. > MessageNotUnderstood: MIMEDocument >>upToEnd > the example should run through, shouldn't it? > Martin right, also examples should be tested first... ;-) Ok, with the following (replace upToEnd with contents and omit the closing of the (non)stream: examplePostArgs | args result resultStream | args := Dictionary new. args at: 'arg1' put: #('val1' ); at: 'arg2' put: #('val2' ); yourself. resultStream := HTTPClient httpPostDocument: 'http://www.squeaklet.com/cgi-bin/thrd.pl' args: args. result := resultStream contents. Transcript show: result; cr; cr it kind of works. Modulo that squeaklet.com is not there anymore so you don't get any specific answers. If I were you I'd probably go for the udp solution mentioned by others. It would be great though to have some kind of Etoyish solution for your problem (think lightweight open croquet for etoys) with udp or osc or anything under the hood) so this is a very interesting question! Cheers Markus _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
Hello again,
I am making some slow progress. Well, I managed to run an example :) I run on one image the OldSocket example remoteTestServerUDP and on a second the remoteTestClientUDP. I hope that is the right direction so far. my transcript tells me that server and client endpoints are created, and some packets are sent. I get the following message: 4000 bytes/packet, 117packets/sec, 2370 packets dropped. he shouldn't drop packages, shouldn't he? Further, the image running the server is not responsive any more (does not react to anything). Is that how it is supposed to work? Thanks for your help. Martin 2009/6/6 Markus Gaelli <[hidden email]>
_______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
Hi Martin,
is this an exercise to learn Smalltalk or do you just want the 4-way control application? Martin Bleichner wrote: > Hello again, > > I am making some slow progress. Well, I managed to run an example :) > > I run on one image the OldSocket example remoteTestServerUDP and on a second > the remoteTestClientUDP. I hope that is the right direction so far. > my transcript tells me that server and client endpoints are created, and > some packets are sent. > > I get the following message: > 4000 bytes/packet, 117packets/sec, 2370 packets dropped. > > he shouldn't drop packages, shouldn't he? > > Further, the image running the server is not responsive any more (does not > react to anything). Is that how it is supposed to work? > > Thanks for your help. > Martin > > > 2009/6/6 Markus Gaelli <[hidden email]> > >> Am 05.06.2009 um 21:26 schrieb Martin Bleichner: >> >> >>> Hi Markus, >>> >>> when I try out the example i get. >>> MessageNotUnderstood: MIMEDocument >>upToEnd >>> the example should run through, shouldn't it? >>> Martin >>> >> right, also examples should be tested first... ;-) >> >> Ok, with the following (replace upToEnd with contents and omit the closing >> of the (non)stream: >> >> examplePostArgs >> | args result resultStream | >> args := Dictionary new. >> args at: 'arg1' put: #('val1' ); >> at: 'arg2' put: #('val2' ); >> yourself. >> resultStream := HTTPClient httpPostDocument: ' >> http://www.squeaklet.com/cgi-bin/thrd.pl' args: args. >> result := resultStream contents. >> Transcript show: result; >> cr; >> cr >> >> it kind of works. Modulo that squeaklet.com is not there anymore so you >> don't get any specific answers. >> If I were you I'd probably go for the udp solution mentioned by others. >> >> It would be great though to have some kind of Etoyish solution for your >> problem (think lightweight open croquet for etoys) with udp or osc or >> anything under the hood) so this is a very interesting question! >> >> Cheers >> >> Markus >> >> >> _______________________________________________ >> Beginners mailing list >> [hidden email] >> http://lists.squeakfoundation.org/mailman/listinfo/beginners >> > > > ------------------------------------------------------------------------ > > _______________________________________________ > Beginners mailing list > [hidden email] > http://lists.squeakfoundation.org/mailman/listinfo/beginners Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
Hi Derek,
I have to confess I just want the application. I assembled a small program with squeak and was happy that I could do everything I wanted within minutes. (Drag and drop of morphs and some scripting). Then I wanted to do that as a collaborative game and hoped that that would also be possible quite quickly. However, it turned out to be more difficult. So now I am stucked with network programing. I am simply interested in the result. However, if there is no other way I am also willing to learn how to get there. Martin 2009/6/6 Derek O'Connell <[hidden email]> Hi Martin, _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
Take a look at Scratch (http://scratch.mit.edu/). It has some networking
built in (http://scratch.mit.edu/forums/viewtopic.php?id=9458) and there may be a new version soon. I think there are some multi-player examples that might help you. Of course stick with what you are doing if it is going to expand on the idea but Scratch may help to quickly test the concept. As for your current code it looks like you are pushing around ~4MBit/sec so maybe that explains the dropped packets and unresponsiveness. This is probably a lot more than you need for your purpose. Maybe you only need to send ~20 updates/sec max? Martin Bleichner wrote: > Hi Derek, > > I have to confess I just want the application. I assembled a small program > with squeak and was happy that I could do everything I wanted within > minutes. > (Drag and drop of morphs and some scripting). > > Then I wanted to do that as a collaborative game and hoped that that would > also be possible quite quickly. However, it turned out to be more difficult. > So now I am stucked with network programing. > I am simply interested in the result. However, if there is no other way I am > also willing to learn how to get there. > > Martin > > > 2009/6/6 Derek O'Connell <[hidden email]> > >> Hi Martin, >> >> is this an exercise to learn Smalltalk or do you just want the 4-way >> control application? >> >> Martin Bleichner wrote: >>> Hello again, >>> >>> I am making some slow progress. Well, I managed to run an example :) >>> >>> I run on one image the OldSocket example remoteTestServerUDP and on a >> second >>> the remoteTestClientUDP. I hope that is the right direction so far. >>> my transcript tells me that server and client endpoints are created, and >>> some packets are sent. >>> >>> I get the following message: >>> 4000 bytes/packet, 117packets/sec, 2370 packets dropped. >>> >>> he shouldn't drop packages, shouldn't he? >>> >>> Further, the image running the server is not responsive any more (does >> not >>> react to anything). Is that how it is supposed to work? >>> >>> Thanks for your help. >>> Martin >>> >>> >>> 2009/6/6 Markus Gaelli <[hidden email]> >>> >>>> Am 05.06.2009 um 21:26 schrieb Martin Bleichner: >>>> >>>> >>>>> Hi Markus, >>>>> >>>>> when I try out the example i get. >>>>> MessageNotUnderstood: MIMEDocument >>upToEnd >>>>> the example should run through, shouldn't it? >>>>> Martin >>>>> >>>> right, also examples should be tested first... ;-) >>>> >>>> Ok, with the following (replace upToEnd with contents and omit the >> closing >>>> of the (non)stream: >>>> >>>> examplePostArgs >>>> | args result resultStream | >>>> args := Dictionary new. >>>> args at: 'arg1' put: #('val1' ); >>>> at: 'arg2' put: #('val2' ); >>>> yourself. >>>> resultStream := HTTPClient httpPostDocument: ' >>>> http://www.squeaklet.com/cgi-bin/thrd.pl' args: args. >>>> result := resultStream contents. >>>> Transcript show: result; >>>> cr; >>>> cr >>>> >>>> it kind of works. Modulo that squeaklet.com is not there anymore so you >>>> don't get any specific answers. >>>> If I were you I'd probably go for the udp solution mentioned by others. >>>> >>>> It would be great though to have some kind of Etoyish solution for your >>>> problem (think lightweight open croquet for etoys) with udp or osc or >>>> anything under the hood) so this is a very interesting question! >>>> >>>> Cheers >>>> >>>> Markus >>>> >>>> >>>> _______________________________________________ >>>> Beginners mailing list >>>> [hidden email] >>>> http://lists.squeakfoundation.org/mailman/listinfo/beginners >>>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Beginners mailing list >>> [hidden email] >>> http://lists.squeakfoundation.org/mailman/listinfo/beginners >> _______________________________________________ >> Beginners mailing list >> [hidden email] >> http://lists.squeakfoundation.org/mailman/listinfo/beginners >> > > > ------------------------------------------------------------------------ > > _______________________________________________ > Beginners mailing list > [hidden email] > http://lists.squeakfoundation.org/mailman/listinfo/beginners Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
In reply to this post by Martin Bleichner-2
Also do check out the previously mentioned NetMorph
(http://swikis.ddo.jp/NetMorph/17). The bit on "Remote Perform" looks like it will save you some work. Martin Bleichner wrote: > Hi Derek, > > I have to confess I just want the application. I assembled a small program > with squeak and was happy that I could do everything I wanted within > minutes. > (Drag and drop of morphs and some scripting). > > Then I wanted to do that as a collaborative game and hoped that that would > also be possible quite quickly. However, it turned out to be more difficult. > So now I am stucked with network programing. > I am simply interested in the result. However, if there is no other way I am > also willing to learn how to get there. > > Martin > > > 2009/6/6 Derek O'Connell <[hidden email]> > >> Hi Martin, >> >> is this an exercise to learn Smalltalk or do you just want the 4-way >> control application? >> >> Martin Bleichner wrote: >>> Hello again, >>> >>> I am making some slow progress. Well, I managed to run an example :) >>> >>> I run on one image the OldSocket example remoteTestServerUDP and on a >> second >>> the remoteTestClientUDP. I hope that is the right direction so far. >>> my transcript tells me that server and client endpoints are created, and >>> some packets are sent. >>> >>> I get the following message: >>> 4000 bytes/packet, 117packets/sec, 2370 packets dropped. >>> >>> he shouldn't drop packages, shouldn't he? >>> >>> Further, the image running the server is not responsive any more (does >> not >>> react to anything). Is that how it is supposed to work? >>> >>> Thanks for your help. >>> Martin >>> >>> >>> 2009/6/6 Markus Gaelli <[hidden email]> >>> >>>> Am 05.06.2009 um 21:26 schrieb Martin Bleichner: >>>> >>>> >>>>> Hi Markus, >>>>> >>>>> when I try out the example i get. >>>>> MessageNotUnderstood: MIMEDocument >>upToEnd >>>>> the example should run through, shouldn't it? >>>>> Martin >>>>> >>>> right, also examples should be tested first... ;-) >>>> >>>> Ok, with the following (replace upToEnd with contents and omit the >> closing >>>> of the (non)stream: >>>> >>>> examplePostArgs >>>> | args result resultStream | >>>> args := Dictionary new. >>>> args at: 'arg1' put: #('val1' ); >>>> at: 'arg2' put: #('val2' ); >>>> yourself. >>>> resultStream := HTTPClient httpPostDocument: ' >>>> http://www.squeaklet.com/cgi-bin/thrd.pl' args: args. >>>> result := resultStream contents. >>>> Transcript show: result; >>>> cr; >>>> cr >>>> >>>> it kind of works. Modulo that squeaklet.com is not there anymore so you >>>> don't get any specific answers. >>>> If I were you I'd probably go for the udp solution mentioned by others. >>>> >>>> It would be great though to have some kind of Etoyish solution for your >>>> problem (think lightweight open croquet for etoys) with udp or osc or >>>> anything under the hood) so this is a very interesting question! >>>> >>>> Cheers >>>> >>>> Markus >>>> >>>> >>>> _______________________________________________ >>>> Beginners mailing list >>>> [hidden email] >>>> http://lists.squeakfoundation.org/mailman/listinfo/beginners >>>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Beginners mailing list >>> [hidden email] >>> http://lists.squeakfoundation.org/mailman/listinfo/beginners >> _______________________________________________ >> Beginners mailing list >> [hidden email] >> http://lists.squeakfoundation.org/mailman/listinfo/beginners >> > > > ------------------------------------------------------------------------ > > _______________________________________________ > Beginners mailing list > [hidden email] > http://lists.squeakfoundation.org/mailman/listinfo/beginners Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
In reply to this post by Martin Bleichner-2
This is the wiki link for "Scratch Connections"
Martin Bleichner wrote: > Hi Derek, > > I have to confess I just want the application. I assembled a small program > with squeak and was happy that I could do everything I wanted within > minutes. > (Drag and drop of morphs and some scripting). > > Then I wanted to do that as a collaborative game and hoped that that would > also be possible quite quickly. However, it turned out to be more difficult. > So now I am stucked with network programing. > I am simply interested in the result. However, if there is no other way I am > also willing to learn how to get there. > > Martin > > > 2009/6/6 Derek O'Connell <[hidden email]> > >> Hi Martin, >> >> is this an exercise to learn Smalltalk or do you just want the 4-way >> control application? >> >> Martin Bleichner wrote: >>> Hello again, >>> >>> I am making some slow progress. Well, I managed to run an example :) >>> >>> I run on one image the OldSocket example remoteTestServerUDP and on a >> second >>> the remoteTestClientUDP. I hope that is the right direction so far. >>> my transcript tells me that server and client endpoints are created, and >>> some packets are sent. >>> >>> I get the following message: >>> 4000 bytes/packet, 117packets/sec, 2370 packets dropped. >>> >>> he shouldn't drop packages, shouldn't he? >>> >>> Further, the image running the server is not responsive any more (does >> not >>> react to anything). Is that how it is supposed to work? >>> >>> Thanks for your help. >>> Martin >>> >>> >>> 2009/6/6 Markus Gaelli <[hidden email]> >>> >>>> Am 05.06.2009 um 21:26 schrieb Martin Bleichner: >>>> >>>> >>>>> Hi Markus, >>>>> >>>>> when I try out the example i get. >>>>> MessageNotUnderstood: MIMEDocument >>upToEnd >>>>> the example should run through, shouldn't it? >>>>> Martin >>>>> >>>> right, also examples should be tested first... ;-) >>>> >>>> Ok, with the following (replace upToEnd with contents and omit the >> closing >>>> of the (non)stream: >>>> >>>> examplePostArgs >>>> | args result resultStream | >>>> args := Dictionary new. >>>> args at: 'arg1' put: #('val1' ); >>>> at: 'arg2' put: #('val2' ); >>>> yourself. >>>> resultStream := HTTPClient httpPostDocument: ' >>>> http://www.squeaklet.com/cgi-bin/thrd.pl' args: args. >>>> result := resultStream contents. >>>> Transcript show: result; >>>> cr; >>>> cr >>>> >>>> it kind of works. Modulo that squeaklet.com is not there anymore so you >>>> don't get any specific answers. >>>> If I were you I'd probably go for the udp solution mentioned by others. >>>> >>>> It would be great though to have some kind of Etoyish solution for your >>>> problem (think lightweight open croquet for etoys) with udp or osc or >>>> anything under the hood) so this is a very interesting question! >>>> >>>> Cheers >>>> >>>> Markus >>>> >>>> >>>> _______________________________________________ >>>> Beginners mailing list >>>> [hidden email] >>>> http://lists.squeakfoundation.org/mailman/listinfo/beginners >>>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Beginners mailing list >>> [hidden email] >>> http://lists.squeakfoundation.org/mailman/listinfo/beginners >> _______________________________________________ >> Beginners mailing list >> [hidden email] >> http://lists.squeakfoundation.org/mailman/listinfo/beginners >> > > > ------------------------------------------------------------------------ > > _______________________________________________ > Beginners mailing list > [hidden email] > http://lists.squeakfoundation.org/mailman/listinfo/beginners Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
when I reduce the amount of data it does not lose packages. so, that is solved.
How would the netMorph integrate in the UDP approach? I am a bit overwhelmed by the many possibilities. and its difficult as a beginner to see through the forest. I go for the UDP approach at the moment and hope that I will get somewhere :) 2009/6/6 Derek O'Connell <[hidden email]> This is the wiki link for "Scratch Connections" _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
Martin Bleichner wrote:
> How would the netMorph integrate in the UDP approach? In NetMorph you are working at a much higher level. I suppose you might create copies of the morph to be manipulated and migrate them out to the clients and possibly each client might push a dummy morph back to the server so they can centralise user input. It might even be as simple as each client migrating a morph to the next, which the client still controls. Close the loop and you have continuous updates. Experiment :-) I have had NetMorph running here. The migrating of a morph between images is not instantaneous but once it is then remote calls should be quick enough. > I am a bit overwhelmed by the many possibilities. and its difficult as a > beginner to see through the forest. I know that feeling :-) > I go for the UDP approach at the moment and hope that I will get somewhere > :) Good luck! _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
Hi Derek,
I am sitting in front of my computer laughing. That just works, the way I thought it should. Perfect, brilliant. I like 'much higher level' :). it was mentioned before but I didn't get it. Thanks!!! 2009/6/6 Derek O'Connell <[hidden email]>
_______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
Free forum by Nabble | Edit this page |