Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (541)
Games in Android Showcase (133)
games submitted by our members
Games in WIP (604)
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 / Game Mechanics / Re: A* path finding being slow on: 2013-01-19 18:57:39
Thanks guys, I realized that I had a for loop checking every single tile thousands of times if My A* path finder had logged that coordinate already, I ended up adding some debugging stuff to highlight tiles visited and I realized what was happening, now it works flawless with no wait
2  Game Development / Game Mechanics / Re: A* path finding being slow on: 2013-01-19 16:23:21
If that hook is a static part of the terrain you can do what some people refer to as waypoint or point of view pathfinding. That is you place a "waypoint" or marker at the top of the hook, or at some gap. If you want to go "through" the hook, you then first A* to the way point (which should be pretty quick) and then once you are at the way point you A* to your target on the other side.

Google "waypoint pathfinding" or "point of view pathfinding" for more information. I haven't done much with pathfinding only read about it.


Thanks, I'll try that                                                 
3  Game Development / Game Mechanics / A* path finding being slow on: 2013-01-19 14:58:40
This isn't a question about making an A* path finder, I already have one I made for my game, the only problem is it takes a bit of time to process paths around hook shaped objects, all I'm doing is looping through the last tiles I added and then branching out like explained on Wikipedia, is this a common thing for A* or should I optimize it

I don't know if this will look right but here is the shape I'm talking about, P is player X is the clicked spot
1  
2  
3  
4  
5  
......................................................
......................######.........................
..................###.................................
...P.........##....................X................
..........##........................................
4  Game Development / Performance Tuning / why does my memory usage spike up and down on: 2012-09-10 00:30:59

when I run other people programs they seem to have a steady and smooth movement not spike up drop spike up drop, also why would the heap size be so big if the used heap is much lower, it's a 2D platformer game so could it be too many threads or objects
5  Java Game APIs & Engines / Java 2D / Re: Problem with image drawing and FPS on: 2012-09-06 01:34:28
1) dont draw textures on tiles you can't see, probably the biggest thing here

2) don't overide the paint method(I'm assuming you're doing that, if not disregard this), run your painting in a thread, the performance increase is noticeable, on my machine cpu usage goes from 60 to 20

3)  don't use a lot of transparent images

4) limit your framerate, it can mean the difference from your game using 20 cpu or 5, a human can't tell the difference from 100fps and 800fps

also check your code for slowdowns, I always monitor the FPS on games I'm making so the moment I do something where the frames jump from from somwhere over 1000 to 40 I can find what is causing it
6  Java Game APIs & Engines / Java 2D / Re: Follow player on: 2012-09-06 01:28:39
Use the translate method in Graphics2D

g.translate(x, y)

whenever you increase X of the player, you'll want to decrease the x of whatever variable you use in the translate method, the same goes for Y
7  Java Game APIs & Engines / Java Sound & OpenAL / Re: Why isn't my sound working anymore on: 2012-08-27 18:31:23
The MIDI synthesizer changed completely between Java 6 and Java 7. If you've upgraded since you last used this code then that could be the reason. You might have to try the methods that let you set the synthesiser manually and see if any work as you're expecting.

oh ya I just tried using java 7 to compile it with and the sound plays yay, but one problem, if I have this precompiled with java 7 will someone who is using java 6 be able to hear the music or will it not work?
8  Java Game APIs & Engines / Java Sound & OpenAL / Why isn't my sound working anymore on: 2012-08-25 23:30:48
ok so I have this sound code I use for all my stuff I need sound in, I used it last about 1 or 2 months ago and it worked, I had it in 2 applications that unfortunatley I don't have anymore and it worked it played sound and I could make it loop and wahtever I wanted

but now it has stopped working, it doesn't generate any errors it just doesn't play the sound, I checked if it is running the code and it is I've tried running it in a new application and I tried a new thread in the current application and nothing worked

here's the code
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  
33  
34  
35  
36  
import java.net.URL;

import javax.sound.midi.*;

public class Music {

   public Music() {
      Thread t = new Thread(new Runnable() {
         @Override
         public void run() {
            pplay();
         }
      });t.start();
   }
   
   public void pplay() {
      // TODO Auto-generated method stub
      try {
         URL url = new URL("file:c:/theme.mid");
         System.out.println("Started");
         sequence = MidiSystem.getSequence(url);
         sequencer = MidiSystem.getSequencer();

         sequencer.open();
         sequencer.setSequence(sequence);

         sequencer.start();
         System.out.println("Done");
      } catch(Exception e) {
         e.printStackTrace();
      }  
   }

