Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (711)
Games in Android Showcase (213)
games submitted by our members
Games in WIP (785)
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  Game Development / Newbie & Debugging Questions / Ok I don't get this on: 2009-10-10 21:46:52
Hi all,

I've got this in my code:


The compiler complains about it. It says: array required but ItemMap found. It would not compile. ItemMap is an array (obviously), holding references to Item objects. What I'm trying to do in this line is to check whether the Item object is null or not. Why is this line not valid, can someone please tell me or should I just simply call the mental hospital as I'm going nuts?

2  Game Development / Performance Tuning / Re: ArrayLists and Receding Hairline on: 2009-10-02 15:22:37
Ok, ok, got the message guys. Since every one of you say the problem can't be the ArrayList I believe you and try to dig deeper. It's probably the rendering that does something dodgy.

Regardless, I'm still losing hair.
3  Game Development / Performance Tuning / Re: ArrayLists and Receding Hairline on: 2009-10-02 00:56:50
Hmm you made a point here Riven, I actually didn't profile it, I might do it in the next 2 minutes .. However due to my calculations using ArrayList appears to be the root of the problem. If I replace ArrayList with Arrays my program produces almost 20% better performance. I don't use JOGL, I'm working with plain old J2D. Even 2D is quite confusing to me but hey that's the thing about java, it's meant to be confusing to keep the bloody "flashers" away, innit Smiley) No hardware acceleration so far, but I'm planning to keep sprites in VolatileImages. Right now the program keeps everything in BufferedImages. I also use double buffering, which is a good thing apparently.

4  Game Development / Performance Tuning / ArrayLists and Receding Hairline on: 2009-10-01 21:02:59
Hi again,

I have built a (theoretically) wonderful gfx framework for my upcoming games to make life easier, that was the purpose anyway. I'll explain what it's all about.
I read a book on ActionScript 3 the other day and there I found a rather good solution for chaining Sprites together, they call it DisplayList in AS. The whole idea is that you've got the "stage" where each and every one of the DisplayObjects belong. Then you've got DisplayObjectContainers that can hold other DisplayObjectContainers or DisplayObjects. It's very easy to add or remove sprites to/ from this displayList, swap objects, etc. I copied this idea and I built my own little DislpayList in Java. Works perfectly, it is very comfortable to use, I am a hundred percent satisified with it apart from one thing: it's f**kin slow.

The problem is ArrayList: I'm using it to keep references of children objects. So every time the program attempts to repaint what's on the displaylist it has to iterate through all the members which process proved to be a lot slower than what I expected. (I tested it with and without arrayLists, if I use arraylists with only 2-3 objects added to the list I lose 8-10 frames per second.. and there are meant to be DOZENS of objects in the displayList, not 2-3!!! )
I KNOW how much quicker simple arrays are but they've got a fixed size which makes them absolutely useless in this case. I need a flexible solution but a lot quicker than this stupid arraylist.

Any solution?
Or did anyone understand this gibberish post at all?

Well, any answers are welcome
5  Java Game APIs & Engines / Java 2D / Re: Can't draw into BufferedImage on: 2009-09-30 01:03:47
Wow lads, I looked up BufferStrategy and although I haven't had the chance to try it out I like it already Smiley) I think once I've heard of it somewhere but never knew exactly what it was. I'll defo give it a go!

I still can't draw into my buffered images though, but I think I know how I should work around it (leave 'em out of the program Smiley).

Thanks for your help guys!
6  Java Game APIs & Engines / Java 2D / Can't draw into BufferedImage on: 2009-09-29 17:57:53
So here we go, my first ever post on a forum. And I'm really embarrassed about it because it is a very simple one still I can't get my stupid head around it. I haven't really worked with Java2D so far, let alone bufferedImages. So:

I've got an ever-changing buffered image, it represents the screen. This buffered image is drawn into the screen directly. There are many other buffered images that are drawn into this first big one. My problem is that when you try to move these smaller buffered images the screen behind doesn't get cleared as it is a bufferedImage itself. I found one solution to this problem:

    screenBuffer. setComposite(AlphaComposite.getInstance(AlphaComposite.CLEAR, 0.0f));
    Rectangle2D.Double rect = new Rectangle2D.Double(0, 0, screen.width, screen.height);
    screenBuffer. fill (rect);

So far so good, the main bufferedImage in the background gets cleared up, but I can't draw ANYTHING into it anymore, can someone please tell me why?

  Naively I tried to add one more line after the above code:

screenBuffer. setComposite(AlphaComposite.getInstance(AlphaComposite.BITMASK, 1.0f));

..and it didn't work obviously. What I tried to do here is to clear all the pixels of the bufferedImage, then set the alpha back to normal so that anything added to screenBuffer after this line would get drawn.

Any solution for this? Thanks in advance.
Pages: [1]
numerical (144 views)
2017-02-21 07:32:16

numerical (144 views)
2017-02-21 07:31:46

theagentd (251 views)
2017-02-18 13:42:33

theagentd (253 views)
2017-02-18 13:35:16

h.pernpeintner (1415 views)
2017-01-24 22:39:11

h.pernpeintner (1404 views)
2017-01-24 22:38:32

Galdo (1966 views)
2017-01-12 13:44:09

Archive (2028 views)
2017-01-02 05:31:41

0AndrewShepherd0 (2565 views)
2016-12-16 03:58:39

0AndrewShepherd0 (2325 views)
2016-12-15 21:50:57
List of Learning Resources
by elect
2016-09-09 09:47:55

List of Learning Resources
by elect
2016-09-08 09:47:20

List of Learning Resources
by elect
2016-09-08 09:46:51

List of Learning Resources
by elect
2016-09-08 09:46:27

List of Learning Resources
by elect
2016-09-08 09:45:41

List of Learning Resources
by elect
2016-09-08 08:39:20

List of Learning Resources
by elect
2016-09-08 08:38:19

Rendering resources
by Roquen
2016-08-08 05:55:21 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!