This site requires JavaScript, please enable it in your browser!
Greenfoot back
dagraphx
dagraphx wrote ...

2011/3/3

Where do I start with networking?

dagraphx dagraphx

2011/3/3

#
I would like create an LAN link in greenfoot for a non-gallery game, but where would i start? The game is simply a player verses player game where players would just join in on one screen and play each other
davmac davmac

2011/3/5

#
It's a big topic. Personally I'd start with learning about networking (and specifically TCP/IP) generally. It's a more complicated than you might realise. Make sure you understand IP addresses, ports, and the difference between stream-oriented transport (TCP) and packet-oriented (UDP). You'll need to figure out what data you want to send between instances of the game, and how exactly to handle that. You'll need to turn the data into a sequence of bytes to send over the network, and then turn it back into something meaningful on the other end. You'll probably want to have an actor or the world check for new network data in each act() round, decode it, and handle it appropriately. The best advice I can give is, get yourself a book on networking and perhaps specifically Java network programming. (Even if it means going to the library!). But, if you have more specific questions, you can always ask here.
mik mik

2011/3/5

#
For an online tutorial, you could start here: http://download.oracle.com/javase/tutorial/networking/index.html And I'd look especially at the section about sockets. That's maybe a good place to start with networking.
mjrb4 mjrb4

2011/3/5

#
I did once implement a networked game in Greenfoot that worked - ish (not on the gallery though.) http://greenfootgallery.org/scenarios/221 It seems to work ok for me once I've downloaded it.
CrazyGamer1122 CrazyGamer1122

2012/8/5

#
i was thinking about this also.coding this kind of game would be a challenge but still fun.
You need to login to post a reply.