Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (499)
Games in Android Showcase (118)
games submitted by our members
Games in WIP (567)
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 / Newbie & Debugging Questions / Re: EXCEPTION_ACCESS_VIOLATION (0xc0000005) on: 2014-08-11 07:39:50
This might make more sense:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  com.badlogic.gdx.physics.box2d.World.jniCreateBody(JIFFFFFFFFZZZZZF)J+0
j  com.badlogic.gdx.physics.box2d.World.createBody(Lcom/badlogic/gdx/physics/box2d/BodyDef;)Lcom/badlogic/gdx/physics/box2d/Body;+80
j  com.rayexar.slimeblaster.Projectile.initialise()V+24
j  com.rayexar.slimeblaster.weapons.ElectricBlast.fire(FFLcom/rayexar/slimeblaster/entities/Entity;I)V+82
j  com.rayexar.slimeblaster.entities.Entity.attackWeapon()V+89
j  com.rayexar.slimeblaster.InputHandler.keyUp(I)Z+240
J 1065 C1 com.badlogic.gdx.backends.lwjgl.LwjglInput.processEvents()V (478 bytes) @ 0x0000000002a94dc4 [0x0000000002a94820+0x5a4]
j  com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop()V+557
j  com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run()V+27
v  ~StubRoutines::call_stub


Think this is due to creating a body while World is locked if it is then
maybe:

1  
if (world.isLocked()) return;
2  Game Development / Articles & tutorials / Re: Java2D - Space Invaders on: 2013-09-22 10:56:35
yeah i realized my mistakes after i posted  Clueless, shouldn't have done it so late.
Sorry for the mistake i have sent a message endolf so should be sorted soon.

And the reason am using Java2D is just because of its simplicity you can just jump right into
it and not have to worry about versions or libs etc. I wanted to make it
simple and not difficult to follow, its more for people who know java but are not yet confidant enough
to code there own things yet.
3  Game Development / Articles & tutorials / Java2D - Space Invaders on: 2013-09-22 00:54:05
Hi i just wanted to post my tutorials on creating Space Invaders but trying to create it with pre-refactored (most of it aleast) code.

My main reasons for doing this is to hopefully let beginners/intermediate programmers be able to come in and easily understand
and change code when they want to.

Still need a lot of practice with commentary and confidence but i am sure that will come in time, and also sorry about the microphone i
need to get a new one.

This is just a hobby just now but if they acutely help some programmers then i will make a schedule but for
just now am kind of just posting them whenever. but they should be a video about 1-4 every 2 weeks depending
on the circumstances.

http://www.youtube.com/user/DregronProgram

But if you give it a chance i hope you enjoy and get something out of it,
Cheers Smiley



4  Game Development / Newbie & Debugging Questions / Re: BufferStrategy - CPU Usage on: 2013-04-28 23:01:14
Ah yeah should have known that Tongue

Cheers for the code (nice way of doing it Smiley ) & info
5  Game Development / Newbie & Debugging Questions / Re: what is the correct method to loads images on: 2013-04-28 22:40:03
This should work, this will work if your using applet or not.

1  
2  
3  
4  
5  
6  
7  
8  
BufferedImage bImage;

try {
         URL url = this.getClass().getResource("graphics/hero.png");
         this.bImage = ImageIO.read(url);
      } catch (IOException e) {
         e.printStackTrace();
      }
