Java-Gaming.org    
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: Scaling Line Segments on: 2005-02-12 00:21:14
Quote
errr, multiply each coord by 2 Huh


Argh...You're right.  Cheesy

Sorry, it's been a long day.

Drew  
2  Java Game APIs & Engines / Java 2D / Scaling Line Segments on: 2005-02-11 23:13:45
I've got some line segments on a 200x200 canvas in Java 2D, kinda like so:

g2d.drawLine(10,10,100,10);
g2d.drawLine(100,10,100,100);
g2d.drawLine(100,100,50,100);
g2d.drawLine(50,100,50,125);
g2d.drawLine(50,125,75,125);
g2d.drawLine(75,125,75,150);
....and so on...

What I'd like to do is to increase the canvas to 400x400 and scale up the drawing proportionately (double it).

Is there a formula to do this?  It needs to work so that whatever is drawn will be scaled (not just the example above).

My first thought was to scale the BufferedImage object itself but that seems like a bad idea.  Was thinking it would be better to just apply some forumla to the coordinates, right? Huh

Gracias,

Drew
3  Java Game APIs & Engines / J2ME / Resize Image on: 2004-06-06 14:15:42
I Have a J2ME image stored as an integer array.

Can anyone tell me how to resize this image (make it smaller)?

Do I need an interpolator for this?

Thanks,

Drew

4  Java Game APIs & Engines / Java 2D / Re: Scale Image in Byte Array on: 2004-01-16 13:27:41
Some of the newer devices support JPEG.

The problem is once you decompress these images, they are huge with respect to the size of the heap.

Drew

5  Java Game APIs & Engines / Java 2D / Scale Image in Byte Array on: 2004-01-16 03:16:21
I've been playing around with MIDP a bit and I've run into some problems because of the limited amount of heap space available (200K).

I've got a JPEG Image in a byte array and I'm wondering if there is a way to scale it down without
creating an Image object first?  

My first thought was to just loop through the array and take out some bytes.  Shocked  But I doubt that will work.   Smiley

Thanks,

Drew

6  Game Development / Performance Tuning / Re: Expanding Heap on: 2003-12-19 02:31:49
I didn't have much luck dumping the heap with -Xrunhprof - kept getting an error.

However, I did use -Xmx4m as a test and let the program run for at least 30 minutes and it worked fine.

Yet, I'm still not sure why the heap keeps growing when no maximum is set even though I can get away with only 4MB.

Is this just how the VM normally behaves?

Also, how does one determine what the optimum min and max heap size is for a program?

Drew
7  Game Development / Performance Tuning / Expanding Heap on: 2003-12-18 14:11:38
I wrote a little bowling game in Java a while back.

It was one of my first games and was a bit of a learning experience.

Anyway, I got my hands on a Java Profiler the other day and I ran this little game through it.

I noticed that the memory heap keeps getting a little bigger as the game progresses.  It started out using around 4MB then climbed to 6MB and eventually started to slow down at around 9MB after 30 mintues or so.  

However, the heap still seems to be growing slowly as the game continues to run.  Garbage Collection seems to be releasing some memory, but not as much as I expected.

Is there anything in particular that I should look for in my code that would explain why more memory is not being released?

Thanks,

Drew

8  Game Development / Performance Tuning / Re: Repainting Two Areas on: 2003-08-15 17:30:33
It's just a simple Java AWT game written in Java 1.1 with an offscreen buffer.  

Right now, I'm just redrawing the whole off screen image to the screen.

Are you thinking that it won't make much difference?

BTW, what do you mean exactly with respect to accelerated drawing operations?

Drew
9  Java Game APIs & Engines / Java 2D / Dirty Rectangles on: 2003-08-15 15:35:31
I want to try implementing a dirty rectangle algorithm in my game so that I don't have to repaint the entire screen.

Has anyone seen an article or source code on this that I could look at so that I could understand how this works?

Need something pretty simple to start with.   Wink

Thanks,

Drew
10  Game Development / Performance Tuning / Repainting Two Areas on: 2003-08-15 15:03:53
I'm trying to avoid repainting the entire screen in my game to get some extra performance, but I've got two areas that need to be repainted:  One is at the very top of the screen and the other is at the bottom.

Will I get better performance by clipping the repaint region and then alternating the on-screen repaint between the top and bottom as opposed to repainting the entire screen?

Regards,

Drew
11  Game Development / Performance Tuning / Re: Little Pauses on: 2003-08-07 20:15:01
Grrrr!

Well, it's definetly the sound effects causing most of the pauses.  

The only thing I can think is to remove the sound effects, but that's a pretty lame solution.  Cry

I guess I could put a toggle switch on it and let the user decide...

However, even after I removed all the sounds, there is one other little pause that comes when a sprite is rapidly changing directions.  Not sure what is causing this one yet.   Huh

Drew


12  Game Development / Performance Tuning / Re: Little Pauses on: 2003-08-07 17:06:02
Yes, there is a sound effect, I think that might be it.  I just took it out and it helped.

It's just an AudioClip class from Java 1.1 Applet package and I'm using the standard play() method.

Is there a better way to handle sound effects?  I need to stick with Java 1.1, however.

Drew
13  Game Development / Performance Tuning / Little Pauses on: 2003-08-07 16:46:57
I recently wrote a little bowling game in Java.

I tried really hard to reuse my objects and avoid the new keyword.

