Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (753)
Games in Android Showcase (228)
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: Image capacities on: 2005-01-07 20:48:10
Well for one thing, AffineTransforms aren't THAT slow.  I use them and they work well for me even for large numbers of objects.  Also, what about just having each weapon rendered at different angles of a swing?  It's no problem to position them if you already have the right angle you need.

What type of game is this?  Is this a Street Fighter type game?  If so, you could just pre-render your different frames for the two characters.  56 animations for characters, 56 animations for their item at the moment, maybe much less if you can reuse some, and then 2 characters.  That's 204 images at the most.  Not nearly so bad...

You could also go 3D have 1 model for the character, 1 model for the item, then have scripted movement sequences Wink

Well, going 3d is a pain in the ass, so I'll leave that to the cool people.

I haven't gotten to adding the item locations to all of the sequences, but when I do, I will try using AffineTransform to position the items in realtime before I go the caching route.

Right now my game can handle a ton of players on the screen and on the server at the same time, so I have a lot of CPU to play with.

I was having major CPU issues with AfifneTransform, but now that I look back on it, I think it has to do with drawing the image in reverse.  When I was facing right (the way the image is originally designed), my FPS was fine, even as I zoomed in and stuff.  When I changed direction, my FPS dropped.

I tested this, and it's true.  Try drawing something with a negative width and/or height.  It will be painfully slow (compared to drawing the same image with a positive width and height).  So, I think as long as I have 4 images for each item (one for a negative width, one for a negative height, one for both negative, and the original), so I'm always transforming to a positive width & height, I should be ok.

I'll let you know how it goes.
2  Java Game APIs & Engines / Java 2D / Image capacities on: 2005-01-07 18:51:41
Hey all, I had a question:

OK, right now, I have an image for every frame of animation.  There are 56 total frames of animation (including all the poses, etc) for each type of player.  At the moment there is only one type of player, but there will be more.  This brings the image total to 56.

I want to display items that are equipped on a player.  So, if he picks up a sword, I want it to go in his hand.  Now, I have an image for the item, and I have a SpriteManager program which lets me set the orientation and position of any item for any frame of animation.  The idea is that I can just have one drawing of the item, and it will handle everything else (hopefully).

Here's the dilemma:  If I use AffineTransform to position the item, I pay a huge CPU cost (for some reason, affinetransforms are slow as dirt).  Instead, I was thinking of making a separate image for every item type for every player type for every animation frame.  The problem is that if there are 10 types of items and 10 types of avatars, each with 56 animations, that's 5,600 images!

Each image is 128x128, and uses bitmask transparency.  Much of the item images will be empty space.

Any suggestions?
3  Game Development / Networking & Multiplayer / Re: java event repainting on: 2004-12-30 03:51:14
Just to be clear, I am not saying that you should launch your entire game in a new thread. That would most likely cause a few issues at the OS level. Rather, I am suggesting that just the loading part happens in the new thread. e.g.:

public class Loader implements Runnable
    private Game game;
    private String[] images = {"Image1.png", "Image2.png"}
    private boolean done = false;

    public Loader(Game game)
    { = game;

    public void run()
        for(int i=0; i<images.length; i++)
            //load image

         done = true;

    public boolean isDone() {return done;}

public class Game implements ActionListener
    private Loader loader = new Loader(this);

    public void actionPerformed(ActionEvent evt)
        Thread thread = new Thread(loader);

    public static void main(String[] args)
        Game game = new Game();
        //set up some GUI stuff
            try{Thread.sleep(100);}catch(Exception e) {}

        //Do Game Loop

The important thing is to not let go of the initial thread used to construct your game. That way you can keep things simple, and make sure that you don't run into any nasty surprises. At the same time, you also make sure that you don't block the event thread. :-)


That poses a problem because right now, the event actually creates the game object.  the thing is, the applet is a login screen, and based on the username/password, you can potenitally get a different game (wheter you log in as a level builder or a player), so I'm making a new game in the event thread.  I'll have to somehow rework it so the event thread doesn't make the game, which is going to be difficult.
4  Game Development / Networking & Multiplayer / Re: java event repainting on: 2004-12-29 19:27:22
This is a well known issue. The problem is that the paint thread and event thread are one and the same. If you lock the event thread (e.g. doing network loading on ActionEvent), then nothing can get painted.

The solution is to spawn a new Thread from your actionPerformed() clause. This will unblock the event thread and allow the screen to repaint.

I tried that, and when I did, my fps in my game dropped from 200 to 8-10.  I think it might have something to do with a thread being inside a thread which has finished, but I'm not sure.  I was hoping there was another solution =/.
5  Game Development / Networking & Multiplayer / java event repainting on: 2004-12-29 17:06:15
Sorry for such a newb question, but...

I have a button event that starts my game.  The problem is that there are a LOT of graphcis and stuff to download.  I made it so I use the setText() of a textarea to show the graphic file names so taht the user doesn't think the game has hung.  The problem is that the text isn't getting set because I guess it needs to be in a separate thread or something.  Even when I call repaint after setText(..), it still doesn't update.  What should I do?
6  Java Game APIs & Engines / Java 2D / VolatileImage vs. BufferedImage on: 2004-12-29 14:24:00
hey guys, another question.

I know that VolatileImages in 1.5 support transparency, but I read somewhere that only the opaque transparency is hardware accelerated.  Because of this, any images taht I need bitmask transparency for are being rendered to BufferedImages using the getCompatibleImage().

If I change all of these BufferedImages to VoaltileImages with BITMASK transparency, will I get any boost in performance?  Will I lose performance?
7  Java Game APIs & Engines / Java Sound & OpenAL / Re: Help with sound on: 2004-12-26 00:12:18