6  Game Development / Newbie & Debugging Questions / Re: BufferStrategy - CPU Usage on: 2013-04-28 21:54:57
Yeah, i have a limit to FPS,
The commented code isn't really the problem i tested it out.
I've commented out each part to see what could be causing the issue and when i took away the BufferStrat it went down to 10-20%
7  Game Development / Newbie & Debugging Questions / BufferStrategy - CPU Usage on: 2013-04-28 21:32:26
Is there a less CPU intensive way to create a double buffer, bec just now when am doing it this way it takes up 50-60% of CPU without it, it's 10-20%.
I know i could use OpenGL or Slick etc.. but am trying to create this whole thing without any Libraries (except System Library).

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  
   public void draw() {
      if (this.getBufferStrategy() == null) {
         createBufferStrategy(2);
         return;
      }
     
      Graphics2D g = (Graphics2D) getBufferStrategy().getDrawGraphics();
      g.setColor(Color.BLACK);
      g.fillRect(0, 0, WIDTH+2, HEIGHT);
      g.setColor(Color.white);
      g.setFont(new Font("Serif", Font.PLAIN, 14));
      g.drawString("Ups: " + this.Ups , 4, 12);
      g.drawString("FPS: " + this.frameRate , 4, 24);
//      for(int i = 0; i < test.length; i++){
//         if(getCurrentState().toLowerCase().contains(test[i].getClass().getSimpleName().toLowerCase())){
//            try {
//               Method m = test[i].getClass().getDeclaredMethod("draw", Graphics2D.class);
//               m.invoke(test[i], g);
//            }catch (NoSuchMethodException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
//               System.out.println("graphics Error!");
//               System.out.println(e.toString());
//            }
//         }
//      }
     g.dispose();
      getBufferStrategy().show();
   }


Any information would be appreciated
Cheers
8  Discussions / General Discussions / Re: Is Java Missing its Window of Opportunity with Gaming? on: 2012-12-28 19:27:41
Don't really think java is missing its window with games because of they way the languages is it's self because its Easy to learn, easier to find solutions to your problems, Easy to show of your programs. So in my opinion people are finding their way to us with just finding someone with the same issues.

I've programmed a game in c++ and trying to get some help with something is a lot more difficult, which in my opinion that is going in the wrong direction things should be getting easier not harder. I know they are library's etc but they are still a lot more to when your just wanting to put something online or trying to find a fix for a problem you have been getting with the your code.

I also think it counts on developers showing off good quality programs that interest people and make people wondering how it was done.

Bit of a noobie but that's my thoughts Smiley
9  Game Development / Newbie & Debugging Questions / Re: Applet with lwjgl & slick on: 2012-08-09 20:37:45
I got it working, i think it was because i never took lwjgl.jar & lwjgl_util_applet.jar out of the applet version Tongue... finally got it working only took 2 days  Roll Eyes

Thanks for your help really appreciate it Smiley
10  Game Development / Newbie & Debugging Questions / Re: Applet with lwjgl & slick on: 2012-08-09 16:17:03
am using the lastest version of lwjgl, just double checked there by download them... still the same error Sad
11  Game Development / Newbie & Debugging Questions / Re: Applet with lwjgl & slick on: 2012-08-09 15:53:51
This occurred while 'Extracting downloaded packages'
error in opening zip file
java.util.zip.ZipException: error in opening zip file
   at java.util.zip.ZipFile.open(Native Method)
   at java.util.zip.ZipFile.<init>(Unknown Source)
   at java.util.zip.ZipFile.<init>(Unknown Source)
   at java.util.jar.JarFile.<init>(Unknown Source)
   at java.util.jar.JarFile.<init>(Unknown Source)
   at org.lwjgl.util.applet.AppletLoader.extractNatives(AppletLoader.java:1789)
   at org.lwjgl.util.applet.AppletLoader.run(AppletLoader.java:877)
   at java.lang.Thread.run(Unknown Source)

12  Game Development / Newbie & Debugging Questions / Applet with lwjgl & slick on: 2012-08-09 13:49:47
Hey am trying to learn how applets work with lwjgl & slick, but i can't seem to get it working... Here are the steps i take -

  • Export Game as "JAR file"
  • get - slick.jar, lwjgl.jar, natives-win.jar & lwjgl_util_applet.jar... i put it on my desk top
  • then i create a html file (notepad) the put the code it it.

this is the code i have in my html file -

