General Game Programming Questions

Hey All,
I'm a reformed C# / VB.Net MMOPG game programmer who want's to take a crack at making MMORPG's using Java. Mainly because I'm tired of paying the big $$$ for M$'s products when I'm finding Java has a nice assortment of high quality RAD tools and the such for next to nothing, if not free. The only free IDE's for the .Net platform at the moment is a still too early in beta (buggy) to be productive with. Anyways after buying a couple of Java books and knocking them out in a week's time, I'm feeling pretty confident about making Java work for me. I do however have a few questions that the books I purchased failed to answer so here they are..
Is it possible to compile Java applications (game clients in my case) in a stand alone executable form? I would like a install system where users can just install my game client without them having to worry about having the latest versions of Java ,etc, ie.. I want it to be a easy one click install application.. Does Java offer this? That was another thing that turns me off about the .Net platform, many people don't want to take the time to install the .Net runtime just to check out my game applications...
I was wondering how Java handles Images, Does Java package up all your images into a .Jar file? A game client can have 100's of sprite sheets, mesh's, skins, etc, ie.. Say I were too make a Applet game client, how would java handle all the images? Would the players download the images while the applet loads?
Well thats really all I wanted to know.... Thanks In Advanced...

If you do a search on the forums for "java exe" or something similar, you will probably find about a billion posts asking and answering the same question. The answer is yes, but you will of course make the game windows dependent. Also I think the executable turns out to be quite large and doesn't work without its quircks... a better approach is to install the java runtime with the install of your game. User would never even notice.
As far as how java handles images, for an applet the images will be downloaded with the applet, but will not be loaded until called upon in the program. You can package all the images into a jar file, or you can just leave them in a directory/directories, although packaging them into one jar would be faster due to downloading only one file and compression.

