Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (108)
games submitted by our members
Games in WIP (536)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Game Development / Networking & Multiplayer / RTS game multiplayer on: 2014-03-27 00:03:11
I am working on a small RTS game for personal practice and have decided I would like for the different factions in the game to be controlled by different players rather than by an AI. I have never networked anything before so I may be in over my head, but I would like some input on whether this is possible / where to begin. I have read a lot of linked resources but am a bit lost as to actual implementation.

Currently my game runs on the screen and accepts keyboard and mouse inputs from the user. I want 2 players on different machines to see the same screen and the game to differentiate between which player is clicking / entering commands, and send the commands to that faction. I can link the git to my game if that will help.
2  Discussions / General Discussions / Re: Convert FSEM game to Applet on: 2013-04-29 01:59:34
Haven't really thought about it, figured someone would know what that's worth better than I do.
3  Discussions / General Discussions / Convert FSEM game to Applet on: 2013-04-29 01:13:12
As the title says I need to convert a game I created in Full Screen Exclusive Mode into an applet. I've followed the advice of many people I've found through google and read several tutorials, but I am just not getting it I guess. At this point I'd like to just hire someone to do it for me. If you can help me out please reply or send me a message. The program is rather large so I'd rather not just copy paste it somewhere, about 30mb compressed.

Right now the game is implemented in a JPanel inserted into a JFrame. Thank you!
4  Game Development / Newbie & Debugging Questions / translate and animate simultaneously on: 2013-03-27 00:50:17
I am having trouble with getting my animations to work while my characters are moving. I have a player, who will run right and left. When he starts to run either direction, the animation starts, and stops after about 1 second then wont start again unless I let go of the run button and press it again. The zombies will only translate across the screen until they reach their destination then they will stand in place and animate. I need them to animate and translate simultaneously. Can anyone spot the error? I had this working before I cannot figure out how I messed it up!

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
   public NinjaSprite(ImagesLoader im, String name, int p) {
      super(Variables.pWidth/2, 0, Variables.pWidth, Variables.pHeight, im, name);
      setStep(5,0);
      locy = Variables.pHeight/2 + 25;
      period = p;
   } // end of ninja sprite

    public void moveLeft()
     /* Request that the sprite move to the left. It doesn't
        actually move, but changes its image and status flags. */

     { setImage("leftPlayer");
     System.out.println("player period: " + period);
       loopImage(period, DURATION);   // cycle through the images
      isFacingRight = false;  isStill = false;
       super.updateSprite();
     }

     public void moveRight()
     /* Request that the sprite move to the right. It doesn't
        actually move, but changes its image and status flags. */

     { setImage("rightPlayer");
       loopImage(period, DURATION);   // cycle through the images
      isFacingRight = true;  isStill = false;
       super.updateSprite();
     }

     public void stayStill()
     /* Request that the sprite stops. It stops the
        image animation and sets the isStill status flag. */

     { stopLooping();
       isStill = true;
     }


1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
public class Zombie extends Sprite{
private String zName;

   public Zombie(int x, ImagesLoader imsld, String name, int p){
      super(Variables.pWidth/2, 0, Variables.pWidth, Variables.pHeight, imsld, name);
      period = p;
      locx = x;
      zName = name;
      setStep(1,0);
      System.out.println("zombie period " + period);
   }  
   public void move(int target){ // zombies attempt to move towards the player
     if(locx > target){
         this.setImage(zName);
         locx -= Variables.zombieSpeed;
         loopImage(period, DURATION);   // cycle through the images
        }
      else if(locx < target){
         this.setImage(zName);
         locx += Variables.zombieSpeed;
         loopImage(period, DURATION);   // cycle through the images
     }
   } //end of updateSprite
}
5  Game Development / Newbie & Debugging Questions / Re: getRGB() on an image on: 2013-03-26 20:47:11
I don't know if that would be easier or not. I have 12 levels in a building and about 40 doors. Finding the exact coordinates of each door and storing them will be a pain, but can be done. I thought it made more sense to simply check the image itself so that further levels could be added with the same color scheme without needing to locate every door again through pixels.
6  Game Development / Newbie & Debugging Questions / getRGB() on an image on: 2013-03-26 20:38:51
I am working on a game that uses an image I drew as the background. I want to be able to scan the image at the location of the player to determine whether I am standing in front of a door or not.

I am using this method to check the pixel color of my image, and it returns the same number no matter where I am standing, so I am obviously using it wrong.

1  
2  
3  
4  
5  
6  
   public boolean door(int playerX, int playerY){
      System.out.println("pixel color: " + imLd.getImage(ribImages[level-1]).getRGB(playerX, playerY));
      if(imLd.getImage(ribImages[level-1]).getRGB(playerX, playerY)== 573128);
      isOverDoor = true;
      return isOverDoor;
   }

this prints "pixel color: -12247529" always.
Here is the call to it in my update method:
1  
2  
3  
ribsMan.door(ninja.locx+ninja.width/2, ninja.locy-150);  
//This is just a point I am feeding in that I know is on the door with nothing blocking it.
//I will change it to be not hardcoded once I get it working.

