Networking..

Monkey Forums/Monkey Programming/Networking..

EdzUp(Posted 2011) [#1]
Is it possible to do networking with the HTML5 side of monkey, I would love to create a net game thats linked together with loads of people who play it but havent a clue where to start.

Does anyone have any idea where would be a good starting point for this?


Tachyon(Posted 2011) [#2]
I need to know this too. I have an opportunity to develop a browser game for a company, but I need the game to communicate with a remote server for account verification. It doesn't appear that Monkey has any native commands for this.


degac(Posted 2011) [#3]
http://www.monkeycoder.co.nz/Community/posts.php?topic=137

This should work for account verification, for 'networking' game I think it could be a little laggy...


a1programmer(Posted 2011) [#4]
For a game, you would want to use websockets.

Check this out: https://github.com/tjgillies/pacman
It's a multi-player pac-man game using html5 with websockets/nodejs.


Xaron(Posted 2011) [#5]
Is there a way to add networking in general for all targets in Monkey?

I don't ask for real time communication - anything simple would be great, something TCP/UDP based would be awesome.

I'd prefer to be able to connect to a dedicated server where the player can connect to and which handles the games (the server software has not necessarily to be written in Monkey)


EdzUp(Posted 2011) [#6]
yeah i would like that too :)


FlameDuck(Posted 2011) [#7]
Is there a way to add networking in general for all targets in Monkey?
Yes. But it's non-trivial and probably not generally useful. There are a lot of things you can't do very easily on some of the more exotic platforms (HTML 5).

Something simple like RESTful webservice client, would probably be much simpler since all platforms have a http client of some sort, and a SAX parser (you could even conceivably write your own written entirely in Monkey).

Ultimately it depends on what you want to use it for. Multiplayer arcade style games or an MMO, are probably not going to work out too great, but it could be suitable for simple pseudo-turnbased, mostly single-player games like Travian or Farmville.

You would probably (almost certainly!) have to use something else for the server side of things, may I recommend Java, Google App Engine, JPA, and RESTlet should give you a suitable, simple and annotation-driven cloud-based J2EE stack, and you can use Guice for your IoC needs.


Xaron(Posted 2011) [#8]
That would fit my needs. :)


Xaron(Posted 2011) [#9]
Ok, I need it, I'll implement it. First only simple http stuff (POST, GET) mainly for Android and iPhone first.


a1programmer(Posted 2011) [#10]
I've been looking into using the Google App Engine Channel API with Html5/Android/iOS. There's a JS API which can be ran in Android/iOS apps by use of a hidden WebView, with handlers within your application (onMessage, etc). I'll keep you updated on what I've got.


Xaron(Posted 2011) [#11]
That would be great! I need simple networking very urgently (simple http GET is all I need, even blocking - synchronous).


Xaron(Posted 2011) [#12]
Ok, HttpGet for Android works, will add the other platforms...

http://www.monkeycoder.co.nz/Community/posts.php?topic=725