How to boost Frame Per Second?

Ok I see all these games that get a good 30-60 fps. I have a game I created that is 2d with some .png images. I need to boost my fps from 16 to 30+ How would I go about this? This is how I have it set <Main Applet> -> <swing.timer(1ms)> -> Repaint() is that the only way to get good fps?

I actually made a game with several hundred fps, I had to slow it down though - it was ridiculous.
When you press the left key, the character would move 1 pixel per frame - and it looked like it was teleporting.
Try something like this (Note: wait is just a method I made that waits the provided amount of milliseconds):
long lastTime, nextTime;
public void capFrameRate(int time) {
  if(lastTime == 0) {
   wait(1000/time);
  else {
   nextTime = System.currentTimeMillis()-lastTime;
   if(nextTime < 1000/time) {
    wait(1000/time);
  lastTime = System.currentTimeMillis();
}It may also be because you are using png images, png usually are larger in size than jpeg (and gif, I think).
Note: it is always a good idea to load the images prior to gameplay or it will halt until the image loads.
EX: If you made a game where if you get hit by a laser, you'd blow up - the game would halt while loading the explosion for the first time.
Edited by: b1nary on Nov 10, 2009 8:41 AM

Similar Messages

  • How to find the frames-per-second of a Quicktime movie using Applescript?

    Is there a way to find out the real-time "frames per second" of a Quicktime movie?
    The only Applescript movie properties in Quicktime which I have found to be useful are "duration" and "time scale". The real-time duration of the movie in seconds is found by dividing "duration" by "time scale".
    But "time scale" only sometimes relates to any real time property. In some cases it does (2500 = PAL 25 fps, 2997 = NTSC 29.97 fps) but for many other movie types I've opened (DivX, flv, mp4 etc) the "time scale" is often reported as "600" even though the Quicktime movie inspector window will report a frame rate of 25, 29.97, 15 or some other number.
    Where does the Quicktime movie inspector window extract the FPS from, and is it possible to extract that same number, or calculate the real-time FPS of a Quicktime movie using Applescript only?
    Thanks.

    Thanks for this but unfortunately it only works for some movie types. For .dv .flv and .divx movies, this script correctly calculates the FPS. But for .mpg .mp4 and .m4v it does not.
    For .mpg movies I tested, the count of frames was always 1, so clearly the FPS calculation is always wrong.
    For the .mp4 and .m4v movies I tried, the FPS was always reported as 43, regardless of whether the actual FPS was 25 or 29.97. In all cases the count of frames was incorrect.
    A bug in Quicktime?

  • Calculating Frames Per Second Accurately

    I tried searching the forums for suggestions or code used to calculate FPS accurately... But was ultimately unsuccessful.
    I think I have a pretty basic understanding of how it works... but I'm still left wondering if there's a better... or correct way of attacking the problem.
    What I started out doing is taken a pre-cycle time sample using System's currentTimeMillis method, followed by the main parts I'm executing in my program and then took a second time sample. I subtracted the post-cycle from the pre-cycle to get the time... and it occurred to me that the currentTimeMillis is not exactly reliable. As it says in the API, "For example, many operating systems measure time in units of tens of milliseconds," when discussing that method.
    I then noticed the nanoTime method and decided to use that.
    It quite honestly seems to work perfectly for what I'm trying to accomplish.
    I pretty much used the same steps as before.
    But now my problem is that I want to limit the amount of frames per second to 60.
    I decided that I should try using the Thread class's sleep(long millis, int nanos) method.
    It seemed like it would work... but to my dismay, it did not.
    The milliseconds, for the most part, were correctly timed... but still not always. The nanoseconds even less so... but I knew that the nanoseconds would be less reliable-I decided to use microseconds. Using microseconds doesn't even work that well.
    So I wondered if there was an even better way... maybe a more 'manual' approach to fixing my problem.
    I would greatly appreciate any input/knowledge on the matter.

    its quite simple. Windows has an API call that can set the timer precision (its all based on some interrupt interval - I forgot the precise details). This precision is system wide, so if one application does it it is immediately active for all other applications running at that time. Applications can only lower it, so if you set it to 1ms then some other application cannot force it to 5ms for example.
    Now here comes JVM bug number two.
    As said the interval differs per system - sometimes it is 10ms, sometimes it is 15ms. The JVM wrongfully assumes it is always 10ms however. Do a test: try to sleep for some time that is a multiple of 10 (without the long running thread hack active); you'll find that the precision still sucks. That is because in this specific case the JVM does NOT change the system wide timing precision. But if you sleep for any number of milliseconds that is not a multiple of 10 it will actually temporarily set the precision to 1ms.
    So the rule is: as long as one thread goes to sleep the precision is set to 1ms. When the last sleeping thread wakes up, it is reset to what it was. Then it also doesn't matter for what amount of time you make your real thread sleep as the long sleeping thread will not be sleeping for an amount that is a multiple of 10, thus forcing the precision to 1ms.
    Now say that you don't do the long sleeping thread hack and you make your own thread sleep for say 9ms, switching to 1ms precision temporarily. This behavior makes it so that sampling the passed time (before and after sleeping) can be imprecise; you'll find that most of the time you'll get sampling that matches the number of milliseconds you slept and sometimes it jumps to 10/15ms depending on the granularity of your system. This is a concurrency problem; sometimes the precision is reset before you get a chance to sample the current time.
    So to recap to give 100% accuracy with System.currentTimeInMillis(), you need to keep a thread sleeping at all time so the precision stays at 1ms.
    And then finally we come to bug #3, which is a problem in Windows itself: rapidly changing the precision (which happens when you make a single thread sleep for short intervals) can screw with the system clock. I don't know if this problem still exists in later iterations of Windows, but it is again a reason to do the long sleeping thread hack. Because this is a known issue I still call this a bug in the JVM because of the way they implemented the precision timer activation, which can trigger the problem in Windows. The command line switch mentioned in the above bug report SHOULD have fixed that... but you know, facepalm bug #4.
    But at the end of the day: even if at least 4 bugs can be named regarding precise timing in Java under Windows, the root of all evil is still the way timing is implemented in Windows itself making life too difficult for the poor JVM devs. What were the MS devs thinking at the time?

  • What is the most Frames Per Second NI-CAN can do?

    My goal is to send 1000 Frames per Second on my CAN bus using the NI-CAN PCI 2 slot card I have.  However the closest I have been able to do is 666 frames per second.  This is sending 8 frames every 12 MS using an edited readmult example.  Is there a way to do this with writemult?  Or is there a hardware limit that I am trying to go past?
    What can I mess with to get more frames?  Increase Baudrate?  Decrease the size of the frames?  (I've tried both of those)
    Other questions that should probably go in other posts  (Frame API):
    Is there a way to send/read the frames at the bit-level?  I have found ways to manipulate Arbitration ID, Remote Frame, Data Length, and Data, but there are several other bits in a frame.
    Is there a way to send a bad frame, one that would raise/cause an error frame?

    Yes, I did break 1,000 Frames Per Second.  I got up to 1,714 and 1,742 using two different methods.  This is at 250 kbps, if you used 500 or 1 Mbps, you could get more frames.  If you have 125 kbps, you might not be able to break 1,000 Frames per Second.
    ncWriteMult is the key.  You can load 512 frames in a queue at a time.  I would put 256 on at a time and check to see if there was less than 256 frames left in the queue and if there was, load it up, that way the queue would never be empty.  I went about it 2 ways, one was using ncGetAttribute to determine space left, and that got the faster method, however, I was also trying to read the messages to verify that it worked, and I had problems with logging every frame.  It would also send the first 40 ncWriteMults quickly, as if the queue it was filling was much larger than 512.
    The other way, was using trial and error to determine how many MS to sleep before writing the next batch of 256 frames.  There are variables outside of my control that determined the time it would take and it would vary a few ms.  I wanted a stable environment that could send forever without filling the queue so I went with a value that would wait 2 or 3 ms, depending on conditions before writing again.  The value I used was 142 ms, I think.  Your Mileage May Vary.
    There is also a way to do some error handling that I did not try to utilize.  Instead of the process crashing, there is a way to tell it to wait if this error is returned.  That might be the best way for me to implement what I wanted to do, but I was assigned another task before I tried to get that to work.
    There is a timing element in ncWriteMult's documentation I didn't look into very much, but that would space the frames out and could send 1,000 frames a second evenly distributed, instead of sending them as quickly as possible, wait some ms then send another batch.
    If anyone could link us, or provide some code snippets of the error handling, or proper usage of ncGetAttribue, or some way to read faster, that would be greatly appreciated.

  • FMR with 30 Frames per Second (Captivate 5.5 Win)

    Hi everybody,
    I am creating an online YouTube video for a presentation of our product. I am not very sure how to setup the FMR to capture in 30 frames per second. If it is possible where can I configure these settings?
    thank you a lot
    Rado

    Welcome to our community
    FMR isn't the best way to capture, but if that's your goal...
    30 FPS is the default setting in Captivate unless you have told it otherwise. If you want to double-check, click Edit > Preferences > Project > Publish Settings.
    Cheers... Rick
    Helpful and Handy Links
    Captivate Wish Form/Bug Reporting Form
    Adobe Certified Captivate Training
    SorcerStone Blog
    Captivate eBooks

  • GT660 - my Frames Per Second on Gaming

    So I got this MSi GT660 with this Intel Core i7-740QM
    with NVIDIA Geforce GTX 285M 1 GB DDR3 , that 16" HD screen
    RAM with 6 GB  DDR III ....1.7ghz , 3.0ghz on turbo mode
    Hi, I play Counter Strike Source, now I get around 12-16 frames per second when there is a lot of bots or gamers in one , whole lot of action going on (like 8 gamers shooting in one place). It gets the same results of FPS on my 17" 2006 HP model.
    And I get around 40-70 frames per second when I'm roaming alone in a map.
    and 140 frames per second when theres nothing going on.
    I get this low FPS on a turbo mode. Even though Im using "GameBooster" which temporarily disables unnecessary services. ( http://www.iobit.com/gamebooster.html )
    Im looking for ways to boost my FPS in my game. Please help, I bought my notebook from FrostyComputers. They're great but Im not satisfied.
    If you can help me, that will be great. If I'm not providing much information for you to help me, please let me know. Thank you 

    Thanks guys
    There is one time when I backed up my game ( Counter Strike Source ) and burned them into CD.
    Thankfully I did because my laptop crashed when I messed up something and reboot the whole system like new again.
    And my internet is slow, but I only play locally.
    So I re-installed my game using my back up CD. Maybe this is the reason why it so slow in its FPS.
    Also, I found this link ( http://windows7themes.net/speed-up-windows-7.html )
    useful, I could get my notebook to run on Adjust to Performance mode. Plus it takes off the Aero Windows Explorer, I think.
    I was also pondering on the idea about going back to Windows XP just for the gaming, but I like to keep updated to the newest updates.
    I might delete my local game files and re-download Counter Strike Source sometime.
    I think this back up CD caused my FPS go down than normal.
    I appreciate your help. Thanks

  • Feature request: Frames Per Second info for clips / Warning when exporting

    I know that this may not be the right place to post, but I think many of us users would agree that this feature would be useful in iMovie. Especially for new users who are not even familiar with terms like "frame rate".
    Let's assume you import a video from your digital camera. You are not an expert in this field, so you edit the video in iMovie. Then you export it using QuickTime. The final video is jerky... and this can be due to incorrect frame rate settings.
    It would be nice if iMovie provided some warning if you are trying to import video at a different frame rate setting than your original video source. Just a pop-up saying "Your video was recorded 29.97 frames per second (FPS) and you are trying to export it into 25 FPS. This can cause some playback issues."
    Maybe even suggest the correct frame rate setting for the export. Apple's software is always trying to make things easier. I think regular users do not even know about "frame rates", so it might be a good idea to warn them.
    Also, how can you tell what FPS are your sources in iMovie? There is no way to tell what FPS was the clip recorded in. To find out, you have to go back into iPhoto, then drag the clip into QuickTime and only there you can select "Get Info" and find the recorded FPS for the specific clip.
    This seems like a lot of trouble to go through, just to find out a very basic information about the clip.
    I would like to see some functionality like this added to iMovie. I think many of us users would welcome this feature.
    What do you guys think?

    Click iMovie/Provide Feedback. That will send your enhancement request to the developers.

  • Exporting as AVI 720x576 @ 25 frames per second

    Hi, I would be grateful if someone could tell me how to export an iMovie 9 project as an AVI 720x576 @ 25 frames per second in the PAL format. When I click on the export as button I have a number of options but not this one. This is to be submitted to a TV station and they say that it must be in this format.
    Thanks for any help that may be offered.

    It can be done using the Share menu item in iMovie '09, but the AVI option doesn't appear to offer a size setting (as in 720 x 576). Follow these steps to at least get an AVI movie:
    Share>Export using QuickTime>Movie to AVI>Options>Video-Settings>Frames per second: 25
    I haven't tried this export method myself, so can't verify that it works - but at least it is a starting point.
    John

  • Frames per second vs timecode

    Small question
    How do I get the frames per second indicator at lower left of canvas to show timecode instead?
    I have looked all over for what is probably staring me in the face.
    cc

    Preferences > Project > Display Time As, change it to "Timecode". Or, just click on the little stopwatch to the left of either the current time, or the duration.

  • Final Cut Pro X Image Sequence Export missing frames per second option?

    I am using the trial version of Final Cut Pro X.  I can export an image sequence but it will only allow me to do so at 30 frames per second -every single frame! 
    So a 10 min movie takes half an hour to export 20,000+ frames that no one on earth has time to look thru.
    In my old Final Cut Express I was able to choose 1 or 2 frames per second, which was just right.
    What am I missing?
    Do I need to buy Quicktime Pro or Compressor to allow me to export image sequences without exporting every frame?
    Why would Apple even have an image sequence export if it only allows you to export every frame, or it that only in the trial version?
    Thank you

    I found a free option for you, if you don't already have Compressor 4.
    In FCPX create your movie. Then SHARE as a Master File.
    Get MPEG Streamclip, which is a free app available here.
    http://www.squared5.com/svideo/mpeg-streamclip-mac.html
    Drag your Master File into MPEG Streamclip.
    In MPEG Streamclip, select FILE/EXPORT TO OTHER FORMATS.
    In FORMAT: choose IMAGE SEQUENCE
    In OPTIONS, choose your frame rate.

  • Frames per second help

    I have added videos to final cut pro with a decent frame per second rate but on the canvas it shows really slow frame per second, like 5 frames per second instead of 30. However when I watch the video on the viewer it shows my normal video. The audio is completely fine though. Everything is rendered.

    This forum discusses FCP X,  Final Cut Pro Ten.
    Try the forum for FCP 7 :
    Final Cut Studio
    Al

  • Why does my iChat video only run at one frame per second?

    When I connect to anyone on iChat my video runs at only about one frame per second. When others connect to me their video is much faster. This hasn't been a problem in the past - even with other Internet apps running when I'm using iChat. Could this be a problem with my ISP? Is there something I should do?

    Hi Gary45,
    In AIM 5.9 the PC can set the Video quality rate.
    Start a chat.
    The PC end clicks on the rear tab of the Video chat.
    This brings their own preview to the front.
    To the right there is anow a small iCon.
    Click on this.
    This brings up a slider.
    Slide the slider to the Left.
    If this is done to an iChat Buddy and they have the Connection Doctor open from the Video menu, they will see the Bit rate and Framerate go up. The consequence is that as the video Quality goes down the data that makes up the pic goes down allowing for better refresh rates and a smoother video.
    Do you mean this only happens between you and him and not between him and his son ?
    Or do you mean it happens between you and him and not his son and you ?
    If it is happening between you and other people aslo check out this FAQ http://discussions.apple.com/thread.jspa?threadID=278760
    9:19 PM Tuesday; July 25, 2006

  • Video chats get only 1 frame per second on my friend's macbook.

    Hi.
    My friend has a macbook, and whenever she video chats anyone, the video will only change 1 frame per second after 10 seconds in the video chat. Like the first 10 seconds, she`ll get 30fps but then after 10 - 15 seconds, it'll go down to 1 fps. It's not just with me either, its with all people I know its not her connection because her video isn't blurry at all, its crystal clear, but theres just the 1 frame per second. Her photobooth works fine and all, however. IT's a brand new macbook, fresh from apple.

    Tell us every single add-On for iChat and the computer as a whole you have please.
    Spirited Away causes the App in Use's Icon to be displayed as your Buddy Pic.
    Lotus Notes can cause the slow down you are seeing.
    So Can not Updating iChatUSBCAm when you upgrade to Leopard.
    There are others
    like Folding@hoem
    Seti Screen Saver
    Bionic (Maybe spelt Bionix)
    9:52 PM Sunday; February 24, 2008

  • Very Poor Frames Per Second on MSI 661FM2-LSR

    Ok this new motherboard that i purchased has a onboard graphics SIS 661fx now my old motherboard the MSI ProSavageDDR P4M266A has also an onboard chip however it allowed me to play HL2 with 32mb of shared memory off my 512MB ram the graphics werent to good but i could play fine 
    Then i had a 5200fx which was a major improvement however when the old board blew that blew aswell
    Now i have got this new board and tried playing half life 2 and it has 3-15 frames per second (which makes the game sluggish as heck) but on half life 1 it has 71+ frames per second
    i know onboard isnt that good but it should at least let me play my games
    My old motherboard link (that allowed me to play half life 2) >> http://msicomputer.co.uk/Products.aspx?product_id=703551&cat_id=77
    My new motherboard link (wont allow me to play half life 2 to a decent standard) >> http://msicomputer.co.uk/Products.aspx?product_id=703553&cat_id=77
    Can anyone please help 
    Thanks 

    One thing to keep in mind is MSI doesn't make the chipset that your board uses. That is done by SIS. If the performance is lower then what you expected then it can only be attributed to SIS.
    The best thing for any gamer, especially one who wants to play Half-Life 2 is to get an AGP graphics card. The performance jump is huge. Then the higher the quality of the graphics card the higher the performance of the game. Then you can start getting the eye-candy that makes Half-Life 2 so worth playing. As far as not purchasing MSI, that is fine. None of us get a commision or any benefits from you purchasing MSI. I personally got a built by ATI 9800 Pro (which I absolutely love). One thing to keep in mind though is ATI doesn't have any better support than MSI and I have yet to find an ATI forum. Sure there are plenty of forums out there but none are ATI specific, which I really wish existed.
    I think we all understand your frustrations as computer problems are what brought most of us here in the first place. Just remember, we have no way of knowing what is going on with the MSI Support department. All we do is try to help out users who have run into problems and don't want to go through the hassle of going through tech support. Don't see this as me flaming you. I am merely trying to open your eyes to the reason Danny did what he did. None of us like to see the products we support day in and out (free none the less), get bad mouthed by users who are having issues.
    Good Luck
    Jeremy

  • Trying to find a camcorder that records in 60 frames per second and will upload onto  ipad2 through camera connector

    Trying to find a camcorder that records in 60 frames per second and will upload onto  ipad2 through camera connector

    Old forum discussion, message now gone, but here's the summary
    Matt with Grass Valley Canopus in their tech support department stated that the model 110 will suffice for most hobbyist. If a person has a lot of tapes that were played often the tape stretches and the magnetic coding diminishes. If your goal is to encode tapes in good shape buy the 110, if you will be encoding old tapes of poor quality buy the model 300
    Both the 110 and 300 are two way devices so you may output back to tape... if you don't need that, look at the model 55
    http://www.grassvalley.com/products/advc55 One Way Only to Computer
    http://www.grassvalley.com/products/advc110 for good tapes, or
    http://www.grassvalley.com/products/advc300 better with OLD tapes
    Or
    ADS Pyro http://www.adstechnologies.com

Maybe you are looking for

  • BI report for PP

    Hello BI Gurus, I have following report requirement in BW for PP area. Following are my KPI's required in report.  Can anyone throw some light on which of these would be from standard data sources and std Cubes required.. I understand that this infor

  • Question about the rescheduling of a Sales Order and its Production Order

    Hello Everybody, I experience something strange with the rescheduling of a Sales Order and its corresponding Production Order. It will be easier to explain with an example... For a material, I have created a Sales Order. And from this Sales Order, I

  • Lights do not appear in 3d scene until I render.

    I cannot get any lights to appear in my 3d scenes until I begin rendering. I have installed all updates. In fact, this started when I installed the Creative Cloud update back in December. Also, how do I get rid of the annoying IBL preset? Thanks

  • Audio files are missing in iMovie HD 6

    I have 10.5 installed and was using iMovie 08. I was having problems exporting a movie, some of the clips were all black. So I downloaded iMovie 06 and all the iLife audio files are missing. They're still there in '08 but not '06. How do I get them i

  • PI System Support Pack Upgraded from 04 to 07

    Hi Guys, In PI system basis people upgraded support pack 04 to 07. how i will check the PI system functionality after upgrading support package 04 to 07... first basis people upgrated in PI Development system. after they will do in PI Quality and PI