wood burning stoves 2.0*
The moose likes Game Development and the fly likes Questions on final polish Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Game Development
Bookmark "Questions on final polish" Watch "Questions on final polish" New topic
Author

Questions on final polish

Mich Robinson
Ranch Hand

Joined: Jun 28, 2009
Posts: 250
    
    1
I just write games for a laugh but I've been working on this game for some time now. I'm nearly finished but I just have a few questions and hopefully someone might be able to help:

  • Performance differences: I tried to make it so the game should adjust itself to work for any speed of PC but worryingly I saw it playing faster on a friends PC in a browser than on my PC. I even sometimes get differences on my own little netbook when running in a browser and in appletviewer. It should have a pretty steady 20 moves per second and display around 50 frames per second.
  • Sound sometimes dissappears or just some sounds (usually the fire sound) but I'm not doing anything wierd in my code. Sometimes it will try to play a quite a few effects in a short period but this shouldn't be an issue - should it? Can I clear the sound buffers and reload periodically?
  • Converting applet to an application - yes I have found loads of examples on the web and sadly they all confuse the hell out of me (I'm not really a java guy). It's just one class with one thread declared and the main bit is declared like this:
    public class AlienSwarm extends Applet implements Runnable {
  • Fullscreen: I'd also like to use fullscreen mode with a low resolution of 600 * 480. I haven't managed to test this biit yet but I can get all the demo's on the web working.
  • Exe: Finally I'd like to convert it to an exe and use an installer. Has anyone tried this? I know it's not quite in the spirit of Java etc but it would make it easier to run for folks that just want a full screen game to appear when they click an icon.


  • Sorry for so many questions

    mike


    Arcade : Alien Swarm
    Board : Chess - Checkers - Connect 4 - Othello
    Mike Peters
    Ranch Hand

    Joined: Oct 10, 2009
    Posts: 67

    Hey the game is cool, nice job! I didn't look into your questions, but at some times the game doesn't respond for a few seconds. It's still a cool game though.


    Mike Peters
    Mich Robinson
    Ranch Hand

    Joined: Jun 28, 2009
    Posts: 250
        
        1
    thanks for the feedback anyway. I'm aiming to put it in it's own dedicated arcade cabinet if I get these little issues sorted.
    Phil Freihofner
    Ranch Hand

    Joined: Sep 01, 2010
    Posts: 115
        
        1
    Nice! It played smoothly for me and there were no sound glitches I could discern. Have you put in some new improvements since the original post?

    How are you doing your main game loop? Is it initiated by a Timer with a repeating interval? (This is a method I'm experimenting with in my self-education game project.) Do you do time checks to see if a given loop is perhaps going too slow or too fast?

    Is each sound a separate thread? I made a wind chime with a variable number of chimes that would play through, (could be as many as 40 or 50 concurrently and still all be heard, individual files: 8 chimes of about 3 seconds each) and remember having to use jconsole.exe, I think it was, to check on all the thread handling. Was able to locate some bothersome memory leaks with that tool. I do remember experimenting with figuring out how much I could reuse and how much had to be reloaded anew, as some forms of reuse definitely created conflicts.

    Of the various Applet to Application explanations, this was the article that was my conceptual breakthrough:

    http://download.oracle.com/javase/tutorial/deployment/applet/developingApplet.html

    Maybe you've already seen it? Unfortunately, it's going from application to applet, not the reverse. But especially, do give the last section a good try "Benefits of Separating Core Functionality From the Final Deployment Mechanism". Maybe you haven't separated out the "CreateGUI" portion, and if you do so, you will be able to pop the init() stuff into a top level JFrame.

    About the .exe and installer, it sounds like you want to do something like Web Start? If you do make it into an application and package it as a JAR, I know at least with Eclipse, I can designate the class with the main() during the export to JAR, and clicking on the resulting JAR file will start the program. I have had success emailing .jars and people being able to click and run them. They download the attachment and click on it and it runs, both PC and Mac folks. There's undoubtably articles in the tutorials, in the deployment section that houses the Applet article above, about both making executable Jars and WebStart deployments.

    Sorry if I'm not much help. It's a fun game. I used to be a whiz at SpaceInvaders, so I have a fondness for this sort of thing.
    Mich Robinson
    Ranch Hand

    Joined: Jun 28, 2009
    Posts: 250
        
        1
    Thanks for the long reply - there's just one main thread doing the timing and moving things about and I just suggest when paint should do it's thing. I don't have a thread for sounds and perhaps I should - I'll think about the best approach. Currently the problem only appears when you get quite high scores 100k+ as there's more happening on screen and more sounds with different types of aliens etc. I don't think it's a memory leak but that's just a gut feeling.

    I'll have a read through the links and see what I cann gather - part of my issue with many of these articles is that my real java skills are quite poor (OO is more a hinderance than a benifit to me ). I wanted to avoid webstart and convert eventually to an installable exe just to make it a one click install - many folks I know don't have java installed.

    Glad you enjoyed the game though - (20k+ put's you on the high score list and top gun is currently around 200k - good luck).

    Mike
     
    It is sorta covered in the JavaRanch Style Guide.
     
    subject: Questions on final polish