Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (498)
Games in Android Showcase (115)
games submitted by our members
Games in WIP (563)
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] 2 3 ... 5
1  Games Center / Archived Projects / Re: Crabs! on: 2011-10-03 14:06:21
Filled the entire screen with craps... err crabs, fps stable at about 27.

Galaxy s i9000
2  Game Development / Game Play & Game Design / Re: Game name and artwork on: 2011-07-26 15:18:27

Wouldn't put any of those names on anything serious, but they make great temporary names Cheesy

I kinda like those names, do you have any more? Cheesy
Uh, gimme a theme or something and I can come up with one? Smiley

Uhm, how about: you get shrinked down to about the size of a bloodcell. Then you have to enter another person's body and eliminate the evil virus inside him to save him/her? Cheesy
However, to reach the final boss you have to collect five sacred stones which are guarded by their own boss. Or something like that.
3  Game Development / Game Play & Game Design / Re: Game name and artwork on: 2011-07-25 19:18:56
I kinda like those names, do you have any more? Cheesy
4  Discussions / General Discussions / Re: Eclipse vs. Netbeans on: 2011-07-10 07:54:03
The choice of IDE's really comes down to personal choice.  I do all my game development on a Linux netbook, and I've noticed that Eclipse preforms far better than Netbeans.  Netbeans is suppose to have a nifty Swing designer for fast GUI apps, but it always seemed kinda clumsy.

On my netbook it's the opposite: eclipse is slow while netbeans is much faster  Grin
5  Games Center / Showcase / Re: http://sourceforge.net/projects/callie/ on: 2011-06-29 10:00:27
Where can I find the .dll?
6  Games Center / Showcase / Re: http://sourceforge.net/projects/callie/ on: 2011-06-29 09:07:22


First is error is when I tried to run it the first time, second error is after I followed Preston's advice.
7  Java Game APIs & Engines / OpenGL Development / libgdx vertex attribute naming? on: 2011-06-05 19:30:44
Hi guys!

I just started looking into libgdx and OpenGL (ES 2). Once I felt comfortable with rendering some easy, basic shapes I decided to try to import a .obj file.
The file loaded fine, however it wouldn't render at all. So I started digging in the source code for the ObjLoader and found that the loader names the attributes as "a_Position" and "a_TexCoord" while both the tutorials and the SpriteBatch class names them "a_position" and "a_texCoords".
Doesn't that break functionality since the wrong variable names get sent to the shaders?

The model rendered (kinda) when I manually edited the attribute to "a_position" after loading the model.

I don't know, maybe I'm wrong and it's supposed to be like this? If so, please explain why.

cross-post: http://badlogicgames.com/forum/viewtopic.php?f=11&t=1202
8  Game Development / Newbie & Debugging Questions / Re: Level Editor on: 2011-06-03 12:30:26
The easiest way is to use java serialization
9  Discussions / General Discussions / Re: ::cues Voodoo Child (Slight Return) solo while walking into the room:: on: 2011-05-29 08:19:11
Welcome Smiley
10  Discussions / General Discussions / Re: Cellphones for java development on: 2011-05-26 20:14:49
I definitely recommend the Galaxy SII, have heard nothing but good comments from owners of it.
11  Game Development / Newbie & Debugging Questions / Re: How does java handle Threads? on: 2011-05-23 15:19:05
What is double-checked locking?

Short story: Using lazy initialization to init a field by checking if the field is null twice (first one is outside a synchronized block, the second is inside a synchronized block) to make sure the field only gets initialized once. Kinda like this:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
// Broken multithreaded version
// "Double-Checked Locking" idiom
class Foo {
    private Helper helper = null;
    public Helper getHelper() {
        if (helper == null) {
            synchronized(this) {
                if (helper == null) {
                    helper = new Helper();
                }
            }
        }
        return helper;
    }

    // other functions and members...
}


It may seem to be correct code, but that code can go very wrong since the compiler can re-arrange instructions.
Making the helper field volatile will solve this problem though.

Longer story: Wikipedia and Google
12  Game Development / Newbie & Debugging Questions / Re: How does java handle Threads? on: 2011-05-23 07:27:39
Math holds 1 instance of Random. Here is the code inside Math.random:
1  
2  
3  
4  
5  
6  
7  
8  
9  
public static double random() {
    if(randomNumberGenerator == null) initRNG();
    return randomNumberGenerator.nextDouble();
}

private static synchronized void initRNG() {
    if(randomNumberGenerator == null)
        randomNumberGenerator = new Random();
}


