Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (109)
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] 2 3 ... 36
1  Game Development / Newbie & Debugging Questions / Re: requst for newbie overview tutorial on porting options on: 2014-07-31 21:43:30
I don't know about Avian, but I do know that RoboVM isn't a VM, but is a tool for compiling java bytecode into iOS natives (via xcode). It's what libGDX uses to target iOS.
Yes, you have to write your graphics using the frameworks's paradigm. For libGDX that's often lots of Sprites, shaders if you need them, etc.
2  Discussions / General Discussions / Re: Mobile Version of Forum on: 2014-07-30 23:46:23
Don't like to keep requesting features willy-nilly, but if webm or whatever could be embedded then people could switch to gfycat like they should. Could even put a little reminder if they try to post an image tag ending in .gif "It would be appreciated if you rehosted this GIF from Gfycat, thanks" or whatever.
3  Game Development / Newbie & Debugging Questions / Re: requst for newbie overview tutorial on porting options on: 2014-07-30 22:06:30
You can do libGDX the old way, downloading a zip of the libs srcs, etc. or you can be cool and use gradle which handles everything for you. Either way there is also a project setup gui which is basically idiot proof.
4  Game Development / Newbie & Debugging Questions / Re: Double Buffering with a JPanel on: 2014-07-30 19:04:13
@Kevin Also see my example.
5  Game Development / Newbie & Debugging Questions / Re: requst for newbie overview tutorial on porting options on: 2014-07-30 18:56:11
I just don't see how it's better than libGDX.
6  Game Development / Newbie & Debugging Questions / Re: Double Buffering with a JPanel on: 2014-07-30 18:41:27
You should only be modifying the JLabels on the EDT.

Update the JLabels from the EDT. Let them paint themselves.

This is solid advise as well.
Another demo modification:

(back to normal colors, no NColor hacks)
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
<snip>
while (true) {
      if (count++ % 30 == 0) {
         color++;
         final int c = color;
         SwingUtilities.invokeLater(() -> {  // run update on EDT (you don't have to use JDK8)
           label1.setBackground(colors[c & 1]);
            label2.setBackground(colors[c + 1 & 1]);
            label3.setBackground(colors[c & 1]);
            try {
               Thread.sleep(30);
            } catch (Exception e) {
            }
            label4.setBackground(colors[c & 1]);
         });
      }
      panel.repaint();
      Thread.sleep(16);
   }


Updates in lockstep.
7  Game Development / Newbie & Debugging Questions / Re: Double Buffering with a JPanel on: 2014-07-30 18:32:57
I doubt it is, but if the fact that the JLabels cause repaints is really your problem, there is a way to prevent it, although it's a really nasty hack:

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  
<snip>
      NColor[] colors = new NColor[] { new NColor(Color.white), new NColor(Color.lightGray) };
     
      while (true) {
         if (count++ % 30 == 0) {
            label1.setBackground(colors[++color & 1]);
            label2.setBackground(colors[color + 1 & 1]);
            label3.setBackground(colors[color & 1]);
            Thread.sleep(30);
            label4.setBackground(colors[color & 1]);
         }
         panel.repaint();
         Thread.sleep(16);
      }
   }
}

@SuppressWarnings("serial")
class NColor extends Color {
   
   public NColor(Color c) {
      super(c.getRGB());
   }
   
   @Override
   public boolean equals(Object obj) {
      return true; // AAHHH
  }
}


Note that the labels change their backgrounds in lockstep (the panel.repaint()) even though there's that sleep(30) that from my previous example would normally cause a lag on label4.
I expect there is a similar hack for setText().

I do not recommend this at all, but you might try it just to see if that is what your problem actually is.
8  Game Development / Newbie & Debugging Questions / Re: Double Buffering with a JPanel on: 2014-07-30 18:13:09
What about if you insert a sleep(30):
1  
2  
3  
4  
5  
label1.setBackground(colors[++color & 1]);
label2.setBackground(colors[color + 1 & 1]);
label3.setBackground(colors[color & 1]);
Thread.sleep(30);
label4.setBackground(colors[color & 1]);


