Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (844)
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-24 22: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 14: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 12: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 13: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 13: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 13: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 12: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 12: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 11: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 13: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 11: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 11: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 11: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 17: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 15: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 13: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 13: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 12: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]
EgonOlsen (42 views)
2018-06-10 19:43:48

EgonOlsen (22 views)
2018-06-10 19:43:44

EgonOlsen (43 views)
2018-06-10 19:43:20

DesertCoockie (197 views)
2018-05-13 18:23:11

nelsongames (124 views)
2018-04-24 18:15:36

nelsongames (123 views)
2018-04-24 18:14:32

ivj94 (863 views)
2018-03-24 14:47:39

ivj94 (125 views)
2018-03-24 14:46:31

ivj94 (768 views)
2018-03-24 14:43:53

Solater (140 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 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!