Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (538)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (600)
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:

            if(main.activeLevel.itemMap[fp.hor][fp.ver]!=null)

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?

Thanks.
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
Greg
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!
Greg
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.
Greg
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.

rwatson462 (28 views)
2014-12-15 09:26:44

Mr.CodeIt (19 views)
2014-12-14 19:50:38

BurntPizza (37 views)
2014-12-09 22:41:13

BurntPizza (72 views)
2014-12-08 04:46:31

JscottyBieshaar (34 views)
2014-12-05 12:39:02

SHC (46 views)
2014-12-03 16:27:13

CopyableCougar4 (42 views)
2014-11-29 21:32:03

toopeicgaming1999 (110 views)
2014-11-26 15:22:04

toopeicgaming1999 (96 views)
2014-11-26 15:20:36

toopeicgaming1999 (29 views)
2014-11-26 15:20:08
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
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!