Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (475)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (530)
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 ... 35
1  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.
2  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
3  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.
4  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.
5  Game Development / Newbie & Debugging Questions / Re: How to load an image from a jar? on: 2014-07-17 17:17:56
You could do that, or read entries piecemeal via JarFile.getInputStream(<entry>) if I'm not mistaken.
6  Game Development / Newbie & Debugging Questions / Re: How to load an image from a jar? on: 2014-07-17 17:05:10
I believe that one can also use a JarInputStream or JarFile to read the currently executing jar as if it was a directory structure as well, although certainly getResource() is much more convenient. Just pointing out that there's nothing magical about the "currently executing jar," it's a readable file like any other.

But yeah, just use getResourceAsStream() and use Riven's tool I linked if you have trouble.
7  Game Development / Newbie & Debugging Questions / Re: How to load an image from a jar? on: 2014-07-17 16:55:57
Indeed, although "resources" is a bit hand-wavey IMO, they are technically zip-file entries, as jar files are actually thinly veiled zip archives.
8  Game Development / Newbie & Debugging Questions / Re: How to load an image from a jar? on: 2014-07-17 15:56:29
http://www.java-gaming.org/topics/faq-cannot-find-the-resource-file/33226/view.html
9  Discussions / Miscellaneous Topics / Re: How would you define "Coding Experience"? on: 2014-07-17 04:55:40
It's not formal, just put down the duration you think is most applicable to how long you would say you've been programming, like you might on a job application or something (although maybe that is formal).

PS @Ecumene: You can insert empty formatting tags to interrupt the parser instead of periods: [icode][/icode]

@Ray Well then there's the "Java Experience"
10  Discussions / Miscellaneous Topics / Re: What I did today on: 2014-07-17 01:07:15
@Cas

"Balloon in a vice" reminds me of glass bottle injection molding:

11  Game Development / Newbie & Debugging Questions / Re: Animating on: 2014-07-17 00:57:31
Just export the flash animations as spritesheets: http://www.adobe.com/devnet/flash/articles/using-sprite-sheet-generator.html

Then use spritesheet animation like GNecro posted.
12  Game Development / Newbie & Debugging Questions / Re: BlockBreak brick flicker on: 2014-07-17 00:16:37
Yeah, ok. That loop has an unconstrained (thus irregular) period, which manifests as stuttering, and since the maximum speed at which it can run is (only) 50 Hz, it may appear as flicker.

To achieve a constant period you do something like this:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
desiredPeriod = 1000 / 60; // 60 FPS in milliseconds

loop {
    timeBefore = currentTime();
   
    doStuff();
    renderStuff();
 
    timeElapsed = currentTime() - timeBefore; // final minus intial = delta

    wait(desiredPeriod - timeElapsed); // wait the remaining time, until total loop time is equal to desiredPeriod
}


In actual code:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
long period = 1000000000L / 60; // in nanoseconds

while(running) {
    long time = System.nanoTime();

    gameUpdate();
   
    try {
        while (System.nanoTime() - time < period)
            Thread.sleep(1);
    } catch (InterruptedException e) {}

}


Some don't like the wait loop, but with a sleep(1) inside of it I've found it's about as smooth as one can get without burning up the CPU.

Converting from an applet to a JFrame is easy, although there are a few tips:

Instead of extending Applet, extend JComponent (or JPanel) and put everything from your init() into the constructor. Also make sure you setPreferredSize() in the constructor, so that this will behave as you want:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
// in main():

JFrame frame = new JFrame("Title");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(gamePanel); // your "applet"
frame.pack(); // resize the frame around your gamePanel, depends on setPreferredSize() in gamePanel

// optional, centers the frame on screen:
Dimension ss = Toolkit.getDefaultToolkit().getScreenSize();
frame.setLocation(ss.width / 2 - frame.getWidth() / 2, ss.height / 2 - frame.getHeight() / 2);

// finally:
frame.setVisible(true);
13  Game Development / Newbie & Debugging Questions / Re: BlockBreak brick flicker on: 2014-07-16 23:53:18
Don't really understand what you mean, "running at 20 ms." Is that each cycle takes 20 ms (50 FPS) or you sleep 20 ms each cycle (??? < 50 FPS)

Mind posting your game loop?
14  Game Development / Newbie & Debugging Questions / Re: BlockBreak brick flicker on: 2014-07-16 23:43:50
If you are double buffering, then flicker could be caused by simple low FPS. I know shape drawing/filling is pretty slow, what speeds are you getting?

EDIT: Also, applets are dead. Really, 99% of people can't run them without extensive troubleshooting, myself included.
15  Games Center / WIP games, tools & toy projects / Re: [Slick2d] Retro-Pixel Castles > OFFICIAL WEBSITE LAUNCHED! < on: 2014-07-16 20:23:09
Have you considered one of those "chunk systems" where only the region around the player is loaded? Or does the game mandate that everything is going all the time?
Even if everything needs to be in simulation at once, distant areas might not need all the information loaded, e.g. only the collision and entity layers.
If you ever want to go back to the large(r) maps you might look into it.

Looking good though!
16  Discussions / General Discussions / Re: Java Swing GUI Creator on: 2014-07-16 20:16:23
I (and others I presume) have been meaning to pick up JFX, you guys got any tips on good places to start?
17  Game Development / Newbie & Debugging Questions / Re: Dropping items in in a stack on: 2014-07-16 05:07:58
How do you store your blocks? If it's a simple Block[][] (or similar) you can just do this:

1  
2  
3  
4  
5  
6  
7  
Block[][] blocks; // assuming [y][x] indexing

void removeBlock(int x, int y) {
    for(int t = y; t < blocks.length - 1; t++)
        blocks[t][x] = blocks[t + 1][x]; // move (copy) each block down (assuming t+1 is above t)
   blocks[blocks.length - 1][x] = null; // or blocks[][] = BLOCK_AIR or something
}


Work up from the block that is removed, shifting each one down.
If each Block has position fields don't forget to update those as well.
18  Game Development / Newbie & Debugging Questions / Re: Dropping items in in a stack on: 2014-07-16 04:56:55
I'm assuming blocks store their position somehow. Subtract 1 from the y coordinate of every block above the one that is removed.
19  Game Development / Newbie & Debugging Questions / Re: Dropping items in in a stack on: 2014-07-16 04:51:30
ArrayList does this automatically:
list.remove(0); // pull out first item, all other items shift down 1 place


20  Games Center / WIP games, tools & toy projects / Re: Vox2D JGL - Easy AWT Game Wrapper on: 2014-07-15 23:54:50
Are you at all affiliated with The Voxel Box?
21  Game Development / Newbie & Debugging Questions / Re: Did you know? Hints and tips on: 2014-07-15 01:31:07
You can initialize a List/Collection of any sort in one statement using double bracket initializers, like you can with arrays:
<snip>

Reasons this might not be a great idea: http://stackoverflow.com/questions/924285/efficiency-of-java-double-brace-initialization

Some alleviation using Arrays:
List<String> s = Arrays.asList("1", "2");


22  Game Development / Newbie & Debugging Questions / Re: Did you know? Hints and tips on: 2014-07-15 00:49:20
If you're going for absolute performance, many of the Math arithmetic methods (min, max, abs, etc.) are usually intrinsified, and thus likely unbeatable in terms of speed. (disregarding high level optimizations)
Here's a list of known intrinsics: http://www.java-gaming.org/topics/hotspot-intrinsics/27010/view.html

However make sure you read the Math source, some methods (sin, cos, etc.) delegate to StrictMath and may not be intrinsified, which you could probably beat if you don't mind approximation.
23  Game Development / Newbie & Debugging Questions / Re: Did you know? Hints and tips on: 2014-07-15 00:37:34
Another good 1... Test for even or odd: (value & 1) == 0.
It's faster than value % 2 == 0!   Wink

It's quite likely it's not faster.
At least not noticeably faster.
24  Game Development / Newbie & Debugging Questions / Re: ArrayIndexOutOfBounds WTF? on: 2014-07-14 20:42:30
1  
2  
3  
4  
5  
6  
for (int i = 0; i < tiles.length; i++) {
-    for (int j = 0; i < tiles[0].length;j++) {
+    for (int j = 0; j < tiles[0].length;j++) {
        tiles[i][j] = new Grass(i * 64, j * 64);
    }
}
25  Game Development / Newbie & Debugging Questions / Re: ArrayIndexOutOfBounds WTF? on: 2014-07-14 20:37:46
If that complies I'm guessing you have a List tiles variable hiding your Tile[][], as that would be tiles.length not size()

EDIT: Half-ninja'd
26  Discussions / Miscellaneous Topics / Re: What I did today on: 2014-07-14 08:23:03
I just made multi-layered nebula which scrolls together with mouse.

Is it procedural at all or pre-made textures?
Have been thinking of making a procedural galaxy/nebula thingamabob.
27  Discussions / Miscellaneous Topics / Re: What I did today on: 2014-07-12 22:52:20
So you did copy it and change the colors, but you made them look like the guys from GoodMythicalMorning. I like that  Pointing

Now just draw them in 200 some different shirts!
28  Games Center / WIP games, tools & toy projects / Re: Prophour23 - a fast-paced, randomized RTS on: 2014-07-12 22:45:55
Hey, I saw a blog entry on that death animation on /r/gamedev not too long ago, and now you show up here! Congratz on getting greenlit!
29  Discussions / Miscellaneous Topics / Re: [Girls] How to completely block them from our lives? on: 2014-07-12 22:27:52
Jev loves programming less, so Jev loves distractions, so Jev loves girls, so Jev hates this thread, Jev hates 4chan, Jev loves JGO, hate to the beloved should transform in hate to the hated, so this all makes sense.

That made made so little logical sense it made sense it was in this thread.

I can't deliver the finality of Riven, but I'm begging everyone to forget about this thread and

just

stop.


[ Request thread lock ]
30  Discussions / Miscellaneous Topics / Re: What I did today on: 2014-07-12 01:41:28
EDIT: Sorry, the GIF is a bit big..

Use [img width=800][/img]
Pages: [1] 2 3 ... 35
 

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

The first screenshot will be displayed as a thumbnail.

ctomni231 (32 views)
2014-07-18 06:55:21

Zero Volt (28 views)
2014-07-17 23:47:54

danieldean (24 views)
2014-07-17 23:41:23

MustardPeter (25 views)
2014-07-16 23:30:00

Cero (40 views)
2014-07-16 00:42:17

Riven (42 views)
2014-07-14 18:02:53

OpenGLShaders (29 views)
2014-07-14 16:23:47

Riven (29 views)
2014-07-14 11:51:35

quew8 (27 views)
2014-07-13 13:57:52

SHC (63 views)
2014-07-12 17:50:04
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

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!