Does anyone know why Math.random() uses double-checked locking? I read that dcl can cause very unexpected behaviours (like assigning a reference to an object before the constructor has run)
13  Game Development / Newbie & Debugging Questions / Re: True Type Font problem on: 2011-05-21 10:17:04
1  
return Font.createFont(Font.TRUETYPE_FONT, is).deriveFont(24);


The reason to why that line doesn't work is because you are calling Font.deriveFont(int style); instead of Font.deriveFont(float size);

You have to append an f to the parameter (to make it 24f instead of just 24) in order to call the right method.
14  Game Development / Shared Code / Re: Application Updater (similar to Webstart) on: 2011-05-20 08:10:58
Thanks for sharing, will try it out later Smiley
15  Games Center / Featured Games / Re: Legends of Yore on: 2011-05-08 20:54:26
Awesome!
16  Games Center / Featured Games / Re: Legends of Yore on: 2011-05-08 20:46:59
Pretty cool game, worked fine on galaxy s.

Is it possible to move the saved games between platforms, or are they incompatible?
17  Game Development / Newbie & Debugging Questions / Re: New Member + Snake Game on: 2011-05-08 13:42:58
For the size problem, try calling (in Snake.java) setResizable(false); before you call pack();

Also, I would recommend you to use BufferedImage instead of Image. They work pretty much the same way (you paint them using the same methods), but Image is a very old class and it is outdated.
18  Game Development / Newbie & Debugging Questions / Re: OpenGL Axis Rotations on: 2011-05-07 15:01:33
To op: I see what you mean by that weird rotation thingy, it does seem like when you rotate around the x-axis, the y and z axis switch places with each other.
I haven't worked with opengl that much before, but wouldn't it be better to just have one glRotatef call? Like glRotatef(1.0f, rotX, rotY, rotZ); or something like that.

Maybe, but from what I understand is that glRotatef(angle, x,y,z) where angle is the angle of rotation, and x,y,z is either 1.0f or 0.0f, depending if you want to rotate that angle on that axis. The problem is that the angle for each axis is not the same, say maybe I want to rotate 90 degrees on the X-axis, but 180 degrees on the Y-axis.


Maybe, I just heard somewhere that you should minimize your calls to opengl. I should probably let someone more experienced answer this though Wink
19  Game Development / Newbie & Debugging Questions / Re: Minor confusion about booleans on: 2011-05-07 14:48:10
Perhaps we are getting a bit off topic, but XOR can also be used for swapping values of two variables without the use of an extra variable. So in theory it has many uses...
This page also seems to have related information: http://stackoverflow.com/questions/160697/is-it-good-practice-to-use-the-xor-operator-in-java-for-boolean-checks

- Scarzzurs

Thanks for the link. I have never used xor before (have heard of though) but that cleared up some question marks for me Smiley
20  Game Development / Newbie & Debugging Questions / Re: OpenGL Axis Rotations on: 2011-05-07 14:40:59
I get a NullPointerException in org.lwjgl.opengl.GL11.glShadeModel() at line 160 in rubikEngine.Engine.initGL()
I also get a RuntimeException saying "Image based resources must be loaded as part of init() or the game loop. They cannot be loaded before initialisation." (haha they misspelled initialization) This was thrown inside the Slick library at line 426 in rubikEngine.Engine.loadTextures()

Hope that helped Cheesy

The game worked fine here on W7.

To op: I see what you mean by that weird rotation thingy, it does seem like when you rotate around the x-axis, the y and z axis switch places with each other.
I haven't worked with opengl that much before, but wouldn't it be better to just have one glRotatef call? Like glRotatef(1.0f, rotX, rotY, rotZ); or something like that.
21  Game Development / Newbie & Debugging Questions / Re: Minor confusion about booleans on: 2011-04-30 23:09:19
for that we have XOR (exclusive OR)

1  
2  
3  
4  
if( a ^ b )
{

}


Maybe I'm just tired or something, but doesn't this code give the same result?

1  
2  
3  
if(a != b) {

}


Is there any advantage of using one over the other?
22  Game Development / Newbie & Debugging Questions / Re: Minor confusion about booleans on: 2011-04-30 21:29:07
I expect he means he wants to call a method with a void return type.

Exactly!

1  
2  
if (a || b) {
}


What if both are true?