Is that like what you're experiencing, like what you mean by "a lot more code in between changing the display"? Update all states at the same time and you should be good, if there's signifficant stuff executing in between the updating of different UI components, then yeah, that's gonna look weird.
9  Game Development / Newbie & Debugging Questions / Re: Double Buffering with a JPanel on: 2014-07-30 17:21:49
I don't see any de-syncing here:

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  
public static void main(String[] a) throws InterruptedException {
   JFrame frame = new JFrame();
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   frame.setSize(400, 400);
   frame.setLocationRelativeTo(null);
   
   JPanel panel = new JPanel(); // JPanel is double buffered by default
  frame.add(panel);
   panel.setLayout(new GridBagLayout());
   
   JLabel label1 = new JLabel("Label 1");
   JLabel label2 = new JLabel("Label 2");
   JLabel label3 = new JLabel("Label 3");
   JLabel label4 = new JLabel("Label 4");
   label1.setOpaque(true);
   label2.setOpaque(true);
   label3.setOpaque(true);
   label4.setOpaque(true);
   panel.add(label1);
   panel.add(label2);
   panel.add(label3);
   panel.add(label4);
   
   frame.setVisible(true);
   
   int count = 0;
   int color = 0;
   
   Color[] colors = new Color[] { Color.white, Color.lightGray };
   
   while (true) {
      if (count++ % 30 == 0) {
         label1.setBackground(colors[++color & 1]);
         label2.setBackground(colors[color + 1 & 1]);
         label3.setBackground(colors[color & 1]);
         label4.setBackground(colors[color & 1]);
      }
      Thread.sleep(16);
   }
}


In fact I don't even see it when the labels are added straight to the JFrame without a JPanel.
10  Game Development / Newbie & Debugging Questions / Re: Double Buffering with a JPanel on: 2014-07-30 16:53:41
The method setIgnoreRepaint(true) tells Swing/AWT to ignore the repaint-messages from the operating-system, but does not disable the repaint()-calls that are made in setText(). See here: http://docs.oracle.com/javase/7/docs/api/java/awt/Component.html#setIgnoreRepaint(boolean)

Indeed, you're quite right. Forgot about that distinction.

@OP I think everyone would appreciate an sscce of what it is you're actually trying to do.
11  Game Development / Newbie & Debugging Questions / Re: Double Buffering with a JPanel on: 2014-07-30 16:44:56
If the labels calling additional repaints() is actually your problem, why not this:

1  
2  
3  
4  
5  
6  
7  
loop {
    canvas.setIgnoreRepaint(true);
    app.update();
    canvas.setIgnoreRepaint(false);
    canvas.repaint();
    sleep();
}
12  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Shader libs? on: 2014-07-29 08:16:50
Waiting for lib to transpile GLSL to BufferedImageOps. Roll Eyes
Not that it would be thoroughly useless or anything...
13  Game Development / Game Play & Game Design / Re: Weighted Entity Drops on: 2014-07-29 03:39:04
http://www.java-gaming.org/topics/calculating-probabilities-is-this-the-right-way/33201/view.html
14  Game Development / Newbie & Debugging Questions / Re: Can someone teach me Perlin Noise? for my 2d game? on: 2014-07-28 22:22:28
Matheus has what looks like a good simplex noise implementation in his utils collection: https://github.com/matheus23/Utils
15  Game Development / Game Mechanics / Re: Improving performance for a blood rendering on: 2014-07-28 01:27:09
Pretty sure you can call glBegin/End outside of the particle render loop instead of for every particle, so try that first, but yeah, no real reason to stick around with that crap.

Could you describe in more high-level terms (pseudocode perhaps, general algorithm description) what it is you're actually trying to do? I'm having trouble determining it but it looks slower than it needs to be.
16  Discussions / Miscellaneous Topics / Re: What I did today on: 2014-07-27 09:28:33
In an effort to get used to it, I have immersed myself into Java 8 through gross over-application of streams and lambdas:

Scan program arguments for a file path and attempt to load it as an image:

1  
2  
3  
4  
5  
6  
7  
Arrays.stream(args)
    .filter(possiblePath -> Files.isReadable(Paths.get(possiblePath)))
    .map(path -> loadImage(path))
    .filter(possibleImage -> possibleImage.isPresent())
    .map(confirmedImage -> confirmedImage.get())
    .findFirst()
    .ifPresent(image -> gui.canvas.setImage(image));


It's elegant in a twisted sort of way I suppose, although the pre-JDK8 version is actually shorter (I think):

1  
2  
3  
4  
5  
6  
7  
8  
9  
for (String arg : args) {
    if (Files.isReadable(Paths.get(arg))) {
        BufferedImage img = loadImage(arg);
        if (img != null) {
            gui.canvas.setImage(img);
            break;
        }
    }
}