Ok. deep breath here:

1. Right click on the project folder
2. Select "Properties"
3. Click on "Java Build Path"
4. Click on "Libraries" tab
5. Click "Add External JARs..."
6. Select "sound.jar" and click OK a few times

You're done. :-)


I haven't used the JAR et, I just put your code into my project, but I'm gonna change it to the jar later.  Your sounds thing works awesome!

You can check it out in the game at

Thanks, bro
8  Java Game APIs & Engines / Java Sound & OpenAL / Re: Help with sound on: 2004-12-23 20:56:59

WaveEngine wave = new WaveEngine()
int sound;

sound = wave.load(getClass().getResource("/mysound.wav"));;

while(true) { wave.render();}

MusicEngine music = new MusicEngine()
int sound;

sound = muic.load(getClass().getResource("/mysound.mid"));;

while(music.isPlaying()) { Thread.yield();}

I seriously doubt you'll find anything simpler. :-/

I'm a JAR newbie, how do I add your jar to my project so that I can use your classes and put sound in my game?

If it makes a difference, I'm using Eclipse as my editor.

Thanks for your help =)
9  Games Center / Archived Projects / Re: Twin Serpents - a multiplayer Double Dragon ga on: 2004-12-23 15:00:49
What web browser are you using?  Maybe it's not reading the codebase property.  Also, it could be because you don't have the latest java VM (1.5.0).

Let me know what browser you are using and I will try it on that browser.  As of now I have only been using firefox and IE
10  Games Center / Archived Projects / Re: Twin Serpents - a multiplayer Double Dragon ga on: 2004-12-22 18:46:02
Yeah, I saw that.

You ended up logging in just as I was updating the game files, sorry about that.
11  Games Center / Archived Projects / Re: Twin Serpents - a multiplayer Double Dragon ga on: 2004-12-22 00:23:00
thanks, I am a PhD student, so it's going to progress kinda slow when class starts, but I plan on keeping active on it as long as I can.
12  Game Development / Networking & Multiplayer / Re: Synchronization between clients/server on: 2004-12-22 00:09:39
awesome, thanks a bunch!!
13  Java Game APIs & Engines / Java 2D / Filling an Image on: 2004-12-21 20:35:30
I have an image with index transparency.

The image renders fine and everything.  The problem is that I want to draw the image's "shadow".  Right now, I'm shearing it with a composite and using the Xor AlphaComposite because it seems to work and give me a black shadow.  I want to have a grey-black shadow, instead of a solid black shadow, but when I try to give the Xor composite a 2nd parameter, nothing gets drawn.

Any recommendations here?  Should I just break down and make the shadows myself?
14  Games Center / Archived Projects / Re: Twin Serpents - a multiplayer Double Dragon ga on: 2004-12-21 20:09:45
The number is the frame rate.

I don't really know much about network programming, and the lag reflects that  Grin

I'm working on it, though.

Thanks for playing =)
15  Game Development / Networking & Multiplayer / Synchronization between clients/server on: 2004-12-21 19:49:17
Hey Guys, I need some help.

OK, basically, my update/sync code looks like this:

//This gets run every 33 ms.
public void run() {
     frame = (frame + 1) % 600;
     if (frame % 60 == 0) {
           frameCount = "" + (framesPerUpdate / 2);
           framesPerUpdate = 0;

     if (frame % 4 == 0) {
           try {
                 if (owner instanceof JApplet)
           } catch (IOException ie) {
                 System.out.println("Connection closed!");
     if (avatarSelected != null)
           currentMap.updateVelocity(keyState, avatarSelected); //for caching

so every 99 ms, I ask the server for an update.  When the server gets a request for an update, it sends all of the locations, states, and extra avatar information to the client.  Right now it sends about 100 bytes per avatar, which is obviously ridiculus, but I can use dirty bits and stuff to fix that.

The problem is this:  When the user htis a key, say "go right", the client instantly starts going right.  The server has to wait for the command, then starts going right.  Then when the server updates the client, the movement that the client did before the server knew that the player was moving gets taken away.

The end result is this jerkiness when you start to move or do an action.

I could try to emulate the server latency in the client somehow by adding delays or something, but that would be kinda tough.

I could also let the server handle all of the state changes,but that might have some weird consequences.

I figured that everyone who does network programming must have the same problem.  What do the experts do to fix this situation?
16  Games Center / Archived Projects / Twin Serpents - a multiplayer Double Dragon game on: 2004-12-21 19:10:37
This game is basically going to be a multiplayer fight-em-up similar to double dragon and river city ransom.  Currently, most of the framework has been set up.  I'm struggling with some graphics issues and some bad network programming on my part that I hope to remedy, but I hope it will soon turn into a really fun game where you can log on and beat up some thugs with your friends.

*NOTE* Sometimes, the applet likes to go really slow (3-4 fps), when this happens, just scroll to the right and then scroll back, and that usually fixes it.  I'm still trying to figure out why that is happening.

*NOTE* The network code for the applet is even worse than the standalone code, because applets can't bind to a local udp port, so I had to use tcp.  When the game becomes more playable, I'll release the standalone client, which uses UDP for updating.

Here's a link:

Directions:  Click the log in button to log in, and then wait while the graphics are loading (might take awhile).

wsad keys moves your character around.  j jumps, k kicks, and l punches.  you can use k to jumpkick if you are in midair.
Pages: [1]
nelsongames (19 views)
2018-04-24 18:15:36

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

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

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

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

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

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

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

buddyBro (747 views)
2018-02-28 16:59:18

buddyBro (94 views)
2018-02-28 16:45:17
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!