However, sometimes (not all the time, mind you) I still get this little pause before the ball hits the pins.  

I'm calling the garbage collector in between frames but I still see these little pauses every once in a while - very annoying!

How do I figure out what is causing this exactly?  I don't have much experience with profilers, etc.

Thanks,

Drew

14  Java Game APIs & Engines / Java 2D / Alpha Filter on: 2003-08-05 16:26:36
Java 1.1

I'm trying to make a spirte that fades out to completely transparent using java.awt.image.ImageFilter class.

I want to make this Java 1.1 compatible since the rest of my game is.

So far, I've been able to create an image that fades out, but I'm having trouble getting the background to stay transparent.

I'm using a GIF with transparent background, but I only want the spirte image itself to fade.  Right now, when I put the image through the filter, the transparent background is showing as a translucent white.

Any thoughts on the best way to handle this?

Is there a way to specify that a certain color (white) will always be completely transparent?

Thanks,

Drew
15  Java Game APIs & Engines / Java 2D / Re: Collision on Diagonal Line on: 2003-07-21 17:15:29
Sweet.

I actually got this working using both methods:

1.  Using a loop to compare all the points on a subset of the line to the x,y values of my sprite.

2.  Plug in the current x value of the sprite into the slope-intercept formula and compare the result to the current y value of the sprite.

I think I'll go with the second, it seems more elegant.  Wink

I couldn't really tell any performance difference, but I suspect the second method is better, too.

Thanks!

Drew

p.s. I'd still like to try the Bresenham algorithm someday...
I wish we had game API's that included cool algorithms like this.
16  Java Game APIs & Engines / Java 2D / Re: Collision on Diagonal Line on: 2003-07-20 17:18:40
Quote
If you have a bounding box, rather than step over each pixel in the line and test if it is in the box, simply solve for the intersection of the edges of the bounding box and the original line.  

Sounds like a good idea.

Can you give me any more help with the math for this?  

Like I said, it's been a long while...

Thanks,

Drew
17  Java Game APIs & Engines / Java 2D / Re: Collision on Diagonal Line on: 2003-07-20 17:15:42
Thanks for all the help!

BTW, are there any open source Java game utility libraries that would have algorithms such as Bresenham that I could use?

I would think that such utility classes would already exist since these types of problems must be common in game programming?

I guess I'll take a look at the Graphics 2D source if I can't find anything.

BTW, the bounding box for my sprite is a rectangle.

Drew

18  Java Game APIs & Engines / Java 2D / Re: Collision on Diagonal Line on: 2003-07-20 02:09:09
I'll have to use the second method becuase I can't use Graphics 2D for this (Java 1.1).

It's been a long time since my high school geometry.  
How do I calculate every point on the line again?  (y=mx+b or such?)

Thanks,

Drew

19  Java Game APIs & Engines / Java 2D / Collision on Diagonal Line on: 2003-07-19 23:54:24
I want to detect the collision of a sprite with points along a diagonal line.

Can anyone give me an idea of how to best do this?

The diagonal line runs from point (0,100) to (100,0)

The sprite moves randomly and could hit any point along this line.

Thanks,

Drew

20  Java Game APIs & Engines / Java 2D / Re: Curve Ball on: 2003-06-27 21:37:32
Thanks!  

I actually got this to work even though I don't really understand the equation.  Smiley

I'm doing the calculation on the fly.  I wonder if it would be better for performance to map the entire path and store the x, y values in a table or something...

Actually, the performance is fine now, maybe it won't matter.

BTW, are there built in methods in Java to do the Bezier equation that I'm not aware of?

Drew
21  Java Game APIs & Engines / Java 2D / Curve Ball on: 2003-06-27 17:31:14
I hope this is an easy question.  Smiley

I want to animate a curve ball (as in baseball).

Is there a simple formula I can use for this?

For example, the ball starts at point 100,100 and moves to 100,0 with a nice curve toward 125,50.

Thanks,

Drew

22  Java Game APIs & Engines / Java 2D / 2D Game Frameworks? on: 2003-06-19 15:15:18
Is there a list of Java 2D Game Frameworks / API's anywhere?

Will there ever be an official Game API for J2SE?

Regards,

Drew

23  Java Game APIs & Engines / Java 2D / Re: Image Rotation in Java 1.1 Games on: 2003-05-30 12:10:08
I see, except that I'm using Java 1.1 and there is no Buffered Image or Graphics 2D, etc.

Can I still use this technique with Java 1.1?

Drew
24  Java Game APIs & Engines / Java 2D / Re: Image Rotation in Java 1.1 Games on: 2003-05-30 02:30:34
Quote
It depends what you are doing as to whether it is feasable to pre-calculate the rotations.


Well, let's say it's a spaceship image/sprite that I want to control with arrow keys (ala Asteroids, etc.)

It seems like a major hassle to create all of those pre rotated images, but is that the way it's usually done?

Is there any software to automate this task?

Drew

25  Java Game APIs & Engines / Java 2D / Image Rotation in Java 1.1 Games on: 2003-05-29 22:56:27
Is it generally better for performance to try and rotate an image "on the fly" using an equation, or to load in a series of pre-rotated images and display them as needed?

Which method is usually practiced with Java 1.1?

Thanks,

Drew

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 (26 views)
2014-07-29 18:09:19

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

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

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

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

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

Riven (44 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
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!