Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (754)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (842)
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-11 23:21:14
errr, multiply each coord by 2 Huh

Argh...You're right.  Cheesy

Sorry, it's been a long day.

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

....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


3  Java Game APIs & Engines / J2ME / Resize Image on: 2004-06-06 12: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?



4  Java Game APIs & Engines / Java 2D / Re: Scale Image in Byte Array on: 2004-01-16 12: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.


5  Java Game APIs & Engines / Java 2D / Scale Image in Byte Array on: 2004-01-16 02: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



6  Game Development / Performance Tuning / Re: Expanding Heap on: 2003-12-19 01: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?

7  Game Development / Performance Tuning / Expanding Heap on: 2003-12-18 13: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?



8  Game Development / Performance Tuning / Re: Repainting Two Areas on: 2003-08-15 15: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?

9  Java Game APIs & Engines / Java 2D / Dirty Rectangles on: 2003-08-15 13: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


10  Game Development / Performance Tuning / Repainting Two Areas on: 2003-08-15 13: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?


11  Game Development / Performance Tuning / Re: Little Pauses on: 2003-08-07 18:15:01

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


12  Game Development / Performance Tuning / Re: Little Pauses on: 2003-08-07 15: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.

13  Game Development / Performance Tuning / Little Pauses on: 2003-08-07 14: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.



14  Java Game APIs & Engines / Java 2D / Alpha Filter on: 2003-08-05 14: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?


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

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.



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 15:18:40
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...


17  Java Game APIs & Engines / Java 2D / Re: Collision on Diagonal Line on: 2003-07-20 15: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.


18  Java Game APIs & Engines / Java 2D / Re: Collision on Diagonal Line on: 2003-07-20 00: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?)



19  Java Game APIs & Engines / Java 2D / Collision on Diagonal Line on: 2003-07-19 21: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.



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

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?

21  Java Game APIs & Engines / Java 2D / Curve Ball on: 2003-06-27 15: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.



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

Will there ever be an official Game API for J2SE?



23  Java Game APIs & Engines / Java 2D / Re: Image Rotation in Java 1.1 Games on: 2003-05-30 10: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?

24  Java Game APIs & Engines / Java 2D / Re: Image Rotation in Java 1.1 Games on: 2003-05-30 00:30:34
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?


25  Java Game APIs & Engines / Java 2D / Image Rotation in Java 1.1 Games on: 2003-05-29 20: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?



Pages: [1]
DesertCoockie (33 views)
2018-05-13 18:23:11

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

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

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

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

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

Solater (98 views)
2018-03-17 05:04:08

nelsongames (179 views)
2018-03-05 17:56:34

Gornova (405 views)
2018-03-02 22:15:33

buddyBro (1065 views)
2018-02-28 16:59:18
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!