Java game server design

Hi,
I am new to Java game programming. Could anyone tell me or let me know some tutorial about multi-player java game design, especially game server design.
Thanks in advance
nqthanh

look here:
http://java.sun.com/docs/books/tutorial/together/index.html

Similar Messages

  • Game server: Map managing questions

    Hello everyone,
    I'm trying to develop some kind of RPG. I have different issues, where I need advice:
    1) Map(2D) managment on game server
    The map I want to keep in memory on server will contain objects such as: Item, NPC, Character, etc.
    Item, NPC, Character and other objects going to extend MapObject class, because I want to keep all this data in same place.
    Let's suppose that the map will have 50x50 tiles..
    I want to use Hashtable array to store elements there... So I will have something like this:
    Hashtable <String, MapObject>[][] map = new Hashtable[50][50];
    String(aka key) is going to be object_name + "_" + object_id..
    The questions are:
    - What about performance in this situation?
    - Is there any other data structure which can suite better to this situation?
    2) The other question I have is about sending map object(once in fixed period of time) and updates(for example some character walked or picked an item).
    The architecture I thought for sending data to client is:
    TCP Connection for authentication anc chat
    MultiCast Socket for synchronizing map object and sending updates
    - Is this aceptable architecture for server?
    - Is MultiCast socket good for sending updates and map object?(because there will be significant gain in term of computation on server, comparing to TCP, but what about losses of packets? what about traffic? what kind of protections(excluding timeouts) should I implement on client-side? )
    Thank you in advance.

    patriot87 wrote:
    Strange... I have also tried with 200k and same results... :D
    How comes?Well, one reason is that your test is broken. The first set of tests will always take longer, cause it's before hotspot has kicked in, etc. I moved the test to a method, precreated the objects (remember, if gc happens in one and not the other it's a huge difference), and called them repeatedly. Once I did that, there wasn't really a noticeable difference between them:
    import java.util.HashMap;
    import java.util.Hashtable;
    import java.util.Map;
    import java.util.Random;
    public class HashMapTest
       private static MapObject[] objs = new MapObject[200000];
       private static Random gen = new Random();
       public static void main(String [] agrs)
          for ( int i = 0; i < objs.length; i++ ) {
             objs[i] = new MapObject("ID" + i, "NAME"+i);
          hashMap();
          hashTable();
          hashMap();
          hashTable();
          hashMap();
          hashTable();
          hashMap();
          hashTable();
       private static void hashMap() {
          doTest(new HashMap<String, MapObject>());
       private static void hashTable() {
          doTest(new Hashtable<String, MapObject>());
       private static void doTest(Map<String, MapObject> map) {
          long start_time = System.currentTimeMillis();
          for (int i = 0; i < objs.length; i++)
             map.put(objs.id , objs[i]);
    for (int i = 0; i < objs.length; i++)
    int randomInt = gen.nextInt(objs.length);
    map.get("ID" + randomInt);
    System.out.println(map.getClass() + ": " + (System.currentTimeMillis() - start_time));
    class MapObject
    String name;
    String id;
    public MapObject (String id, String name)
    this.id = id;
    this.name = name;
    }Results of one arbitrary test:
    [pre]class java.util.HashMap: 343
    class java.util.Hashtable: 500
    class java.util.HashMap: 313
    class java.util.Hashtable: 328
    class java.util.HashMap: 453
    class java.util.Hashtable: 313
    class java.util.HashMap: 296
    class java.util.Hashtable: 454[/pre]
    Edited by: endasil on 13-Nov-2009 10:34 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Java Game Smart Card Implementation

    Hi,
    As an assignment i have been told to design a smart card application,(theory only). My idea was that of cross-platform java games that could be stored on a smart card,so for example:
    -the smart card could be used in PC and mobile (allowing games to be restarted at the same stage).
    -the card would store high scores, character info, and background environments
    - the card could send game data to friends, by either using the smart card in their devices or via the internet extracting and downloading from the card, or better still off the phone to anothers phone by selecting them from the address book
    I was wondering if there were any other ideas that i could use, and more importantly the technical details of how to implement such a card
    -ie which card
    -how much memory
    -the equipment required
    I would appreciate all the help you could give me, and it is quite an interesting topic.
    thanks
    jag

    http://forum.java.sun.com/thread.jsp?forum=23&thread=357393&tstart=0&trange=15

  • ACME video on Java Web Server 2.0

    ACME video was fairly easy to get running using the built in web server provided with JDeveloper 3.0. Things got a bit more difficult when I tried to deploy the web application portion to Java Web Server 2.0.
    Here's what I had to do to get it to work...
    1. The acmevideo_deploy.properties file must be copied independently to the JWS2.0 root directory. If an attempt to access the site fails indicating that this file could not be found, you should place it in whatever directory contains the file acmepropfile_loc.txt. The program is designed to write this file out to help you locate where the properties file should go. Too bad there is no mention of this in the docs!
    2. The imageURL property should be set to imageURL=/acmevideo/images/ for the image files to be found by the html generated by servlets. This value is set in the acmevideo_deploy.properties file mentioned above.
    3. Similarly, the webAppURL propery should set to point to the JWS2.0 server location. For example, on my system it's webAppURL=http://localhost:8080/servlet/WebAppServlet
    4. The following EJB jar files located in <JDEVELOPER>/samples/acmevideo/ejb/server must be added to the c:/acmedir directory and referenced in the CLASSPATH set in the batch file created and used to execute the web server.
    EJBGeneratedRentals.jar
    EJBGeneratedTitleQueries.jar
    EJBSourceRentals.jar
    EJBSourceTitleQueries.jar
    5. The jsdk.jar file that is referenced in the CLASSPATH and which you are directed to copy into acmedir is not required and does not reside in the location specified.
    Hope this helps anyone trying to get the sample running in all of its <ahem> glory. :-) Looks like a good sample app to base a project on if you aren't ready for J2EE or your application platform doesn't fully support the specification.
    Will
    null

    There is no need to install OAS or Oracle8i to test the servlet/jsp functionality in JDeveloper 3.0. You might want to check to insure that you installed all available components during installation (a few of them are hidden and you must scroll down to select them). Try running a few of the servlet/jsp samples before moving on to the full ACME video sample.
    Hope this helps,
    Will
    null

  • OPEN SOURCE JAVA GAME

    Hi, my name is Dydra and I have been programming an MMORPG in java this last two years. I want to publish an open source Java game to start a new generation of cross platform games, but I can´t do it by myself xD. So I want to share what I have done so far with everyone interested in programming games so that everyone can help making this game.
    All the code is not mine: some parts are from the book Killer Programming Games. I adapted the 3D MMO engine of that book to an 2D engine and customized some things.
    If anyone can tell me how to make this an open project here at sun forums, please tell me xD.
    Here is a youtube link with the game working so far:
    http://www.youtube.com/watch?v=CvNtx_pibwM
    PM me or email me if interested: [email protected]

    Do you know the best part? It is almost finished. The things that need to be finished are:
    -Leveling up and stats (no big deal)
    -GUI (like menus and invetaries. no big deal too)
    -NPC (this may be the most complex part)
    - Shop and Players Party/Trade
    -Drops
    THE REST OF THE GAME IS DONE! I already did a map editor with custom map objects and will be used to place Non Agressive NPCs. I also made a custom set up of menues and skills. To have a skill or item into the game you just need to open your wordpad and write the img file and what the item does (damage, heal, equip, instant spell, etc).
    I need help to improve animation of the sprites, skills, improve the GUI ( I did it all myself but it's kinda crappy, you know) and the NPC. As I want it to be a PVP oriented game because there is no real RPG PVP oriented game. Most PVPs are MMOFPS like GunZ.
    I eben have the host for the server! jajajajaj
    Need your help guy!!!! Di you hear me!!!??? jajaja
    Thanks for responding, I hope you'll join my PvP cause xD

  • Can we run an online game server on a os x server, can we run an online game server on a os x server

    can we run an online game server on a os x server

    Yes, you can.
    Probably unnecessary, though.
    OS X Server provides different services than what a game server expects and uses.  (There can be reasons to run OS X Server on your local network — mail services, web services, local DNS services, etc — and there can be reasons not to — fewer or no services configured running for the inevitable remote attackers to attack, etc.)
    If you're one of the many folks looking to run Minecraft Server here, that definitely doesn't require OS X Server.
    Once Minecraft Server and Java and the related peices are configured, the next biggest issue the Minecraft folks tend to encounter is with establishing a static or dynamic IP connection into the Minecraft Server — port forwarding and such — and with establishing the dynamic or static DNS translations to allow the remote users to connect to the server, and then with hardening the OS X or OS X Server system against the inevitable security attacks against the system.
    There are previous discussions of installing and configuring and troubleshooting the Minecraft Server bits posted around the forums, and it's likely been discussed elsewhere around the 'net, as well.

  • Wolf Shoe / Episode 1 from Dramatic Java Games

    Hi all,
    Our first episode will launch soon...
    For the first time europes best author, Morten Hjerl-Hansen and the superb graphics wiz Danni Tell brings together europes best actors on the Java platform.
    We're also entering in the Java Game Developers contest with this episode. Please try it and vote for us, but only if you absolutely loose your heart. We promise a historic breakthrough because we've invented a whole new game genre.
    * Never seen before graphics quality
    * Drama in games
    * Danger
    * Double player concept
    * Revives the adventure game genre by getting rid of puzzles once and for all
    Best regards
    The Creators
    Dramatic Java Games
    http://www.dramaticjavagames.com

    Thanks for you interest!
    Wolf Shoe is up in beta 1 and we made it to the dead line of the first JDC Game contest!
    Good luck!
    br
    www.dramaticjavagames.com
    PS The temporary server will be replaced soon. It's slow and unstable. We apologize for the inconvenience.

  • Server design (multithreading, serialization, and performance)

    (I'm not asking for anyone to design my software for me, I'm just looking for a response along the lines of "That's called XYZ server design, look for books on this topic" sort of thing.)
    Summary:
    I have a Server application (S) that accepts connections from many Clients (C). The clients request pieces of a large internal data structure, *"Data"* (D). The clients are totally passive with respect to Data, they only read (from the Server) and do not initiate any modification.
    D is really a structure of structures: it's hashtables of hashtables, with objects that hold other hashtables and vectors, etc. etc., down a few levels. The clients don't read the entire structure, just parts of it.
    The Server is multi-threaded, with threads handling client communications, and a very important thread that modifies Data by processing messages from an external source. I call this part of the software the Message Processor (P). These messages are what drives manipulation of the data structure.
    [**CLICK HERE FOR A DIAGRAM**|http://imgur.com/sb5ZU]
    There are a couple of design questions I'm wondering about:
    The data structure D is a shared resource between the Client threads and the Message Processor thread within the Server, with the Client threads only reading from the data structure (and writing over TCP/IP), and the Message Processor both reading and modifying it.
    Right now I am using locks to lock the structure when a client requests data, so that the processor cannot modify the data while it is being serialized.
    I also lock the data structure when a message is received and the structure has to be modified by P, to prevent the structure from being serialized while it is being modified.
    My question is, is this the only design pattern I can use in this situation? It looks like the only way to improve performance is to
    a) make sure I only lock when necessary (to prevent data corruption or inconsistency)
    b) lock the data for as short a time as possible
    c) make sure the parts of the data structure being sent to clients are serialized as fast as possible (write my own writeObject/readObject methods)
    Any insight is appreciated, the shorter and more candid, the better. Don't be afraid to say I'm in over my head and should read a few books by author so-and-so, that's a good starting point :)

    jta23 wrote:
    (I'm not asking for anyone to design my software for me, I'm just looking for a response along the lines of "That's called XYZ server design, look for books on this topic" sort of thing.)
    Summary:
    I have a Server application (S) that accepts connections from many Clients (C). The clients request pieces of a large internal data structure, *"Data"* (D). The clients are totally passive with respect to Data, they only read (from the Server) and do not initiate any modification.
    Are you using Servlets? That should facilitate the development of your server immensely (e.g., maintains sessions, handles multi-threading, implements HTTP out of the box, dozens of additional frameworks available, etc.)
    D is really a structure of structures: it's hashtables of hashtables, with objects that hold other hashtables and vectors, etc. etc., down a few levels. The clients don't read the entire structure, just parts of it.
    You can get away with using Map of Map or Map of List or whatever level of nesting you want. Generally, however, it is better to implement a canonical and rich domain model. [http://www.eaipatterns.com/CanonicalDataModel.html]. [http://www.substanceofcode.com/2007/01/17/from-anemic-to-rich-domain-model/].
    The Server is multi-threaded, with threads handling client communications, and a very important thread that modifies Data by processing messages from an external source. I call this part of the software the Message Processor (P). These messages are what drives manipulation of the data structure.
    [**CLICK HERE FOR A DIAGRAM**|http://imgur.com/sb5ZU]
    There are a couple of design questions I'm wondering about:
    The data structure D is a shared resource between the Client threads and the Message Processor thread within the Server, with the Client threads only reading from the data structure (and writing over TCP/IP), and the Message Processor both reading and modifying it.
    Right now I am using locks to lock the structure when a client requests data, so that the processor cannot modify the data while it is being serialized.
    I also lock the data structure when a message is received and the structure has to be modified by P, to prevent the structure from being serialized while it is being modified.
    My question is, is this the only design pattern I can use in this situation? It looks like the only way to improve performance is to
    a) make sure I only lock when necessary (to prevent data corruption or inconsistency)This can easily be handled by a Servlet. I think the best way to do this would be to create a Singleton. [www.javacoffeebreak.com/articles/designpatterns/index.html]. Be careful, however. Singletons are like global variables. They can easily be abused. If you did not want a singleton, create a lock table in your database. The RDBMS will handle synchronization for you, and it is an elegant solution. You can perform a similar feat using a filesystem lock that you create. Up to you. Whether in the JVM, in the database or in the filesystem.
    b) lock the data for as short a time as possibleWrite an efficient method to insert or update or delete the data. If you are dealing with a large amount of data, consider using a native tool like Oracle's SqlLoader or using vendor-specific JDBC syntax. If you need to support multiple types of databases, use bulk JDBC operations.
    c) make sure the parts of the data structure being sent to clients are serialized as fast as possible (write my own writeObject/readObject methods)
    Take a look at JBoss serialization. It is much more compact that Java's. Or do some experimenting. JSON is much more compact than XML normally, and it can be read by a Javascript client to facilitate any Ajax you might want to use for some flash and sizzle.
    Any insight is appreciated, the shorter and more candid, the better. Don't be afraid to say I'm in over my head and should read a few books by author so-and-so, that's a good starting point :)No, take it in bite sized pieces. Start with the server. Then work on the client. Play around with your locking strategy. Optimize your update of the data. Don't do everything at once.
    - Saish

  • Java ftp server which can use LDAP, how to integrate with WLS' implementation of LDAP?

    Howdy.
    I'm setting up a java ftp server
    (http://www.mycgiserver.com/~ranab/ftp/index.html) which is capable of using
    LDAP for it's user security. I would like to integrate this ftp server with
    wls' implementation of LDAP so I only have to admin one user list.
    Does wls put it's user list in the LDAP or in it's own proprietary setup? I
    tried playing around with it, but the users don't seem to appear in the JNDI
    tree. Is this where the LDAP stuff is located? I thought it was in there?
    If it's in it's own setup, is there a way to propagate the users to LDAP?
    If these look like newbie Q&A, I guess they kind of are, I'm new to LDAP.
    Thanks for any input you might have.

    Peter,
    If you are talking about using the embedded LDAP server in WLS 7.0 for this purpose
    I think you are going done the wrong path.
    Look at the following URL on how to use an external LDAP server for your custom
    application
    http://e-docs.bea.com/wls/docs70/secmanage/realm.html#1172008
    Chuck Nelson
    DRE
    BEA Technical Support

  • Installation Problem Sun Java App Server 8.2 PE

    Hello! every body Please help me to get out of this Monster :(
    For last 2 day i m trying to install Sun Java Application Server 8.2 PE. Installing & uninstalling Dozens of time.
    The Installation halted at *51% at Uncompressing sun-as-jsr88-dm.jar*
    I have searched the SDN forums at done every thing provided on the forum but in vain. So please help me i m using Win XP SP2

    `Hello!!!
    Any body there!!
    Such a big forum any body please help me i want to install the server.

  • Using Linux/Red Hat/Intel for Sun ONE/Java Directory Server

    Anybody have any experience of this? We're looking to get off AIX, and Total Cost of Ownership for using Solaris/Sparc versus Linux/Intel is very similar.
    The decider will be if no-one is using Linux as a platform for Sun ONE/Java Directory Server....
    Any feedback would be appreciated....

    We run Directory 5.1 in production on Solaris/Sparc, but I've tried it with sucess on Red Hat 7.2 on Intel. We have not been able to get it to work on Red Hat Enterprise 2.1 or 3.0. The main problem has been that the administration server fails on startup. Obvious the lack of support for the latest enterprise class Linux is a huge drawback. At this point I've decided to stay on Solaris/Sparc until Red Hat comes out with its own release of Netscape's Directory. When that happens we're going to evaluate whether to move the whole environment to Red Hat. The Sun and Netscape servers are almost identical in terms of features and performance, but having an open source version that can run on less expensive hardware would be a terrific win for us.

  • How can I download java game?

    Hi everyone, sorry for my english, it is not my native language.
    I have Game.Jar file, which is java game for Nokia ,and I uploaded this file into database.
    Now I have a filed, type of byte[] (array of bites)
    next, I generate URL like http://site.com/getfile.xxx?id=10, and then user go to this URL via WAP, and trying to send him byte[] array with java game data.
    But I don't know which Content-Type i must send :(
    I trying to send Content-Type: application/jar , but after downloading game into mobile phone, the game doesnt open :(((
    please help me!

    excuse me, it's actually application/java-archive
    This works for me (PHP) but unfortunately you have to rename the downloaded file to .jar:
    <?php
    $file = fopen("MimeTest.jar","r");
    header("Content-Type: application/java-archive");
    $text = fread($file,filesize("MimeTest.jar"));
    print $text;
    fclose($file);
    ?>You can try it out here: http://woogley.net/misc/MimeTest.php
    Download that and rename it to .jar and see if the data stayed in tact..

  • How to check if a user session is active in Java application server

    Hi Experts,
          We have a online scenario with a third party system by which a portal user will launch the third party application in a new window from portal. The SSO will work at the third party web application with the dynamic key that is generated by calling a webservice for that user. Now, as the user works on the launched screen, they will have to check whether the user (logged in portal) session is still active. ie., they will be periodically calling a service hosted by SAP java application server to find out whether the corresponding user who launched the session is still logged in or logged out.
    So, my question is, how can i find out programatically whether a user/user's session is still logged in/active in SAP Netweaver Java AS? We are in version 7.3.
    Kindly help me in this regard.
    Regards
    Vijay.K

    Hi Vijay,
    Could you check below links
    Tracing Single User Sessions - Administration - SAP Library
    Display and Manage User Sessions (SAP Library - Tools for Monitoring the System)
    Hope this helps.
    Regards,
    Deepak Kori

  • Sun java DIRECTORY SERVER 6.0 WITH SUN OPENSSO 8

    Hi all,
    I have install the sun java directory server 6.0.
    Now I have install the sun openssl ( I could had installed the sun java access manager but i wanna use the sun opensso 8 for SSO).
    when created the directory i.e. by using command from directory preparation tool, the directory server stop starting.
    It do not start and is asking me the error as follows,
    bash-3.00# /var/opt/SUNWdsee/dsins1/start-slapd
    [20/Feb/2009:14:44:30 +0500] - ERROR<4131> - Bootstrap config - conn=-1 op=-1 msgId=-1 - System error The entry cn=schema in file /var/opt/SUNWdsee/dsins1/config/schema/99user.ldif is invalid (error 20: Type or value exists) - attribute type sunIdentityServerDiscoEntries: Does not match the OID "1.3.6.1.4.1.42.2.27.9.1.821". Another attribute type is already using the name or OID..
    [20/Feb/2009:14:44:30 +0500] - ERROR<4129> - Bootstrap config - conn=-1 op=-1 msgId=-1 - Configuration error Please edit the configuration file to correct the reported problems and then restart the server. Server exiting.
    Server not running!! Failed to start ns-slapd process.
    Note: while preparing the directory (sun java directory preparation tool) I mentioned the schema 2 i.e. ACCESS MANAGER, because sun opensso 8 is the latest version for Sun java access manager ?
    Any help??????????????
    Regards
    Adeel

    Looks like the attribute sunIdentityServerDiscoEntries is defined twice in the schema. Run the following and see where it is defined for the second time.
    # cd /var/opt/SUNWdsee/dsins1/config/schema
    # grep -w sunIdentityServerDiscoEntries *.ldif | grep -iv objectclasses
    Edited by: etst123 on Mar 3, 2009 1:28 PM

  • Problem of DNS in Java Web Server

    Hi!
    I have problem, I have written servlets but when I run them using Java Web Server Exception arrises that DNS could not resolved however when I run the same code as application it gives correct results without exception. I am using the Java Web Server 2.0

    why r u using JWS? Sun has declared End of Life of JWS.
    why don't you use any other app server (like Tomcat ...etc)

Maybe you are looking for

  • I can't seem to get restore from backup to work

    I lost an entire feature film project in FCPX 10.1.2. Gulp. I was trying to export to Blu Ray, then tried to just export the Blu Ray file to hard drive, i.e., I gave it 2 commands at almost the same time. My fault, but then FCPX started acting funny,

  • Urgent: Assign new package to a form

    Hi everyone. I happened to assign a sapscript form to a wrong package. I deleted the form then afterwards I can no longer create it under the right package. Aside from just creating it using a new name, what options do i still have if i don't want to

  • Sharing photos with two users

    Am trying to get my husband's photo albums uploaded to my new Elements program?  Do we use photoshop.com and how do we get those pics?

  • How do i link it to my device

    how do i link my iphone to my apple id'

  • I can not connect to wifi with router WRT54G2 v1 with Windows 7

    Hi everyone: I have a Linksys WRT54G2 V1 and since I bought my new notebook with Windows 7 I can not access the wifi.  I have another notebooks with Windows Vista and a PC with Windows XP that connect perfectly, but with Windows 7 gives me error when