(yes I am aware I could skip the Files.isReadable() if I just eat all the exceptions ImageIO would give for non-paths, I'm considering it)
17  Discussions / General Discussions / Re: Netbeans + Gradle = Im annoyed. on: 2014-07-27 04:58:19
NetBeans allows multiple projects with the same name? I know Eclipse has it's own bullshit, but not like that.
18  Discussions / Miscellaneous Topics / Re: What I did today on: 2014-07-25 23:50:20
Added sheep a ducks, meant a new quadruped skeleton and some massively complex sprites - oh wait no

See, now that's programmer art. Just bunches of rectangles, but it looks good, like it could only be that way.
19  Discussions / Miscellaneous Topics / Re: What I did today on: 2014-07-25 22:49:25
I am creating a library to novice programmers understand how programming works:

If you're extending a class to get it's static variables/methods more conveniently, I recommend using a static import instead:

import static net.lib.eternalGL.Sistema.*;


20  Discussions / Miscellaneous Topics / Re: What I did today on: 2014-07-25 20:15:38
Don't forget <blink>
21  Game Development / Newbie & Debugging Questions / Re: Making a square JPanel on: 2014-07-25 19:27:25
Try something like this: http://stackoverflow.com/a/8917978/3517265
22  Game Development / Newbie & Debugging Questions / Re: [LibGDX] Blurring on Zoom on: 2014-07-25 03:48:16
http://www.badlogicgames.com/wordpress/?p=1403

You need to use a Nearest filter, not a linear one, which causes the blurring.
23  Games Center / WIP games, tools & toy projects / Re: [MAC OSX] JarBundle - A simple jar bundling application on: 2014-07-24 19:32:33
@BurntPizza

I've seen that, but I wanted my app to be used with Swing apps in general. Though I haven't used it, it looks pretty nice.

Packr can bundle swing apps last I checked.
24  Games Center / WIP games, tools & toy projects / Re: [MAC OSX] JarBundle - A simple jar bundling application on: 2014-07-24 19:21:03
There's also Packr
Might be handy if you haven't seen it.
25  Discussions / Miscellaneous Topics / Re: What I did today on: 2014-07-24 18:10:10
Looked at Rust, discovered some willfully teeth-grinding grammatical irritations. Wonder if someone might care to remake Rust using Java-like standards of readability and grammatical consistency. Core concept behind Rust is great, and well prepared for hundred-core home computers. Probably it needs an appropriately designed operating system too though, which more or less means, not Unix or Windows.

Cas Smiley

One of the things they're working hard on at the moment is ergonomics, they are well aware of some of the thorns. Although if you mean things like abbreviated keywords then I think most of that is there to stay.
My main issue with it right now is the constant breaking changes, but once 1.0 hits I'll be reading the docs and tutorials through and through.
26  Games Center / WIP games, tools & toy projects / Re: Prophour23 - a fast-paced, randomized RTS on: 2014-07-23 18:34:59
I've had lightening strike nearby outside, I was listening to music on my earphones at the time, and the one in my left ear was shot out of my ear with a (to me) loud bang and blueish-white flash of light in my peripheral vision. Scared the shit out me. Amazingly it wasn't broken either.
27  Game Development / Newbie & Debugging Questions / Re: Need suggestions to fix my lighting system on: 2014-07-21 05:19:26
I'm pretty sure that that loop over every pixel (probably the slowest part) could also be done in a fragment shader, and since that's really the only part you needed the BufferedImage for, you could probably skip that whole ordeal all together.

Any time you think "draw every pixel of the _____ " you should then immediately think "fragment shader" and then figure out if that is possible.
28  Game Development / Newbie & Debugging Questions / Re: Need suggestions to fix my lighting system on: 2014-07-21 04:56:28
Don't use get/setRGB(), for one.

Much faster: http://www.java-gaming.org/topics/pixel-manipulation-with-bufferstrategy/30362/msg/280922/view.html#msg280922
29  Discussions / General Discussions / Re: What? Your game isn't a pixelated retro masterpiece? on: 2014-07-18 23:44:55
Well absolutely, however 16 bit games look way better than those fake retro indie games today

I think at least a large part of this is that people want the ease of the limited color pallet but don't know how to make/use a good pallet.
Finding colors that look good together and in context of your other stuff is surprisingly difficult.
30  Game Development / Performance Tuning / Re: Can someone explain what is going on with this square rooting? on: 2014-07-18 20:33:08
Maybe that was just a brainfart, but don't use getTimeMillis(). nanoTime() is superior.
Pages: [1] 2 3 ... 36
 

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 (25 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!