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]
1  Java Game APIs & Engines / Java 2D / Re: Problems with JButton with an image on :( on: 2003-05-25 00:13:23
if you are using an image as the button and don't want the JButton to show any of itself, set an emtpy border on the JButton with insets all of 0 (so no "Extra" button is drawn), turn "isOpage" to false so its background isn't drawn, and you can set paintBorder and paintFocus to false as well, see if this helps.
2  Game Development / Performance Tuning / Re: Vector looping on: 2002-12-13 15:03:54
blahh bllahh, I appreciate the post... those are important points to consider...
3  Game Development / Performance Tuning / Re: Image loading.... on: 2002-12-13 13:23:27
I can only assume the frame creation is slowing you down, that's expensive Sad

I don't typically like this solution, but using an ImageIcon will do exactly the code you just posted, minus the frame creation because it keeps a static reference to a Component that it uses.

So you can use the ImageIcon class to speed things up (since it Component is already creataed for you).

4  Game Development / Performance Tuning / Re: Vector looping on: 2002-12-10 14:23:05
Chris's explination is much better than mine, listen to him Smiley


I was wondering that exact thing about manipulating the int array instead of using the new* methods... if this is the case, and changing the array changes the source, that is gonna be slick as hell for performance minded programming that needs that functionality...

Can anyone verify/deny this?
5  Game Development / Performance Tuning / Re: Vector looping on: 2002-12-10 14:12:11

that sounds really slick! I like it already, but if I can torture surfers that's gonna be great.

a memory image source is a class (MemoryImageSource I think) that stores a 2D int array representing pixel data... each pixel (x/y coord) can have a RGB value that you can get from java.awt.Color (Color.white.getRGB() for example) or make yourself. The javadoc decribes which bits define which color.

Anyway, he was suggesting that you actually manipulate the pixel color data, and then draw the memory image source (I think).

Also you can use a BufferedImage, where you can set the pixel data any time you want... so you could have a blue dot move around the screen by setting the x/y/RGB values for different pixels, then repainting the BufferedImage.

I'm skipping over performance here and also want to note that I think I confused the functionality of BufferedImage and MemoryImageSource... Buffered seems more friendly to mutability while Memory seems more tuned for creating and using. But I'm fairly new to this, so YMMV.
6  Game Development / Performance Tuning / Re: Vector looping on: 2002-12-10 14:00:27
haha after all this pleasent conversation I want to go implement my own water applet! Smiley
7  Game Development / Performance Tuning / Re: Vector looping on: 2002-12-10 13:43:24

The arraycopy is the "worst case" I was referring to, in that we can't avoid it. BUT your solution has a nice elegance to it, thanks for the suggestion (I'm not writing this water applet, just like the conversation)

As far as different reference types... I've never used them... i think I'm missing a huge optimization oportunity from what it sounds like (avoiding GC, using easily collected items, etc...) very cool!
8  Game Development / Performance Tuning / Re: Vector looping on: 2002-12-10 13:19:09
hmmm interesting suggestion... I don't know if that would work for this situation as he has an ever growing amount of droplets it seems (they stay at the bottom of the screen)...

For a constant number of ever changing items though, this seems to be a fantastic idea in that it avoids the arraycopy to move everything down one element when a new item arrives...

visually in my head, I imagine a frontIndex pointer, and an endIndex pointer, chasing eachother backwards around in a circle (assuming he ads to the front). Although I think the end result is the same as the linked list, less memory though... more computation and bounds double checking though....

I would be interested to see how this worked in a good implementation... the worst case scenarios being if they insert more objects and you just have to grow the array stays the same though...

hmm I'll go think about this.
9  Game Development / Performance Tuning / Re: Vector looping on: 2002-12-10 12:10:08
good point prince...

yea if you don't care about ordering, what prince suggested is the best idea, but you could probably cut that memory requirement down by using singly linked, and just keeping a permanent link to the first node (which is a dummy node), and the node before the last node.... so to remove you just do: = null;

to insert you pull a: =; = insertedNode;

This helps you save memory on the double linking, but it does suck more to work with. if you can spare the extra mem, double linked is sexy.

If ordering DOES matter, then you really have to go back to ground zero Sad
10  Game Development / Performance Tuning / Re: Vector looping on: 2002-12-09 14:23:43

//create array
//fill array with 2million diff strings
//enter outside loop, do 15 times
//start timer
//do inside loop, casting/accessing strings
//add time diff to running total
//done 15 times
//get time average

//do same thing, except don't cast, just use as object.

