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

http://ucfpawn.homelinux.com/java/twinserpents/client/GameApplet.html
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
Quote
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.:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
public class Loader implements Runnable
{
    private Game game;
    private String[] images = {"Image1.png", "Image2.png"}
    private boolean done = false;

    public Loader(Game game)
    {
        this.game = game;
    }

    public void run()
    {
        for(int i=0; i<images.length; i++)
        {
            //load image
            game.loaded(images[i]);
        }

         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);
        thread.start();
    }

    public static void main(String[] args)
    {
        Game game = new Game();
        //set up some GUI stuff
        while(!game.loader().isDone())
        {
            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. :-)


hmm

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


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


Awesome!

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 http://ucfpawn.homelinux.com/java/twinserpents/client/GameApplet.html

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

Sound:
1  
2  
3  
4  
5  
6  
7  
WaveEngine wave = new WaveEngine()
int sound;

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

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


Music:
1  
2  
3  
4  
5  
6  
7  
MusicEngine music = new MusicEngine()
int sound;

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

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)
                       dout.writeByte(UPDATE_CLIENT_TCP);
                 else
                       dout.writeByte(UPDATE_CLIENT);
           } catch (IOException ie) {
                 System.out.println("Connection closed!");
                 System.exit(1);
           }
     }
     if (avatarSelected != null)
           currentMap.updateVelocity(keyState, avatarSelected); //for caching
     currentMap.update(Theme.UPDATE_FREQUENCY);
}


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:
http://ucfpawn.homelinux.com/java/twinserpents/client/GameApplet.html

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]
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

trollwarrior1 (29 views)
2014-11-22 12:13:56

xFryIx (71 views)
2014-11-13 12:34:49

digdugdiggy (50 views)
2014-11-12 21:11:50

digdugdiggy (44 views)
2014-11-12 21:10:15

digdugdiggy (38 views)
2014-11-12 21:09:33

kovacsa (62 views)
2014-11-07 19:57:14

TehJavaDev (67 views)
2014-11-03 22:04:50

BurntPizza (65 views)
2014-11-03 18:54:52

moogie (80 views)
2014-11-03 06:22:04

CopyableCougar4 (80 views)
2014-11-01 23:36:41
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!