That if-case means "if either a or b is true, run this block". Since both of them are true, it will run the block. The only way to make it not run the block is if both a and b are false.
23  Game Development / Newbie & Debugging Questions / Re: JVM reports timer taking longer than it should... on: 2011-04-20 00:42:05
Huh, that's kinda weird. I'll try to run the code and see what happens
24  Game Development / Newbie & Debugging Questions / Re: JVM reports timer taking longer than it should... on: 2011-04-19 18:29:00
I have read your code and if I'm correct, every second gameLength is subtracted by one and then sent to System.out.println().
The gameLength has been outputted 26 times which means that is has taken 26 seconds to complete. Why isn't gameLength starting at 25 like it should?
25  Game Development / Newbie & Debugging Questions / Re: Character Movement Bug on: 2011-04-18 12:08:05
Please provide some relevant code, it's kinda hard to help you otherwise  Tongue
26  Games Center / Archived Projects / Re: Archer Vs Zombies on: 2011-04-13 17:21:55
Could you please release an applet or a normal desktop application (.jar file). I tend to avoid webstart applications since they clutter the add/remove programs list.
But by judging from video this may end up pretty nice Smiley
27  Game Development / Performance Tuning / Re: Tile/LargeImage speed? on: 2011-04-13 05:00:52
First of all, you should take a look at active rendering on a Canvas instead of passive rendering on a JPanel
28  Discussions / General Discussions / Re: New feature: privacy plugin on: 2011-04-01 18:02:48
FINALLY! I have been waiting for this update for months! I love you Riven, thank you for finally protecting my privacy!  Kiss
29  Game Development / Newbie & Debugging Questions / Re: Another collision question on: 2011-03-30 20:13:16
Fixed it! had to switch
1  
if(Math.abs(t) >= 1.0){


to

1  
if(Math.abs(t) <= 1.0){


+rep for solving your own problem  Wink
30  Game Development / Newbie & Debugging Questions / Re: Where are my pixels!!??? on: 2011-03-25 19:47:36
the problem is that my red rectangle right and bottom lines does not appear, as my original code in the first post.

The best I could do was:

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  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
import java.applet.Applet;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Image;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;

public class Game extends Applet {

   private boolean isApplet;

   private Image image;

   public Game() {
      this.isApplet = true;
      this.setPreferredSize(new Dimension(640, 480));
   }

   public void init() {
      this.setPreferredSize(new Dimension(640, 480));
      this.setSize(new Dimension(640, 480));
   }

   public void paint(Graphics g) {
      g.setColor(Color.black);
      g.fillRect(0, 0, 640, 480);

      g.setColor(Color.red);
      g.drawRect(0, 0, 640, 480);

      g.drawImage(image, 0, 0, null);
      g.setColor(Color.green);
      g.drawLine(0, 0, 640, 480);
   }

   public void update(Graphics g) {
   }

   public void buildFrame() {
      Frame f = new Frame("Game");
      f.add(this);
      f.pack();
      f.setVisible(true);

      f.setLocationRelativeTo(null);

      System.out.println(f.getInsets().bottom);
      System.out.println(f.getInsets().top);
      System.out.println(f.getInsets().left);
      System.out.println(f.getInsets().right);
      System.out.println(f.getWidth());

      // 640+11
     // 480+31
     // f.setSize(640 + 11, 480 + 31);
     f.setSize(640 + f.getInsets().left + f.getInsets().right + 1, 480
            + f.getInsets().top + f.getInsets().bottom + 1);

      try {
         image = ImageIO.read(new File("image.png"));
      } catch (IOException e1) {
         // TODO Auto-generated catch block
        e1.printStackTrace();
      }

      this.isApplet = false;
      // Call applet init method.
     this.init();
   }

   public static void main(String[] args) {
      Game g = new Game();
      g.buildFrame();
   }
}


Using those insets() worked a little bit better but I still had to add a magic number (+1) there. Now running application mode in both Linux and Windows get almost the same result.

Quote
There shouldn't be a problem in Applet mode, since you've got the entire viewing area to paint

Have you tried my code and run as applet? Even running as applet in both Windows and Linux I'm not able to see right and bottom lines of the red rectangle.
1  
<applet code=Game width="640" height="480"></applet>


This is really weird, in fact, I haven't stopped to check this before... but it'd be nice to have one solution for both applet/application modes... any other tips?

thanks



When you tried my code, did you remove the f.setSize... part? Since f.pack() automatically calculates (and sets) the size of the frame needed to properly display all components. Also try what Abuse just said.
Pages: [1] 2 3 ... 5
 

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

The first screenshot will be displayed as a thumbnail.

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

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

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

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

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

BurntPizza (31 views)
2014-09-19 03:14:18

Dwinin (48 views)
2014-09-12 09:08:26

Norakomi (74 views)
2014-09-10 13:57:51

TehJavaDev (102 views)
2014-09-10 06:39:09

Tekkerue (50 views)
2014-09-09 02:24:56
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!