was that what you wanted?
11  Game Development / Performance Tuning / VM Options - Tune it! on: 2002-12-09 12:41:23
Guys I figured some of you might like this:

its from a huge performance discussion on nbdev (Netbeans). The most interesting is the:


option... set this really low (default = 1500), and everything gets compiled to native code after X accesses.
12  Game Development / Performance Tuning / Re: java.lang.Compiler on: 2002-12-09 12:39:43
If you want your code compiled to native code, change this setting:

-XX:CompileThreshold=10000 number of method invocations/branches before (re-)compiling [10,000 -server, 1,500 -client]

Set it to like "10", so if the method is accessed 10 times, its compiled to native code... or 1 or something like that. I've tried this wtih Netbeans (beast-app) and the startup time is pretty aweful, but the app runs really snappy after that. The memory consumption goes up though....
13  Game Development / Performance Tuning / Re: Vector looping on: 2002-12-09 12:35:29
I agree with princec, casting, as I've found with 1.4.1 under Windows costs near nothing.

I tried comparing the casting of 2million strings to not casting (accessing them in a for loop) and the time difference was like 23ms (on a 2.8ghz P4). Granted its a fast machine, but if the difference is 23ms after 2 million objects I figure that's a good "idea" of what it is.

Note: I ran these comparisons 15 times each and averages the times.

Also my co worker mentioned that casting is more expensive for "deeper" objects (something that extends many levels) so I tried casting 500k JButtons as compared to 500k Objects, same thing, almost no difference...

NOTE: J<anything> are EXPENSIVE, more expensive that I had realized... I was running out of memory like crazy with these tests.

Also as you mentioned you are accessing this collection every frame, I would stop creating the enumeration each time, you know how many items are in the collection, just go through them by index, caching the size as prince suggested to avoid the method call each time to check it.

Also, assuming you were taking these suggestions literally (as to have them in your rendering loop) don't put a toArray into the loop. You'll kick performance right in the nuts (I realize the author didn't mean for you to, I'm just clarifying incase).

But taking Leknor's suggestion, assuming you can do it, and having your "toArray" outside of the rendering loop, and converting it once, yea that would be the fastest since you don't need any casting... but I'm assuming your "land objects" is probably changing all the time, so this might not be a good idea as you'll need to toArray a lot.
14  Game Development / Performance Tuning / Re: Image loading.... on: 2002-10-22 19:53:02
I'm mostly concerned with little things like icons at this point, so the custom format, as you pointed out, is a bad idea (as photoshop will just laugh at me).

15  Game Development / Performance Tuning / Re: Image loading.... on: 2002-10-22 17:25:24
Thanks for the info princec, I hadn't even considered using my own file format, you have good points.
16  Game Development / Performance Tuning / Image loading.... on: 2002-10-22 15:39:10
I was reading the Java2D (iPlanet painting) article from the Swing Connectio and noticed them using this to load an image that they paint as a panel background:

BufferedImage image ="background.jpg");
imageFill = new ImageFill(image);

Now from what I've read here on JG, BufferedImages are the (only?) kind of image that cannot be accelerated. So wouldn't it have been better for them to do a Toolkit.getImage? Why, in this performance-minded article, would they use a BufferedImage? I think the name's misleading, as it "sounds" faster than a Image Smiley


P.S.> The reason I ask is because it seems nice and tempting to use the ImageIO class to load images, (read methods) but all it can return is BufferedImages, and I don't want to forgo the (automatic) images that are accelerated (when available).
17  Discussions / General Discussions / Re: Is Javagaming ONLY forums? on: 2002-10-16 15:18:41
Fantastic. I saw the "final touches" and didn't know extent.

I really look forward to what you end up having, this site is great.
18  Discussions / General Discussions / Is Javagaming ONLY forums? on: 2002-10-16 14:26:28
What happened to all the story links and articles? Granted these are some of the best Java forums around, but shouldn't this site have more content? (maybe I'm missing some link someplace, but all I see are forums...)

Thanks, new look is great! I like the popup ability.

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.

CogWheelz (18 views)
2014-07-30 21:08:39

Riven (27 views)
2014-07-29 18:09:19

Riven (16 views)
2014-07-29 18:08:52

Dwinin (14 views)
2014-07-29 10:59:34

E.R. Fleming (35 views)
2014-07-29 03:07:13

E.R. Fleming (13 views)
2014-07-29 03:06:25

pw (44 views)
2014-07-24 01:59:36

Riven (45 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 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‑
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!