Multiplayer game applet

Hi,
I'm currently developping a multiplayer game as a personnal project. I thought of applet as an ideal mean of making this available easily from anywhere.
I designed the game, developped the core game code, and made a quick GUI. Then came the time to plug that together with a communication protocol.
Applets can only connect to the server it was downloaded from. No problem there, I can run the game server on the http server (the DB's there anyway).
I thought about RMI, but my first tests, although totally successful on my LAN, proved a nightmare when crossing the little familiar boundaries of my home network.
So I was wondering about writing my communication code using sockets instead and controlling my own game data frames.
So my question is, from your experience, what would you do to communicate between an applet and a server? RMI or sockets? Is there anything else which I haven't considered?
From what I read, RMI would require me to make the user install a policy file on their local disk, which is out of question.
Most communications will be initiated by the client, hence why I chose RMI, but I would have ideally to make some communications on the other side. Sockets would allow this two way communication, but from what I understood, it wouldn't work using RMI because this would mean for the applet to start a rmiregistry and listen on some ports?
I would really appreciate your input on which way I should head for my communication layer, which pitfalls awaits me and where I can get more details from similar projects.
Thanks!

Thanks for your input.
My problem is that I'm an utopist and want my game accessible to the most people possible. Everybody has a browser, but not everyone has web-start.
Having to install web-start or a policy file on their system might turn off some potential players from giving it a try. And in some environment, it may be simply impossible (my university's network admin won't let me install web-start, and this is the case in many other places for sure).
The sandbox is not a problem to me since I can run the game server from the http server and only connect to the server the applet was served from.

Similar Messages

  • A never ending multiplayer game?

    Hi
    I want to make a 2d spaceship multiplayer game (applet). The game should have lots of human controlled spaceships (and maybe some computer controlled spaceships if there are no human players). Each time a new user starts a game in its web browser, a new spaceship will appear in the game. The user will play until his spaceship is shot by another player. A shot spaceship will disappear from the game, and the player may choose to start a new game with a new spaceship. But the game on the server should never end. Each user will play in the same game on the server (but there may be a maximum number of players).
    Is it possible to make a game that never ends? Which requirements apply to the server? Is it possible to use a normal web server (you have only FTP access to the server computer)?

    this is a fast extract from my files, when you run Gclient the server will be launched and 2 clients will be opend, the red boxes are players
    using the mouse you move the box, the change of location is propagate thru the server.
    Server
    import java.io.*;
    import java.net.*;
    import java.util.*;
    public class Gserver
         private int    players = 0;
         private Vector ones = new Vector();
    public Gserver() 
         ServerSocket servS;
         Socket       clnt;
         try
             servS = new ServerSocket(4444);
              System.out.println("Server Ready on port: 4444");
              while(true)
                   clnt = servS.accept();
                   System.out.println(""+clnt);
                   One one = new One(clnt);
                   one.start();
         catch (IOException ex) {System.out.println(""+ex);}
    public void sendToAll(String s)
         for (int i=0; i < ones.size(); i++)
              One one = (One)ones.get(i);
              one.write(s);
    public void sendToOne(One me)
         for (int i=0; i < ones.size(); i++)
              One one = (One)ones.get(i);
              me.write(one.data);
    public class One extends Thread
         private Socket         socket;
         private BufferedReader in;
         private PrintStream    out;
         public  String         data;
    public One(Socket socket)  
         this.socket = socket;
    public void run()
         try
              out  = new PrintStream(socket.getOutputStream());
              in   = new BufferedReader(new InputStreamReader(socket.getInputStream()));
              ones.add(this);
              players++;
              int x = players*30-25;
              data = "P"+players+","+x+","+x+",";
              sendToAll(data);
              sendToOne(this);
              while ((data = in.readLine()) != null)
                  sendToAll(data);
         catch (IOException e) {System.out.println("one!!"+e);}
         close();
         ones.remove(this);
    public void write(String s)
         if (out != null)
              out.println(s);
              out.flush();
    public void close()
         if (socket == null) return;
         try
              if (socket != null) socket.close();
              if (in     != null) in.close();
              if (out    != null) out.close();
         catch (IOException e){}
         socket = null;
         in     = null;
         out    = null;
    public static void main (String[] args) 
         new Gserver();
    client GUI
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import java.awt.event.*;
    import java.util.*;
    public class Gclient extends JFrame implements KeyListener
         private Component me;
         private Container co;
         private Gsocket   socket;
    public Gclient()  
         super("Glient");
         setBounds(1,1,500,200);
         addWindowListener(new WindowAdapter()
        {     public void windowClosing(WindowEvent ev)
                   if (socket != null) socket.close();
                   dispose();     
                   System.exit(0);
         co = (Container)getContentPane();
         co.setLayout(null);
         co.setBackground(Color.black);
         addKeyListener(this);
         requestFocus();
         setVisible(true);
         if (socket == null)
              socket = new Gsocket(this);       
              if (!socket.isConnected())
                   dispose();     
                   System.exit(0);
              else socket.start();
    public void keyTyped(KeyEvent ke){}
    public void keyPressed(KeyEvent ke)
         int kc = ke.getKeyCode();
         if (me == null) return;
         Point o = me.getLocation();
         Point p = me.getLocation();
         if (kc == 40) p.y++;
         if (kc == 39) p.x++;
         if (kc == 38) p.y--;
         if (kc == 37) p.x--;
         if (!p.equals(o)) socket.write(me.getName()+","+p.x+","+p.y+",");
    public void keyReleased(KeyEvent ke){}
    public void go(String s)
         StringTokenizer tokn = new StringTokenizer(s.trim(),",");
         String p = tokn.nextToken();
         int    x = 0;
         int    y = 0;
         try
              x = Integer.parseInt(tokn.nextToken());
              y = Integer.parseInt(tokn.nextToken());
         catch(NumberFormatException e){}
         Component com = null;
         for (int i=0; i < co.getComponentCount(); i++)
              if (co.getComponent(i).getName().equals(p)) com = co.getComponent(i);
         if (com == null)
              JLabel l = new JLabel(p);     
              co.add(l);
              l.setName(p);
              l.setOpaque(true);
              l.setBackground(Color.red);
              l.setHorizontalAlignment(SwingConstants.CENTER);
              com = l;
              co.validate();
              if (me == null)
                   me=l;
                   setTitle(p);
         com.setLocation(x,y);
         co.repaint();
    public static void main (String[] args)
         Thread t = new Thread()
             public void run()
                   new Gserver();
         t.start();
         Gclient a = new Gclient();
         Gclient b = new Gclient();
         b.setLocation(b.getX(),b.getY()+220);
    client socket
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.util.*;
    import java.net.*;
    import java.io.*;
    public class Gsocket extends Thread
         private Gclient        client;
         public  String         host;//  = "10.20.2.58";
         private int            port  = 4444;
           private Socket         socket;
         private PrintStream    out;
         private BufferedReader in;
    public Gsocket(Gclient client)  
         this.client = client;
         port = 4444;
         try
              InetAddress ia = InetAddress.getLocalHost();
              host = ia.getHostName();
         catch (UnknownHostException ex)
         try
              socket = new Socket(host,port);
              out    = new PrintStream(socket.getOutputStream());
              in     = new BufferedReader(new InputStreamReader(socket.getInputStream()));
         catch(IOException ex)
              socket = null;
    public boolean isConnected()
         if (socket == null) return(false);
              else            return(true);
    public void run()
         try
              String data;
              while ((data = in.readLine()) != null)
                   client.go(data);
         catch(IOException ex)
         close();
    public void write(String s)
         out.println(s);
    public void close()
         try
              if (socket != null)     socket.close();
              if (in     != null) in.close();
              if (out    != null) out.close();
         catch (IOException e){}
         socket = null;
         in     = null;
         out    = null;
    }Noah

  • Online Multiplayer Games

    I know how to make simple single player java applets...
    but how do I make online multiplayer games?
    Is there a specific API or something? Where can I get some tutorials?
    Thanks.
    Edited by: Tekton on May 10, 2009 10:04 AM

    In my opinion, anyone wanting to get into game network programming should start here:
    http://www.gamedev.net/community/forums/showfaq.asp?forum_id=15
    it may not apply fully to java network programming, but this faq might bring some very important key concepts to your attention that you had no clue existed.

  • How to create a multiplayer game for steam using flash/flex?

    Hi guys,
    We've got a multiplayer game ready to go. Currently it is not multiplayer, but we'd like to get it to a stage where it can be played over the steam network by users of steam and owners of steam games.
    We'd like to if anyone could briefly give us a breakdown of how to get out game up on steam and available for multiplayer?
    Does steam host servers, and can we utilise a steam server to transfer data between players or would we have to run our own server?
    Currently were using flash builder to publish via adobe air to a windows desktop exe. Can anyone briefly explain how - once a player has downloaded the game from steam we can connect two players? Does anyone know how to use actionscript 3 to access steam network?
    Anyone have any experience developing multiplayer turn based game for steam using flash /actionscript 3 /adobe air?
    Thanks for your help in advance,
    i

    You would want to use the SteamWorks API, which is available from Steam as a C++ library, but there is most likely an Adobe Native Extension (ANE) that would allow you to use the library in AS3.
    I've never used SteamWorks but it seems to support peer-2-peer matchmaking (in other words, you wouldn't even need your own server, I think.)
    SteamWorks API:
    https://partner.steamgames.com/documentation/api
    Search results for "SteamWorks AIR ANE":
    https://www.google.com/search?q=steamworks+air+ane
    -Aaron

  • How do I set up my Airport Extreme to best use multiplayer games locally

    How do I set up my Airport Extreme to best use multiplayer games with my family. Everyone is located in the same house and uses the same router.
    I have tried a few games but have not  successfully connected  2 players

    That is a weird question, as your GAMES could be interpreted a hundred different ways. Are we talking about third party devices here or what?

  • Building P2P Multiplayer Games | MAX 2010 Develop | Adobe TV

    Learn how you can leverage peer-to-peer communication in Adobe Flash Player to enable multiplayer games on Facebook. This session will include an in-depth tutorial on peer-to-peer technology, a demo of how to use peer to peer in your games with Adobe Flash Builder and Flash Professional CS5, and deployment on the Facebook platform.
    http://adobe.ly/zRYemH

    Is there a transcript of this?

  • Images in my game applet

    I am having problems changing an image for buttons in my game applet. I can give them initial images but when i cant figure out how to change them.
    The method that houses the statement is static - but i cant use static method when i am getting images using getClass(). PLEASE HELP!
    P.S. My applet is housed in a jar!
    d6 = new ImageIcon(getClass().getResource("images/dom"+ active.playerDominoes[0].x + active.playerDominoes[0].y + ".gif"));
    domino6.setIcon(d6);
    //ERROR.............
    non-static method getClass() cannot be referenced from a static context
            d6 = new ImageIcon(getClass().getResource("images/dom"+ active.playerDominoes[0].x + active.playerDominoes[0].y + ".gif"));

    another easier way is:
    exchange getClass() with
    any class, like ImageIcon.class(The thing is that static classes "has no this" but the method
    getClass() returns the class of the this-object.)
    /n

  • How to put pause in a multiplayer game on Texas Hold'em?

    Anybody knows???

    I don't know if you can pause the multiplayer game, you might have to start over. If the normal method of touching 2 corners doesn't work I expect there is no way.

  • Tool to help you write multiplayer games

    I have created a tool to help Flash developers interested in
    writing multiplayer games. It should take care of a lot of the
    details of communicating with sockets, enabling you to focus on
    your game code. Advanced Actionscript and PHP coding skills are
    required:
    http://flashmog.net

    Apps have reviews.  Check the reviews from the public and get a sense of quality from them.

  • Multiplayer game programming - Code of a basic server

    I'm a beginner in multiplayer game programming and I'm looking for the code of a basic server for a multiplayer game. I don't mind which kind of game (I mean: chess, ping-pong, battlenet...) The important thing is the code pattern abnd the server structure.
    Could anyone help me?

    If you want to have a look at a generic multi-threaded server, check out the Java networking tutorial.. there's a basic example server that responds to a "Knock knock, who's there?" conversation.. you can start off with it..
    Of course it's not a game server but you could try sticking in a game engine to maintain the game world and change the user sessions to a proper game protocol.. e.g. sending key strokes or joystick movements. You could also get the server to send player and enemy positions etc...
    Good luck!

  • Full List Of iPad to iPad Multiplayer Games?

    Two friends of mine both have iPads. They want to know what games are available on the App Store that they can play together, in 2-player mode where each player has their own iPad. I tried searching on Google for an answer, but only found old outdated content.
    Can anyone help?

    I did a Google search using multiplayer games 2 ipads.
    Here's a start http://thenextweb.com/apps/2011/04/30/the-40-best-multiplayer-games-for-iphone-a nd-ipad/
     Cheers, Tom

  • Can someone point in the right direction for how to make a multiplayer game over the internet

    Hello,
    I am looking into making a game where two people who can be in different places would log on to the app, log in and can play - i.e. they would be connected over the internet. I'm looking for a hint on what is the direction to take and which technologies.
    For example is there a best practice for example if you make an app with DirectX and C++, and you use some kind of web service or something? or is it easier using C# and XNA? just looking for some pointers in the right direction. I have played around
    with DirectX, far from proficient but have familiarity, I have no experience with XNA but hear it's less hardcore and easier going. I'm particularly interested in what the best way to connect over the internet.
    Thanks

    What you are asking is very complicated and one of the more difficult things you can do in gaming. I'd strongly recommend you start smaller to learn and then move up to multi-player games as your skills grow.
    From the multiplayer client perspective it doesn't really matter which technology you use. You can write a multiplayer game in any engine or technology that can talk to the network. Choose the client technology that you are most adept at and interested in
    and learn it. You can go straight to DX, use a third party library such as Monogame (XNA isn't supported for Windows Store apps), or a complete game engine such as Unity. Once you can write a decent one-player game you'll have the foundation to start on to
    build a two-player game.
    At that point you'll need to define the problem much more specifically. As you state it, it is really wide open. How do you want the users to connect? Directly machine to machine? Matched through a web server but running client side? Connecting to a game
    running on a remote server? Something else?
    The network connection itself is probably fairly straightforward, but where to connect and how to manage that can be difficult. You'll have to decide what properties you want. Is this an action game where responsiveness is important or
    a turn based game where timing is less relevant?
    Are the players connecting locally or completely remotely? If the former then they can probably connect directly over the local network (NFC is great here). If the latter then they probably will need to connect to a matchmaker service to avoid firewalls.
    This can get very complex, but there are existing solutions you can use rather than writing your own.
    --Rob

  • You are not allowed to play multiplayer games on this device

    I can not play multiple games. I've searched for a solution and saw that
    The solution is in general-restrictions-enable restrictions-enable multiplayer games.
    But, multiplayer games and adding friends sections are greyed out! I can not enable them.
    How can I enable them ? Why they are greyed out ?!

    If your iPhone was provided by your company or another organization or is being managed by them (perhaps as part of connecting to the company's email system), they may have those features disabled. If that's the case, that's an issue you'd have to take up with your company.
    Regards.

  • Making a multiplayer game

    I am planning on making a multiplayer game, but the thing is
    i have never made one before. I can use java with flash if that
    helps. Does anyone know a tutorials i can use to help me learn.
    Thank You

    use google to search for tutorials.

  • Unable to play online multiplayer games!?

    Whenever I go to play Town of Salem (online multiplayer game) or even any other gaming websites, it takes me to a page stating that I need to update my Flash Player to a version 11.9? or higher even though (triple checking regularly) my flash player is on version 17.1.1. I have uninstalled and reinstalled my flash player 4 times now and it still doesn't work and my Firefox is up to date too. Not too sure whether it is a problem on my side or just the flash player doesn't like playing games on my laptop anymore.
    If it helps, I have another laptop (different brand) that has updated flash player and it plays games really smoothly.

    Manufacturer: Acer
    Model: Aspire 5253G
    Processor: AMD E-350
                    Processor 1.60 GHz
    Installed memory RAM:  4.00GB (3.73 GB usable)
    System Typer: 64-bit Operating System
    Flash Player Version: 17.0.0.169
    Your OS: Windows 7 (64bit)
    Your Browser: Mozilla Firefox, 37.0.2 (latest update)
    My sister has also told me she had a very similar problem only that it was facebook games that weren't working. She fixed the problem by switching some option "on" that was turned off by someone else.

Maybe you are looking for

  • Network outage don't bring down layer3 isdn

    Hi Everyone, Just wondering if someone ran through this case over the years... Scenario : 2 routers in mgcp with 1 T1 on each.  The DMS switch cascade the calls to the second T1 if the first one fail. In a case you lose network connectivity on the fi

  • Reinstalled Adobe Audition 3. Need proper link to receive authorization code.

    A few weeks ago, I could no longer open Adobe Audition 3. After having my computer serviced, I had the program reinstalled. When I tried to open Aud., a phone activation window instructed me to call the designated number and provided me with a new se

  • Satellite c855 unable to order recovery disk

    When i try to order the recovery disks from toshiba, i enter my serial number then it asks for the last 4 of my part number.  My serial number is xxxxxxxxx.  The first part of the part number is prefilled as PSC0YU-00.  My part number is PSCBLU-06600

  • ISync: Nokia 9300i--- Calender Sync Broken

    Hi, Post update to 10.4.9, there was a strange behaviour in iSync with Nokia 9300i. Every-time the sync was about to complete, it used to get broken (while syncing calendar). The phone get's message that the link is broken. I tried everything from re

  • Record video using webcam in webapplication

    HI all, I have a requirement like, need to record video through webcam in my webapplication. can u please guide me how can do that. i dont know anything how to do this. please guide me in solving this requirement. thanx in advance