7  Game Development / Newbie & Debugging Questions / Re: large map file format on: 2013-03-24 18:15:33
No I simply have a jpeg image of the background that I intended to move around but it ended up being too large. I either need to figure out how to use a Tiled map format in my game, or break it up into 10 blocks and use those.
8  Game Development / Newbie & Debugging Questions / Re: large map file format on: 2013-03-24 00:39:58
This is the first time I've ever made something with a map larger than the screen, so I'm not really sure what is the best way to go about it. I made the map in Tiled, so I don't know how I'd go about drawing one tile at a time. I'm not sure how I could use a sprite sheet for this, without a ton of coding telling it where to draw each tile. Splitting it up into sections might be what I have to do if I can't figure anything else out. I was hoping to be able to see portions of the floors above and below the one the player is on, and splitting each into it's own image might inhibit that.
9  Game Development / Newbie & Debugging Questions / large map file format on: 2013-03-24 00:24:00
I am creating a game that will have a large map file that is traversed like a side scroller. Unfortunately saving the file as a png is putting it at approx 30-40mb for the picture, which is too big for eclipse to handle. I need to have the picture in the correct proportions while still being able to load it. Is there a way to compress the size of a png image without losing the proportions? I may be explaining this badly, but I have been pushing it around all day with no luck and running out of time. The map is 5600 x 4200 pixels in order to look correct.


Also, this map was created with Tiled. If there is a better way than saving it as an image, I'd love to do something that makes more sense.

Any suggestions?
10  Discussions / General Discussions / Re: Embedding my game on website. on: 2013-02-20 16:23:35
Ah I see, that makes sense now. I guess the problem is that I have never made an applet before and don't know how to go about changing my program into an applet. From the small amount of reading I did, it seemed that I needed an applet class, then have my game extend applet. I must be misunderstanding this because my classes already extend frame so i can't seem to also extend applet. I dont know if this makes any sense. As I said, I am brand spanking new to this. I'd be happy to send my file to someone if it would make more sense for help converting it.

Thanks for the replies.
11  Discussions / General Discussions / Embedding my game on website. on: 2013-02-20 00:48:43
Hey everyone, I am completely new to making java applets and just built my first game. It's an executable jar file and I'd like to link it here as well as add it to my own wordpress webpage. I don't understand what needs to be done to do this however. I have the plugin for wordpress and I guess I just dont understand what I need to put in.

<code>[applet code="your.applet.ClassName" file="http://domain.com/full/path/to/yourJar.jar"]</code><br />

I know the url to my file, but not what to put in for your.applet.ClassName.  I have been trying to just put in the name of the class with my main method in it but get an error.

Thank you, I realize this is a pretty dumb question but I dont get it.
12  Game Development / Game Mechanics / Re: Physics of a projectile on: 2013-02-18 22:46:27
Thank you. Unfortunately now the projectile goes straight out of the guy then shoots upwards off the screen. Only difference is speed of the projectile when clicking elsewhere. I flipped the y for -+ and this lets it fall downwards instead of upwards, but does not start the projectile in an upwards motion. I suppose I don't understand how to change my values to more appropriate numbers.

1  
2  
3  
      xVelocity = (int)(2 * velocity * Math.cos(theta));
      yVelocity = (int)(2 * velocity * Math.sin(theta));
     

xVelocity is giving me readouts in the teens, while yVelocity is giving me numbers in the hundreds.

This is what I changed my move to. I have no idea how to get the delta you referred to; currTimeMillis - start time gave me awful results.
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
   synchronized public void move(){
      System.out.println("yvel " + yVelocity);
      System.out.println("xvel " + xVelocity);
            if(newY < upperMax){
               active = false;
               }
               theta = (float) Math.toDegrees(Math.atan2(launchX - initialX, launchX - initialY));

                  yVelocity += gravity*2;  // Update yvelocity due to gravity

                  newY -= yVelocity;  // update y position.

                  newX += xVelocity;  // assuming no wind resistance, xVelocity is constant throughout.

         } // end move

13  Game Development / Game Mechanics / Physics of a projectile on: 2013-02-18 21:09:31
Hey everyone,
This is my first game I have ever attempted and am running into road blocks left and right. At this point in the program I have a rock that is thrown from the origin towards x,y coordinates of a left mouse click. I want to have this rock thrown in a fairly realistic parabola using the magnitude of the throw (given by distance of click from origin), and angle of throw from the origin.

At this point I have written and rewritten the move method many times and simply can't get it to work. I understand the physics and the math of it, but not how to translate them into java. I've looked at a lot of examples but can't figure out how to apply it. Most of them talk about using time, but I am not sure how to apply it. Really any help will make a huge difference for me.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
   

   private double velocity = (Math.sqrt(Math.pow((launchX-newX), 2) + (Math.pow((launchY-newY),2))))/150; // c^2 = sqrt(a^2 + b^2)
  private double gravity = 1;  
   private int launchX; // mouse input
  private int launchY; // mouse input
  private double initialX; // origin
  private double initialY; // origin

   synchronized public void move(){
      //currentTime = System.nanoTime() - startTime;
           if(newY < upperMax){
               active = false;
               }
               theta = (float) Math.toDegrees(Math.atan2(launchX - initialX, launchX - initialY));
                newX = (int)(newX + ((moveSpeed * velocity)));
                newY = (int)(newY + ((-velocity + (gravity * velocity)) * -Math.cos(theta)));
               
         } // end move
Pages: [1]
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

CogWheelz (18 views)
2014-07-30 21:08:39

Riven (23 views)
2014-07-29 18:09:19

Riven (15 views)
2014-07-29 18:08:52

Dwinin (12 views)
2014-07-29 10:59:34

E.R. Fleming (33 views)
2014-07-29 03:07:13

E.R. Fleming (12 views)
2014-07-29 03:06:25

pw (43 views)
2014-07-24 01:59:36

Riven (43 views)
2014-07-23 21:16:32

Riven (30 views)
2014-07-23 21:07:15

Riven (31 views)
2014-07-23 20:56:16
List of Learning Resources
by SilverTiger
2014-07-31 18:29:50

List of Learning Resources
by SilverTiger
2014-07-31 18:26:06

List of Learning Resources
by SilverTiger
2014-07-31 13:54:12

HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!