<html>
<head>
<title>Applet Test</title>
</head>
<body bgcolor = "#222222">
<br><p>
<br><p>
<center>
<applet code="org.lwjgl.util.applet.AppletLoader"
        archive="lwjgl_util_applet.jar"
        codebase="."
        width="800" height="600">
 
  <param name="al_title" value="myslickgame">
  <param name="al_main" value="org.newdawn.slick.AppletGameContainer">
  <param name="game" value="Display">
 
  <param name="al_jars" value="Animation.jar, lwjgl.jar, slick.jar">
 
  <param name="al_windows" value="natives-win.jar">
</applet>
</center>
</body>
</html>


my game 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  
37  
38  
39  
import org.newdawn.slick.AppGameContainer;
import org.newdawn.slick.BasicGame;
import org.newdawn.slick.Color;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.SlickException;

public class Display extends BasicGame {
   public static void main(String[] args){
      try{
      AppGameContainer app = new AppGameContainer(new Display());
      app.setDisplayMode(800, 600, false);
      app.start();
      }catch (SlickException e){ e.printStackTrace(); }
   }

   public Display() {
      super("Applet Game");
   }

   @Override
   public void render(GameContainer gc, Graphics g) throws SlickException {
      g.setColor(Color.white);
      g.fillOval(150, 150, 50, 50, 5);
   }

   @Override
   public void init(GameContainer gc) throws SlickException {
      // TODO Auto-generated method stub

   }

   @Override
   public void update(GameContainer gc, int delta) throws SlickException {
      // TODO Auto-generated method stub

   }

}


Error 'extracting downloaded packages'
Am not using any images in my code just appGameContainer using the Graphics to create an filloval

Cheers for taking a look Smiley
13  Discussions / Miscellaneous Topics / Re: Who would you consider a programmer? on: 2012-08-01 21:02:07
Am pretty sure we all know the biggest secret of knowing who's a programmer...


Having a beard or long hair... Or both & if not that cloths that just say "meh".
But yeah if not they things I think you can tell if you start having a conversation about programming what tools, engine you use etc. Smiley
14  Java Game APIs & Engines / Java 2D / Re: Sprite Animation on: 2012-07-30 20:14:46
Here is the main parts of my animation which i use to add the animation & get all the information i need to get it working. -

Animation 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  
49  
50  
51  
52  
53  
public BufferedImage sprite;
   private ArrayList<BufferedImage> frames = new ArrayList<BufferedImage>();
   private boolean running = false;
   private long previousTime, speed;
   private int frameAtPause, currentFrame;

   public void update(long time) {
      if (running) {
         if (time - previousTime >= speed) {
            currentFrame++;
            if (currentFrame < frames.size()) {
               sprite = frames.get(currentFrame);
            } else {
               currentFrame = 0;
               sprite = frames.get(currentFrame);
            }
            previousTime = time;
         }
      }
   }

   public Animation(ArrayList<BufferedImage> frames) {
      this.frames = frames;
   }

   public void setSpeed(long speed) {
      this.speed = speed;
   }

   public void play() {
      running = true;
      previousTime = 0;
      frameAtPause = 0;
      currentFrame = 0;
   }

   public void stop() {
      running = false;
      previousTime = 0;
      frameAtPause = 0;
      currentFrame = 0;
   }

   public void pause() {
      frameAtPause = currentFrame;
      running = false;
   }

   public void resume() {
      currentFrame = frameAtPause;
      running = true;
   }
}



BufferedImageLoader Class -
1  
2  
3  
4  
5  
public BufferedImage loadImage(String pathRelativeToThis) throws IOException {
      URL url = this.getClass().getResource(pathRelativeToThis);
      BufferedImage img = ImageIO.read(url);
      return img;
   }


SpriteSheet -

   
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
public BufferedImage spriteSheet;
   
   public SpriteSheet(BufferedImage ss){
      this.spriteSheet = ss;
   }
   
   public BufferedImage grabSprite(int x, int y, int width, int height){
      BufferedImage sprite = spriteSheet.getSubimage(x,  y,  width,  height);
      return sprite;
   }


cheers for taking the time to look Smiley
15  Java Game APIs & Engines / Java 2D / Re: Sprite Animation on: 2012-07-30 19:34:09
This is how my current code works:

I have a screen manager & a display you input the display that you want to show, so it updates from the display from the screen manager here is the code:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
private void render() {
      BufferStrategy bs = getBufferStrategy();

      if (bs == null) {
         createBufferStrategy(2);
         return;
      }

      Graphics g = bs.getDrawGraphics();
      g.fillRect(0, 0, frame.getWidth(), frame.getHeight());
      screen.paintStage(g);
      screen.updateStage(this);
      g.dispose();
      bs.show();
   }


1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
public void paintStage(Graphics g){
      if(currentState == Stage1Name){
         Stage1.paint(g);
      }
   }
   
   public void updateStage(Display display){
      if(currentState == Stage1Name){
         Stage1.update(display);
      }
   }


& i have an ArrayList for BufferedImage this is getting the current image really. -


   
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
public BufferedImage sprite;
   private ArrayList<BufferedImage> frames = new ArrayList<BufferedImage>();
   private boolean running = false;
   private long previousTime, speed;
   private int frameAtPause, currentFrame;

   public void update(long time) {
      if (running) {
         if (time - previousTime >= speed) {
            currentFrame++;
            if (currentFrame < frames.size()) {
               sprite = frames.get(currentFrame);
            } else {
               currentFrame = 0;
               sprite = frames.get(currentFrame);
            }
            previousTime = time;
         }
      }
   }



I know this is "sprite = frames.get(currentFrame);" the problem because when i comment it out it goes from 90 odd fps to 1000 odd fps.
Thanks taking the time to look Smiley
16  Java Game APIs & Engines / Java 2D / Sprite Animation on: 2012-07-30 17:10:42
Hey ive been doing some tutorials for Sprite Animation, & i have made an animation but my fps goes down really low & it just slows down the program in general.
I first thought it was BufferedImage but change it but still made no no difference. I'll post the main part that is making it lag so much (its updating each image).

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
//Updating the animation image
public void update(long time) {
      if (running) {
         if (time - previousTime >= speed) {
            currentFrame++;
            if (currentFrame < frames.size()) {
               sprite = frames.get(currentFrame); <<< main part of the lag
            } else {
               currentFrame = 0;
               sprite = frames.get(currentFrame);
            }
            previousTime = time;
         }
      }
   }

//updating the animation on screen
public void update(Display display) {
         animation.update(System.currentTimeMillis());
     
   }


Thanks for taking a look Smiley

17  Game Development / Newbie & Debugging Questions / Re: Oval Collision on: 2012-07-27 21:42:23
bump
18  Game Development / Newbie & Debugging Questions / Oval Collision on: 2012-07-27 20:13:13
Hey am trying to find different ways to get hit detection but finding it hard to figure out how to get it with an oval here is what i have just now,
 wondering if they are a similar way to do this -

public cpuMovement(int x, int y, int width, int height){
   this.x = x;
   this.y = y;
   this.width = width;
   this.height = height;
   this.rect = new Rectangle(x, y, width, height);
}

public static void Collision(cpuMovement cm){
      for (int i = 0; i < Physics.cpuMove.size(); i++) {
         if(Physics.cpuMove.get(i).getRect().intersects(cm.getRect())){
            if(Physics.cpuMove.get(i) != cm){
               System.out.println("Working");
      }
   }
}
}

The top bit of code is working but how would i get an oval hit detection
Cheers for your time Smiley


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.

Pippogeek (37 views)
2014-09-24 16:13:29

Pippogeek (29 views)
2014-09-24 16:12:22

Pippogeek (18 views)
2014-09-24 16:12:06

Grunnt (42 views)
2014-09-23 14:38:19

radar3301 (24 views)
2014-09-21 23:33:17

BurntPizza (61 views)
2014-09-21 02:42:18

BurntPizza (30 views)
2014-09-21 01:30:30

moogie (36 views)
2014-09-21 00:26:15

UprightPath (49 views)
2014-09-20 20:14:06

BurntPizza (52 views)
2014-09-19 03:14:18
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

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

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

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!