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 (843)
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]
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 (124 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!