Similar Messages

  • General java programming question.

    i have trouble knowing when something is referred to in contrast to something being copied.
    in this case, the array has changed, but not the character.
    public class ReturnArray2
         public static int[] getArray()
              int a[] = new int[3];
              a[0] = 2;
              a[1] = 4;
              a[2] = 6;
              return a;
         public static void mystery(int[] b, char r)
              r = 'Q';
              for(int i = 0; i < b.length; i++)
                   b[i] = b[i] + 5;
              System.out.println("array b contains: ");
                   for(int i = 0; i < 3; i++)
                        System.out.println(b[i] + " ");
         public static void main(String args[])
              int scores[];
              char x = 'L';
              scores = getArray();
              System.out.println("Array in main.");
              for (int i = 0; i < 3; i++)
                   System.out.println(scores[i] + " ");
              mystery(scores, x);
              System.out.println("After return from mystery.");
              System.out.println("character is " + x);
              for(int i = 0; i < 3; i++)
                   System.out.println(scores[i] + " ");
    Array in main.
    2
    4
    6
    array b contains:
    7
    9
    11
    After return from mystery.
    character is L
    7
    9
    11
    */and in this case, why didn't the array change?
    public class ReturnArray2
         public static int[] getArray()
              int a[] = new int[3];
              a[0] = 2;
              a[1] = 4;
              a[2] = 6;
              System.out.println("array in function");
              for(int i = 0; i < 3; i++)
                   System.out.println(a[i] + " ");
              return a;
         public static void mystery(int[] b)
              for(int i = 0; i < b.length; i++)
                   b[i] = b[i] * 2 + 5;
              int[] c = new int [3];
              c[0] = 55;
              c[1] = 44;
              c[2] = 33;
              System.out.println("array c contains: ");
              for (int i = 0; i < 3; i++)
                   System.out.println(c[i] + " ");
              b = c;
              System.out.println("array b contains: ");
                   for(int i = 0; i < 3; i++)
                        System.out.println(b[i] + " ");
         public static void main(String args[])
              int scores[];
              scores = getArray();
              System.out.println("Array in main.");
              for (int i = 0; i < 3; i++)
                   System.out.println(scores[i] + " ");
              mystery(scores);
              System.out.println("After return from mystery.");
              for(int i = 0; i < 3; i++)
                   System.out.println(scores[i] + " ");
    array in function
    2
    4
    6
    Array in main.
    2
    4
    6
    array c contains:
    55
    44
    33
    array b contains:
    55
    44
    33
    After return from mystery.
    9
    13
    17
    */

    i have trouble knowing when something is referred to
    in contrast to something being copied.Java has only one passing mode: pass-by-value. The value, whether it be of an int or a reference, is always copied.
    in this case, the array has changed, but not the
    character.A reference has a value, that value is either null or the address of an Object. The value of scores is the address of the array returned by getArray(). When you pass scores to mystery() the value of scores is copied to a new reference called b on the local stack frame. The value of b is the same as the value of scores, but they are two different references. However, since the value is the same they both contain the same address which is the address of the array. When you modify the array you are modifying the array at the address that b has as it's value. Since scores has that same address as it's value, in other words they both point to the same array, you will see it modified in both places. When you passed the char the value (L) was copied to the local stack frame. Your copy r now has the value L. Modifying r modifies the value at r, which is independent of the value at x.
    So, with the char you changed the value at the address. With the reference you changed the value at the address the reference contained as it's value.
    and in this case, why didn't the array change?You didn't modify the array, you simply printed it's contents concatenated with an empty String.

  • Applet Game Programming - player movement

    HI Java Experts,
    I have a very simple question applet game programming - jdk 1.02.
    Let's say you have a player on the applet window. He can move right and left.
    Naturally you have an image representing the player. When the player moves left you present an image loop with him running left. And vice versa for running right.
    Of course when he stops moving you just want to show a still image.
    What do you guys feel is the best technique for that situation ?
    Stephen

    Hi Thanks for the advice.
    I'm under the impression that if I used jdk1.4
    everybody who wanted to play the game would have to go
    through the trouble of downloading something . If
    that is so, then i would like to stick with 1.02 to
    have the widest possible audience.Use Java Web Start to deploy it as an application instead of an Applet. If your program is really cool, people will download the JDK 1.4 to use it. Then we will have more java users in the world :)
    By the way i have a URL perhaps someone could look > at the source code and give additional suggestions
    you can make sonic the hedge hog run and jump
    http://www.swebdev.com/Adventure.html
    That code has some good points. I like the nice object oriented flow of it. However, the way he sets up the Thread is all wrong. He uses yield and sleep, you would want to set up this using wait() and notifyAll() calls if you want to make it more interesting.
    Right now i'm trying to address the issue of how to
    reverse the image for when the player is running the
    opposite way -- ? perhaps a separate thread in 1.02
    might be an answer? I would be glad to hear all kinds
    of suggestions on the sample code seen thereYou shouldn't need a separate thread just to reverse the image. If your little guy is already in his own thread, just switch the image that is displayed when the player hits the opposite direction key.
    Think of threads like puppets, and you are the puppet master. Your little guys is a puppet, so he should be in his own thread. You can make him do whatever you want from your thread (the master) by pulling strings (changing globals, and message passing)
    Wow... Thats a really good analogy... I just thought that up :)

  • J2Me game programming plz help

    Helo everyone,
    I am working in j2me game programming plz if
    any one know how make image as small as possible
    in our game program.?
    I am using *.png format of image which is working well
    in game but my game size is very big so plz help me to get
    out of this problem
    Thank u
    Aman Gautam

    I solved the same problem by using indexed color images instead of true color.
    So, for example, if you have a colorful background you can convert it to a 256 color image.
    Depending on your specific image and the devices you'll see it on you may or may not notice the difference, but the file size is generally smaller.
    Then you can push further for smaller elements, like, say, a moving object like a pointer or a starship, you can reduce it to 60 or 30 colors, or even less.
    Another technique is to use tiles to build up the background instead of big images. With MIDP2.0 there's the TiledLayer, but you can implement the same with some code also on MIDP1.0 if backward compatibility is of concern.

  • Mobile Game Programming

    Hey All,
    I am a decent Java programmer but in last few days I found Java Game Programming intresting and has strong future for ones career.
    I wanted to know what do Expert over here have to say about this ?
    and
    Where do I need to start In order to get to know about it ?(I mean under Java).
    Thanx
    Messy

    I suggest you move to this forum and ask your question again.
    http://forum.java.sun.com/category.jspa?categoryID=23

  • Game programming

    I am new to game programming and J2ME. how can i integrate animated clips and application using J2ME>

    Well thats kinda general... In my opinion java is a great language. Just not for games usually. Also what kind of game? 2d or 3d? I would recommend checking out unity for 3D games. I have used it and it is a great tool for people looking to make 3D games without as much work. Plus it supports execution in a browser like an applet kindof. For 2D i usually use flash as it greatly simplifies the process. If your hearts set on Java start off with this- http://www.tutorialized.com/view/tutorial/2D-Java-Platform-Game/10145

  • Game Programming Errors

    I'm trying to make up a game program for a school progect, and I'm having some troubles with it.
    I'm having multiple errors in the following areas: 1. Find symbol contructor/method. 2. Inconvertible types. 3. Jump[] in GameSrc.Player cannot be applied [boolean].

    Well thats kinda general... In my opinion java is a great language. Just not for games usually. Also what kind of game? 2d or 3d? I would recommend checking out unity for 3D games. I have used it and it is a great tool for people looking to make 3D games without as much work. Plus it supports execution in a browser like an applet kindof. For 2D i usually use flash as it greatly simplifies the process. If your hearts set on Java start off with this- http://www.tutorialized.com/view/tutorial/2D-Java-Platform-Game/10145

  • I recently downloaded a 10.6.8 update and a game program has now been reduced in size.  It's specifications are set for full screen, but it is about 1/4 of the size.  Any ideas how to fix?

    I recently downloaded a 10.6.8 update and a game program has now been reduced in size.  It's specifications are set for full screen, but it is about 1/4 of the size.  Any ideas how to fix?

    Hi, I have got the same problem but all is 1/4 the size have you fixed it?

  • I'm a normal user, using cad programme, not using my laptop for games, my question is: do I need to get 16 gb ram in my retina macbook pro or 8  gb ram is pretty enough?

    I'm a normal user, using cad programme, not using my laptop for games, my question is: do I need to get 16 gb ram in my retina macbook pro or 8  gb ram is pretty enough?
    Thanks for support.

    8 GB may be sufficient for CAD but 16 would be a much better idea.
    All the Macs I have ever owned were eventually upgraded to the maximum amount of memory they could use. Considering that as of now, the RAM you specify is all the RAM you will ever have, get as much as you can. That is the only way to maximize its economic life.
    If Apple offered a 32 GB version I'd get it.

  • Timer for game program.

    Hello all,
    I am making a game program and I need a way to implement a timer so that it the game will end if the time expires.
    Is there any easy function to help me with this task?

    Thanks for the reply and I just found that class.
    Thanks

  • J2ME game programming

    Helo everyone,
    I am working in j2me game programming plz if
    any one know how make image as small as possible
    in our game program.?
    I am using *.png format of image which is working well
    in game but my game size is very big so plz help me to get
    out of this problem
    Thank u
    Aman Gautam

    hi,
    if you want to do any kind of game programming in J2ME, i suppose you would require to use the Canvas class, well there are a few good resources.. try out
    www.billday.com
    www.javamobiles.com..
    that ought to get u started.
    cheerz
    ynkrish

  • I want to learn 2D game programming. But, I am confused!

    I want to make a 2D game in C#. I have begun learning C# on my own. But, I am confused sbout what to learn after c# to make a game. I hear many things like XNA, MDX, Monogame, SlimDX, SharpDX, Frameworks, game engines, IDE's etc. To me all of this has
    caused a great confusion. The C# game tutorial I am learning is based on MDX (Managed DirectX). Now, I realise that MDX and XNA is dead. I am confused if I want to change my tutorial itself. Can anyone clear things out for me and tell what i need to learn
    step by step?
    I really don't even know what all the sh*t (.NET ,XNA, Monogame, SharpDX, xxx, xxxx, xxxx etc.) really is or what it does or which is better or even what the differences are. So please explain everything to me. Please help!

    Hi,
    You can refer to the Books:
    Beginning .NET Game Programming
    Beginning C# Game Programming
    Few other useful links:
    Coding 4 Fun is a great .NET resource that has quite a few user-created games. They also have a
    book and a
    2-D game primer
    Tutorial Listing at C# corner
    C# Game Tutorial for Beginners (video)
    Link to more game programming e-books
    Advanced Topics
    The Farseer Physics Engine on Codeplex would be a good next step once you get comfortable with programming games.
    Please mark as answer or vote as helpful if my reply does

  • About game programming.. please....help

    How to define game map for java midlet
         If I see the rpg game, it have default map. I want to know how to translate it to code
         in midlet? The map will be existed image or dynamicly generated?
         Like Prince of Persia Midlet version, I wonder how to generate the environment?
         Is it pixel generated or immutable image?
    detect collision
         SO if the map is image and the sprite game is draw over the map, how can we detect the
         collision?
         Please hellp me.... because I want to be game programmer for midlet but I
         didn't know about game programming before

    to write a small game in midl is already a hard work. to make a big one, take a look of a team of programers.
    about maping, there is no such thing. wire every thing by yourself. by books or read tutorials.
    as i already said. no easy task.
    but keep on trying. if you need some help write me a mail.
    [email protected]
    jeliel
    (sebastian)

  • I have a programming question

    Hi
    I have a programming question here. I spent a lot of time doing it, but I still can't get it. Here is the question :
    Write a method called countTo that takes one integer as a parameter and prints a
    comma-separated list of the numbers from 1 to the value of the parameter, or an
    appropriate error message if the parameter is less than one. In either case (if a list
    of numbers is printed, or an error message is printed), after printing, the cursor
    should be advanced to the next line.
    For example, if the parameter has a value of 1, the method should just print the
    the value 1 to the screen followed by a new-line character. If parameter has a value
    of 5, the method should print the following (exactly as shown, make sure there is
    no comma after the last value, and that all values are on one line with no spaces
    between them):
    1,2,3,4,5
    This method should only print to the screen, and should not return a value.

    I have a programming question here. I spent a lot of
    time doing it, but I still can't get it. Please post what you have done so far.

  • Game program - simon sez

    I have a simple game program call simon sez. I have the code completely
    written, but i cant figure out why its not working. I have the area
    in the program that is not working right and have add ********* where
    the problem area is. Can anyone figure out what ive done wrong here???
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    import java.lang.*;
    import sun.audio.*; //import the sun.audio package
    import java.io.*;
    public class SimonMain extends Applet implements ActionListener {
    SimonButton[] simonb = new SimonButton[4];
    SimonButton[] navb = new SimonButton[2];
    SimonButton gob = new SimonButton("GO");
    Label level;
    int levelc;
    int[] levelarray = new int[10];
    int playmode = 1;
    int arraycount=0;
    int whichbutton=0;
    AudioClip snd1;
    AudioClip snd2;
    AudioClip snd3;
    AudioClip snd4;
    AudioClip right;
    AudioClip wrong;
         //Initialize the applet
    public void init() {
    levelc=1;
    snd4=getAudioClip(getDocumentBase(), "three.wav");
    snd3=getAudioClip(getDocumentBase(), "two.wav");
    snd2=getAudioClip(getDocumentBase(), "one.wav");
    snd1=getAudioClip(getDocumentBase(), "zero.wav");
    right=getAudioClip(getDocumentBase(), "right.wav");
    wrong=getAudioClip(getDocumentBase(), "wrong.wav");
    level = new Label("Choose Level: "+Integer.toString(levelc) );
    add(level);
    for(int count=0; count<4;count++)
    simonb[count] = new SimonButton(Integer.toString(count));
    simonb[count].ColorButton(Color.black );
    simonb[count].ColorFont(Color.white);
    simonb[count].addActionListener(this);
    add(simonb[count]);
    for(int count=0; count<2;count++)
    if(count==0)
    navb[count] = new SimonButton("<");
    if(count==1)
    navb[count] = new SimonButton(">");
    navb[count].addActionListener(this);
    add(navb[count]);
    gob.addActionListener(this) ;
    add(gob);
    public void paint(Graphics g) {
    g.drawString ("Simon Sez: Choose your level using arrow buttons and click go to play.Have FUN!!!",10,50);
    public void actionPerformed(ActionEvent event) {
    //test.setText("Button number is " + buttonCaption);
    String command = event.getActionCommand();
         //if (command.equals("Push")){
    if (command == "GO")
    playmode=3;
    switch(playmode)
    case 1: //This is choose level mode
    if (command == "<" )
    if(levelc==1);
    else
    levelc--;
    level.setText("Level: "+Integer.toString(levelc) );
    if (command == ">" )
    if(levelc==10);
    else
    levelc++;
    level.setText("Level: "+Integer.toString(levelc) ) ;
    break;
    case 2: //This is play mode
    //This is where it wont get past my if statement???????????????????????????
    if ( "0"==command)
         {     level.setText("WORKIng"+command);
    simonb[0].ColorFont(Color.red);
    for(int count=0;count<100000000;count++)
              snd1.play();
    simonb[0].ColorFont(Color.white );
    whichbutton=1;
    if((levelarray[arraycount]==whichbutton))
    if(arraycount+1==levelc)
    { right.play();
    playmode=1;
    break;
    arraycount++;
    else
    {   wrong.play();
    arraycount=0;
    if ("1" == command)
    simonb[1].ColorFont(Color.yellow);
    for(int count=0;count<100000000;count++)
              snd2.play();
    simonb[1].ColorFont(Color.white );
    whichbutton=2;
    if((levelarray[arraycount]==whichbutton))
    if(arraycount+1==levelc)
    { right.play();
    playmode=1;
    break;
    arraycount++;
    else
    {   wrong.play();
    arraycount=0;
    if (command == "2" )
    simonb[2].ColorFont(Color.blue);
    for(int count=0;count<100000000;count++)
              snd3.play();
    simonb[2].ColorFont(Color.white );
    whichbutton=3;
    if((levelarray[arraycount]==whichbutton))
    if(arraycount+1==levelc)
    { right.play();
    playmode=1;
    break;
    arraycount++;
    else
    {   wrong.play();
    arraycount=0;
    if (command == "3" )
    simonb[3].ColorFont(Color.pink);
    for(int count=0;count<100000000;count++)
              snd4.play();
    simonb[3].ColorFont(Color.white );
    whichbutton=4;
    if((levelarray[arraycount]==whichbutton))
    if(arraycount+1==levelc)
    { right.play();
    playmode=1;
    break;
    arraycount++;
    else
    {   wrong.play();
    arraycount=0;
    level.setText(command ) ;
    break;
    case 3: //This is generate mode
    arraycount=0;
    whichbutton=0;
    playmode=2;
    for(int count=0;count<levelc;count++)
    levelarray[count]=1+ (int) (Math.random() *4);
    level.setText(Integer.toString(levelarray[count]) );
    for(int count=0;count<levelc;count++)
    if(levelarray[count]==1)
    simonb[0].ColorFont(Color.red);
    for(int countr=0;countr<100000000;countr++)
              snd1.play();
    simonb[0].ColorFont(Color.white );
    if(levelarray[count]==2)
    simonb[1].ColorFont(Color.yellow);
    for(int county=0;county<100000000;county++)
    snd2.play();
    simonb[1].ColorFont(Color.white );
    if(levelarray[count]==3)
    simonb[2].ColorFont(Color.blue);
    for(int countb=0;countb<100000000;countb++)
              snd3.play();
    simonb[2].ColorFont(Color.white );
    if(levelarray[count]==4)
    simonb[3].ColorFont(Color.pink);
    for(int countp=0;countp<100000000;countp++)
              snd4.play();
    simonb[3].ColorFont(Color.white );
    playmode=2;
    } //end of for loop
    playmode=2;
    break;
         //Get Applet information
    public String getAppletInfo() {
              return "Applet Information";
         //Get parameter info
    public String[][] getParameterInfo() {
              return null;
    import java.awt.*;
    import java.awt.event.*;
    public class SimonButton extends Button implements ActionListener{
    public SimonButton(String label) {
    this.setLabel(label) ;
    public void actionPerformed(ActionEvent event) {
    public void ColorButton(Color color){
    this.setBackground(color);
    public void ColorFont(Color color) {
    this.setForeground(color );
    public void paint(Graphics g) {

    you need to replace all occurrances in your code of:
    if(".." == command)....
    with:
    if("..".equalsIngnoreCase(command))...
    When doing string comparison, the equality operator doesn't work. Use the provided method instead

Maybe you are looking for

  • Problem with installing programs after the new update.

    I am having a problem with mounting downloads. I tried installing a download and in the dowload manager it says the disk could not be mounted about 2mins later i get a warning telling me the device is not configured. I had the same problem as everyon

  • Weather icon changed from 23 to 73 after restore

    Is this a way of apple knowing which customers have restored thier phones if they send them back? Or what's the point?

  • My wired Apple mouse stopped working for a short time. Trying to figure out why.

    System OSX Version 10.9.5  Processor 3.5 GHz Intel Core i7    I was surfing the web & my mouse was stuck on the screen. Could this be some kind of virus- spyware or malware? Never had this happen before. The keyboard the mouse is connected 2  kept wo

  • PCIe Card For Dual G5

    Hi Guys I want to view how my video will actually look on a Tv from my computer. The computer monitor dosent show minor defects. I will be doing some mild colour correction. Can anyone give me suggestion as to what card I need to buy so I can output

  • How to add leading zeros ?

    Hi Friends, I have a shipment no say 10 char long . Now the thing is in my program I need to add leading zeros if the shipment no is not 10 char long . For eg : if the tknum is 99919 . I need to make use of a command to make it 10 char long lke 00000