   public static Sequence sequence;
   public static Sequencer sequencer;
}


I just want to know if I'm missing something, or is there something wrong with my java nothing has changed since I last used this code
9  Java Game APIs & Engines / Java 2D / Re: Java2D, 2.5D affect help on: 2012-07-05 18:20:32
You will want to sort your sprites by z-order before rendering them.

ahh thanks, I searched up zbuffering and I got this great idea, I added my obstacles and players into a arraylist of Objects and then I sorted them so that people/obstacles lower on the Y axis would have a lower index(therefore painted first) than people high on the Y axis(high index, painted last)


10  Java Game APIs & Engines / Java 2D / Java2D, 2.5D affect help on: 2012-07-05 06:03:59
I really need help with this, so I have a pretty good 2.5D affect going

*picture of game so far*


but one problem, I don;t know how to draw the player behind it if they have a lower Y or X, looping through all the objects doesn't work, it only works on the last object added to my game and all the rest look like this when you get close


all the objects and players are in an arraylist and looping though all checking X and Y doesn't work!
11  Game Development / Game Play & Game Design / Re: All but ONE image won't paint when project is jared on: 2011-11-25 06:38:36
Well I fixed the problem, I split the image into 4 pieces but now I can only load 3 of the 4 pieces of map, once I load 3 of them the 4th won't paint at all

new map class:
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  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Toolkit;


public class map extends Thread {

   Image map1;
   Image map2;
   Image map3;
   Image map4;
   String mp;
   Boolean cleaned = false;
   public static int x = 0;
   public static int y = 0;
   
   public map() {
      this.mp = mp;
      map1 = Toolkit.getDefaultToolkit().getImage(this.getClass().getResource("map/MapPiece1.jpeg"));
      map2 = Toolkit.getDefaultToolkit().getImage(this.getClass().getResource("map/MapPiece2.jpeg"));
      map3 = Toolkit.getDefaultToolkit().getImage(this.getClass().getResource("map/MapPiece3.jpeg"));
      map4 = Toolkit.getDefaultToolkit().getImage(this.getClass().getResource("map/MapPiece4.jpeg"));
   }
   
   public void paint(final Graphics g) {
      Runnable t = new Runnable() {
         public void run() {
      if(thing.p.realX < 4200 && thing.p.realY < 4200) {
      g.drawImage(map1, x, y, null);
      } else {
      }
      if(thing.p.realX > 3550 && thing.p.realY < 4150) {
      g.drawImage(map2, x+4001, y-1, null);
      } else {
      }
      if(thing.p.realY > 3800 && thing.p.realX < 4200) {
      g.drawImage(map3, x, y+4001, null);
      }  else {
      }
      if(thing.p.realX > 3800 && thing.p.realY > 3800 ) {
      g.drawImage(map4, x+4001, y+4001, null);
      } else {
      }
         }
      };
      t.run();
   }
}
12  Game Development / Game Play & Game Design / All but ONE image won't paint when project is jared on: 2011-11-24 22:35:37
Everytime I put my Game I'm making into a jar every single Image loads except for the map, I know it's in the correct case and everything it just won't load, someone take a look at my code and tell me what I'm doing wrong in this?

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Toolkit;


public class map {

   Image map;
   String mp;
   public static int x = 0;
   public static int y = 0;
   
   public map(String mp) {
      this.mp = mp;
      map = Toolkit.getDefaultToolkit().getImage(this.getClass().getResource(mp));
   }
   
   public void paint(Graphics g) {
      g.drawImage(map, x, y, null);
   }
}


then I make a new Object with it
1  
public static map map = new map("images/Map2.png");


then later...
1  
map.paint(g);


What do I have to do to make it paint?? I've looked all around the web and the question never gets answered
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.

Mr.CodeIt (12 views)
2014-12-27 04:03:04

TheDudeFromCI (16 views)
2014-12-27 02:14:49

Mr.CodeIt (25 views)
2014-12-23 03:34:11

rwatson462 (56 views)
2014-12-15 09:26:44

Mr.CodeIt (46 views)
2014-12-14 19:50:38

BurntPizza (92 views)
2014-12-09 22:41:13

BurntPizza (113 views)
2014-12-08 04:46:31

JscottyBieshaar (86 views)
2014-12-05 12:39:02

SHC (96 views)
2014-12-03 16:27:13

CopyableCougar4 (102 views)
2014-11-29 21:32:03
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50
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!