How to set a consistent Framerate

Hi, I'm making a top view racing game and I need to set the framerate to 30fps. I have tried the method in this game: http://homepage.ntlworld.com/pars/pacman/pac.zip
Although I am successfully in getting a consistent 30fps, my game stalls for a very brief moment every second because of the autocorrection. Is there a better method that I can get a smooth game with 30fps?

This is perhaps the easiest method...
while (true) {
doFrameLogic();
renderFrame();
/**sleep the thread if we are going above 50 frames per second*/
         try {
              if (System.currentTimeMillis() - lastFrameTime < 20) {
                Thread.sleep(20
                                - (System.currentTimeMillis() - lastFrameTime));
                  fps = 50;
              } else {
                    fps = (int) (1000
                                / (System.currentTimeMillis() - lastFrameTime));
            } catch (Exception e) {}
}Of course change the 20 value of how long you sleep for how many frames you want to max it at, 30 frames per second would be total of 33 ms for a frame

Similar Messages

  • How to set a consistent footnote in pages 09?

    Hi people,
    I am currently writing a business report in Pages 09.
    I want to have on all pages the same footnote and headnote.
    Now, I have some stuff in the foot and head line of the first page and attached the style to it - but i did not anyything to set this to have the same text in every the footnote to every page, didnt also find it in the manuals - can you help?
    thanks!

    My guess is that your document is organized in sections and, for some reason, you asked the program to use different header/footer in the second section.
    Using the setting displayed here you will get the same footer in every pages.
    Yvan KOENIG (from FRANCE dimanche 25 janvier 2009 12:26:34)

  • Sending image sequence job to compressor in command line : how to set the framerate?

    Hello,
    In Compressor, when you import a image sequence, it's possible to set the framerate and add an audio file before choosing a preset and lauching the encoding task.
    I want to dlo the same thing with command line. I know how to send a compressor job with command line, but no how to add theses settings.
    In the compressor command line help, we've got this :
    Job Info: Used when submitting individual source files. Following parameters are repeated to enter multiple job targets in a batch
              -jobpath <url> -- url to source file.
                                               -- In case of Image Sequence, URL should be a file URL pointing to directory with image sequence.
                                               -- Additional parameters may be specified to set frameRate (e.g. frameRate=29.97) and audio file (e.g. audio=/usr/me/myaudiofile.mov).
    So there are also framerate and audio parameters in command line but i've no idea how to write the command line with theses parameters
    Here is an example of command line for Compressor (by Apple) :
    ./Compressor ‑clusterid tcp://127.0.0.1:51737 ‑batchname myBatch ‑jobpath /Volumes/Source/ShortClips/NTSC24p.mov ‑settingpath /Users/stomper10/Library/Application\ Support/Compressor/PhotoJPEG.setting ‑destinationpath /Users/machinename/Movies/myDestinationFilename.mov.
    Thank you for your help!

    You can see in the command sh running-config command
    show running-config : Displays the current access point operating configuration
    Use the guest-mode SSID configuration mode command to configure the radio interface (for the specified SSID) to support guest mode. Use the no form of the command to disable the guest mode.
    [no] guest-mode .
    Here is the guideline for usage
    The access point can have one guest-mode SSID or none at all. The guest-mode SSID is used in beacon frames and response frames to probe requests that specify the empty or wildcard SSID. If no guest-mode SSID exists, the beacon contains no SSID and probe requests with the wildcard SSID are ignored. Disabling the guest mode makes the networks slightly more secure. Enabling the guest mode helps clients that passively scan (do not transmit) associate with the access point. It also allows clients configured without a SSID to associate.
    Examples
    This example shows how to set the wireless LAN for the specified SSID into guest mode:
    AP(config-if-ssid)# guest-mode
    This example shows how to reset the guest-mode parameter to default values:
    AP(config-if-ssid)# no guest-mode

  • How to set server log file severity

    Will some one suggest how to set the severity for messages logged by server to server log file. The admin console consists of setting "Stdout Severity Threshold" which is applicable only to standard out. I need to restrict info messages to be logged in server log file.

    Which release of WebLogic Server are you using? In WebLogic 9.0 there is an attribute on the LogMBean called LogFileSeverity which could be configured to "Warning" so it will not allow Debug and Info level messages to be written to the server log file. In the 8.1 release you would need to do this programatically using a startup class, by getting a reference to the server Logger by invoking weblogic/logging/LoggingHelper.getServerLogger() and setting the appropriate weblogic/logging/WLLevel on the weblogic/logging/FilestreamHandler that writes to the server log file.
    Hope this helps
    Sandeep

  • How to set threshold level JPG images

    Please I need help with setting the right threshold value for my images. I am new with Photoshop. I need to interpret images consisting of sand oil and water in a glass medium. I need to calculate in pixels the volume of each phase (oil and water) with time. I converted the image to threshold and by default the setting is 128 level. This gives a rather high pixel value for the black background. adjust to other levels like 70 makes the white image more. Does some know how I can determine the correct threshold level to reflect that in the original image?
    Also how can set the threshold value to be the same for all the files (example 600 jpg files).
    Thanks a lot
    Engyy

    Also how can set the threshold value to be the same for all the files (example 600 jpg files).
    Create an action and use batch processing or import your images as a sequence and treat it as a video in the timeline. The rest is unclear. For all intents and purposes setting a threshold is completely arbitrary and factors like the color of the sand or whatever can influence it since e.g. red sand will naturally accentuate the red channel more than green and blue. Come to think of it, your methodology is rather unscientific in the first place, but providing one of your images as a sample reference might help people to be able to advise...
    Mylenium

  • How to set a fixed width for a box

    Hi there,
    Struggling here.... must admit. 
    I need a solution whereby I can set a fixed width for a box that is grouping two buttons.  I suppose generally, I want to know how to set a fixed width for anything element.
    See the picture below.  I want the two buttons to stay the same distance apart, and I want the grouped buttons to stay the same distance from the right edge of the window, even as a user resizes the window.
    This is what happens when you reduce the size of the window .....
    I would like to stop this from happening.
    I can't figure out how accomplish keeping the parent div a fixed width, and a fixed position from the right side of the window, so the buttons won't overlap.
    Perhaps I'm doing the whole thing wrong. 
    I mean, is there a way to accomplish this without grouping the buttons?  That is, make the buttons fixed width, fixed distance apart from each other, and fixed distance from the right side of the window, even as the user resizes the page?
    I am trying to accomplish this using the Min/Max width settings, but given that there are so many different units to choose from, and the fact that when I place a button or box on the screen, it seems to be creating that button or box with a percentage-based width, I don't know how many pixels to set it to.... sigh....
    Many thanks in advance for your help.
    Sam

    Okay after much futzing I figured out at least part of the solution I need, but if someone knows of a more efficent way to do this please let me know. 
    I set a fixed minimum width in pixels for both of the buttons at 156px.
    I then made the left button float left and the right button float right.
    I then made the parent div for the buttons float right.
    That made the buttons stay the same size.
    The only thing I need to figure out how to do now is make the parent div stay a consistent distance in pixels from the right.  I tried setting a right margin but that didn't work.  As you size the window down, the div gets closer to the edge, until it passes it.  

  • How to set dimension and another parameters of received dataSource to rec?

    I have a small problem with set the dimension of recording video from received dataSource.
    It always have dimension of original dataSource :/
    I have done something like this:
      FileTypeDescriptor ftd = new FileTypeDescriptor(FileTypeDescriptor.MSVIDEO);
      Format[] formats = new Format[] {new VideoFormat(VideoFormat.CINEPAK, new Dimension(1024,768), Integer.MAX_VALUE, Format.byteArray, (float)30)};
      ProcessorModel pm = new ProcessorModel(datasource, formats, ftd);
       processor = Manager.createRealizedProcessor(pm);
      DataSource outputDS = processor.getDataOutput();
       MediaLocator ml = new MediaLocator("file:capture.avi");
       datasink = Manager.createDataSink(outputDS, ml);
       datasink.open();
       datasink.start();
    I see that Datasource is not changed.
    But when I try to something like this:
    FormatControl formCont=((CaptureDevice)ds).getFormatControls()[0];
       VideoFormat formatVideoNew = new VideoFormat(null,null,-1,null,(float)camFPS);
       formCont.setFormat(CapFormat.intersects(formatVideoNew));
    I have an exception with casting Clonable dataSource to CaptureDevice:
    java.lang.ClassCastException: com.ibm.media.protocol.SuperCloneableDataSource$PushBufferDataSourceSlave cannot be cast to javax.media.protocol.CaptureDeviceThis works only when I'm operating od datasource taken from capturedevice, not received from another computer.
    The question is simple: How can I change dimension, frameRate etc. of record from received dataSource.

    FormatControls are only available on capture devices that have the ability to capture in multiple formats. The FormatControl is used to control the device itself, not the stream. The concept of using a FormatControl on a DataSource that isn't reading from a capture device doesn't make sense, which is why you're having problems.
    In order to change the resolution or other format characteristics of a video stream that isn't coming from a capture device directly, you'll need to transcode it from the existing format to the new format.
    [http://java.sun.com/javase/technologies/desktop/media/jmf/2.1.1/solutions/Transcode.html]
    Which is achieved by passing it through a Processor...

  • How to set up a RFC - HTTP Post scenario?

    Hi all,
    I've seen a scenario using a HTTP -> RFC but i didn`t found the other way, an RFC -> HTTP scenario.
    I have a scenario that consists of a RFC that will pass the parameters to XI and then, i've to map the parameters of this RFC into a XML message, zip this xml message, convert it to BASE 64 string, post this "binary" message thru HTTP POST and finally, send the XML HTTP response back to my RFC .
    My questions are:
    - How to map the RESPONSE of the http request to my RFC?
    - How to deal with the transformations of the data, from xml to zip and from zip to a base64 string.
    - How to set the URL of the HTTP POST dynamically?
    Thanks in advance!

    > Hi all,
    >
    > I've seen a scenario using a HTTP -> RFC but i didn`t
    > found the other way, an RFC -> HTTP scenario.
    >
    > I have a scenario that consists of a RFC that will
    > pass the parameters to XI and then, i've to map the
    > parameters of this RFC into a XML message, zip this
    > xml message, convert it to BASE 64 string, post this
    > "binary" message thru HTTP POST and finally, send the
    > XML HTTP response back to my RFC .
    >
    > My questions are:
    >
    > - How to map the RESPONSE of the http request to my
    > RFC?
    hmmm.. Maybe a Java Mapping?
    > - How to deal with the transformations of the data,
    > from xml to zip and from zip to a base64 string.
    Either Java Mapping or a Java Proxy.
    > - How to set the URL of the HTTP POST dynamically?
    >
    Use Adapter Specicif Identifiers and set it in the mapping dynamically.
    Regards
    Bhavesh

  • How to set DDL lock for a table

    OCI,how to set DDL lock for a table?

    Oracle acquires a dictionary lock automatically on behalf of any DDL transaction requiring it. Users cannot explicitly request DDL locks. Only individual schema objects that are modified or referenced are locked during DDL operations. The whole data dictionary is never locked
    DDL locks fall into three categories: exclusive DDL locks, share DDL locks, and breakable parse locks.
    see this link
    http://www.sc.ehu.es/siwebso/KZCC/Oracle_10g_Documentacion/server.101/b10743/consist.htm#i5281

  • How to set an actionscript class runnable + some question?

    Dear all,
      i am new to actionscript (Flex 3).
      i am from java camp and i want to achive some java-style functionality in actionscript,and hope you can help me:
      1. how to set an actionscript class runnable??
          in java, i just add a "public static void main(String[] args)" method which will be the program entry point. (IDE, right click the class and click run)
          i can't set a plain, ordinary actionscript runnable in flex builder.
          To test the class, i have to create an mxml (which in turn invoke the testing class) and it be runnable in the flex builder 3.
          any other way to ease the testing?
       2. it there any good 3rd party library for datatype conversion ? (e.g. string <> date, the build-in DateFormatter don't accept milliseconds)...
           it seems actionscript come with limited such kind of utility function
       3. in a custom mxml component, which contains several controls (say testboxes, comboboxes)...etc,
           for information hiding/prevent others to change the child controls in the custom component, how can i hide the child control, not allow
           other code to access the child by  "Component.textbox1"....any scope modifier, e.g. protected, private...etc in mxml?
       thank you.
    ppk luk

    Hi Alex,
      for question 3:
      i just wondering if it is ok or not for better code/validation.....(and it follow the good
    information hiding principle?)
      if i write the component in actionscript only, i can set the child control with scope modifier
    'private' or 'protected'..so that the component user can't just use the dot syntax to gain
    access to the child control,
    e.g. MyComponent.childControlTextInputBox.value = "A";...
    i want to force user to use MyComponent.setInputBoxValue("A")...
    (e.g. in this method, i can do some checking/validate before passing to the textbox)
      this can enforce the data consistency in my custom UI component...
      there is no way to achieve the same effect in MXML?
    (e..g <mx:TextInput id="privateChildControl" accessScope="private" .../>)
      thank you..

  • How to set field value in workflow SPD2013?

    Hi All,
    how to set field value in workflow SPD2013? Actually using Infopath, i need to update a field value through workflow.(Little differnt from SPD2010). How to do this?

    As Amit says, some elaboration here would be good.  You can use InfoPath as a form for either a list or a library and then set it to trigger a workflow upon item creation.  The workflow will consist a number of actions, one of which is the Update
    Field Item.
    More information on the available steps can be seen here.
    http://msdn.microsoft.com/en-us/library/office/jj164026.aspx
    Steven Andrews
    SharePoint Business Analyst: LiveNation Entertainment
    Blog: baron72.wordpress.com
    Twitter: Follow @backpackerd00d
    My Wiki Articles:
    CodePlex Corner Series
    Please remember to mark your question as "answered" if this solves (or helps) your problem.

  • How to Create a consistent Gradient w/ Soft Edge & Filter

    Hello, Im using photoshop 6, and Im trying to apply an effect for a banner photo, that will be consistent for other banner photos of the same size.
    I've attached a photo of this.
    As you can see the gradient (which contains the text) starts with a grey color then transitions to white. The right edge that meets the blue sky isnt a hard edge but rather a soft edge.
    Im not sure how to create that soft edge. Someone else had mentioned to use the gradient with colors from grey to white then to transparent to create that soft right edge.  Im not sure how to set that up.
    I used a brush in this case, and as you can see, the line is uneven.
    Also I believe the Filter used here is Ripple or Ocean Ripple.
    I was hoping if someone could walk me through what the correct steps would be to create that effect, so that I can use this consistently for several photos

    Oh, I see, PS 6. The parts here about Fill Layers and Layer Styles won't apply, but the editing method is the same:
    First, open the Gradient Editor by clicking on the Gradient in the Option Bar or the dialog for a Gradient Fill Layer:
    Set up a Gray-to-White Gradient, and add a transparent stop just pas the White stop:
    Enter a name, and click on "New" to save it. You can also save as part of a Layer Style with Gradient Overlay.

  • How to set up Deltas in FI data sources

    How to set up deltas  for FI Data sources & can any body give me the list of the Finance data sources...
    please help me..

    Standard FI data sources:
    0FI_GL_4 (G/L Accounts- line items)
    Takes the data from the FI document tables (BKPF/BSEG) that are relevant to general ledger accounting (compare table BSIS).
    0FI_AP_4 (AP-line items) and 0FI_AR_4 (AR- line items
    Selections are made from tables BSID/BSAD (Accounts Receivable) and BSIK/BSAK (Accounts Payable)
    How the data extraction happens?
    In FI extraction 0FI_AR_4 and 0FI_AP_4 are linked with 0FI_GL_4 in order to maintain consistent data transfer from OLTP system (it is called coupled data extraction, Ref OSS notes 428571).
    Note: Uncoupled" extraction possible with Plug-In PI 2002.2, see OSS note 551044
    0FI_GL_4 writes the entries into the time stamp table BWOM2_TIMEST in the SAP R/3 System with a new upper limit for the time stamp selection.
    And now, 0FI_AP_4   and 0FI_AR_4 will copy this new upper limit for the time stamp selection during the next data extraction in the SAP R/3 System. This ensures the proper synchronization of accounts payable and accounts receivable accounting with respect to G/L accounting.
    Full load: Not a valid choice because of large volumes of detailed R/3 transaction data.
    Delta load:
    Note: Here the delta identification process works differently for new financial records and for changed financial records.
    New Financial accounting line items which are posted in SAP R/3 sytem will be identified by the extractor using the time stamp in the document header (Table BKPF-(field) CPUDT).
    By scheduling an initialization IP all the historical data can be  loaded into BW from the application tables and it also sets "X" indicator in field LAST_TS (Flag: 'X' = Last time stamp interval of the delta extraction).That means after the last delta, initialization was done.
    OLTPSOURCE     AEDAT/AETIM     UPD     DATE_LOW     DATE_HIGH     LAST_TS
    0FI_GL_4     16 May 2007/20:15     Init     01 Jan 1990     15 May 2007     
    0FI_GL_4     24 May 2007/16:59     delta     16 May 2007     23 May 2007     
    0FI_GL_4     21 June 2007/18:12     delta     15 June 2007     20 June 2007     X
    0FI_AP_4     18 May2007/21:23     Init     01 Jan 1990     15 May 2007     
    After this, daily delta loads can be carried out depending on timestamp by scheduling delta info packages.
    During the delta load , the SAP R/3 system logs two time stamps that delimit a selection interval for a Data Source in table BWOM2_TIMEST(fields TS_LOW and TS_HIGH).
    FI -Delta Mode:
    A time stamp on the line items serves to identify the status of the delta. Time stamp intervals that have already been read are then stored in a time stamp table (BWOM2_TIMEST).
    (Info object 0Recordmode plays vital role deciding delta's .Check the field "delta "in ROOSOURCE /RODELTAM table to identify the image)
    The Financial Accounting line items are extracted from the SAP R/3 system in their most recent status (after-image delta method).
    AIE: This delta method is not suitable for filling Info Cubes directly in the BW system. To start with therefore, the line items must be loaded in the BW system in an ODS object that identifies the changes made to individual characteristics and key figures within a delta data record. Other data destinations (Info Cubes) can be provided with data from this ODS object.
    It uses delta type E(pull) means the delta data records are determined during the delta update by the data source extractor, updated to the delta queue and passed on to BI directly from there.

  • How to set index to tables?

    Hi,
    My database is having more than 50000 tables, I would like to set index to all my tables, please suggest me how to set index to 50000 tables...?
    Thanks
    Giri

    user10737570 wrote:
    Hi,
    My DB version 10.2.0.3.0 running on IBM-AIX....Thanks for it
    As is said earlier my DB consist of 50k tables.
    Each table consist of millions of rows.
    So, while I try to access some rows, It takes more time (especially while running long query)
    Now I decided to set index to the tables by giving
    create index fbind on fdtab(owner);
    so that an index has been created with taking nearly 5 hours.
    so there are thousands of tables left to set the index.....Its an utterly bad idea to create indexes assuming that their presence will make the queries faster. The data selection, predicates, conditions, statistics of the tables, good/bad sql and lastly, optimizer issues, they all play a very important role in the performance. Just assuming that with index creation , your queries will be faster, I don't think its a reasonable thought to have. You have got a lot of tables as per your saying , it would take huge resource and time to create indexes on all of the tables. In addition to this issue, not all the tables would be requiring the similar type of indexes as well. Some may require B-tree while others may rquire Bitmap. Also , you must note that indexes will make dmls more slower. So Ishall again suggest that you benchmark the creation of indexes with a little more care.
    HTH
    Aman....

  • How to set input delay and output delay when source Synchronous

    ClkIN is the board clock which is connected to the FPGA. Clkif is the generated clock from ClkIN. The Device's clk come from Clkif. So, how to set input delay and output delay in this scene(within my understand, this is Source Synchronous)?
    The example in many document, the input delay and output delay setting all refer to board clock(within my understand, this is System Synchronous). In that scene, the input delay max = TDelay_max + Tco_max; input delay min = Tdelay_min + Tco_min; the output delay max = Tdelay_max + Tsu; output delay min = Tdelay_min - Th.
    So, I want to know how to set input/output delay in the Source Synchronous.
    In system synchronous, I set input/output delay such as:
    create_clock -period 20.000 -name ClkIN -waveform {0.000 10.000} [get_ports ClkIN]
    create_generated_clock -name Clkif -source [get_pins cfg_if/clk_tmp_reg/C] -divide_by 2 [get_pins cfg_if/clk_tmp_reg/Q]
    create_clock -period 40.000 -name VIRTUAL_clkif //make virtual clock
    set_input_delay -clock [get_clocks VIRTUAL_clkif] -min 0.530 [get_ports DIN]
    set_input_delay -clock [get_clocks VIRTUAL_clkif] -max 7.700 [get_ports DIN]
    set_output_delay -clock [get_clocks VIRTUAL_clkif] -min -0.030 [get_ports DOUT]
    set_output_delay -clock [get_clocks VIRTUAL_clkif] -max 1.800 [get_ports DOUT]
    *******************************************************************************************

    So, first. Architecturally, the clock that you forward to your external device should not come directly from the clock tree, but should be output via an ODDR with its D1 input tied to logic 1 and the D2 tied to logic 0. This guarantees minimal skew between the output data and the forwarded clock.
    ODDR #(
    .DDR_CLK_EDGE("OPPOSITE_EDGE"), // "OPPOSITE_EDGE" or "SAME_EDGE"
    .INIT(1'b0), // Initial value of Q: 1'b0 or 1'b1
    .SRTYPE("SYNC") // Set/Reset type: "SYNC" or "ASYNC"
    ) ODDR_inst (
    .Q (Clkif_ff), // 1-bit DDR output
    .C (ClkIN_BUFG), // 1-bit clock input
    .CE (1'b1), // 1-bit clock enable input
    .D1 (1'b1), // 1-bit data input (positive edge)
    .D2 (1'b0), // 1-bit data input (negative edge)
    .R (rst), // 1-bit reset
    .S (1'b0) // 1-bit set
    OBUF OBUF_inst (.I (Clkif_ff), .O (Clkif_out));
    This generates an output clock that is the same frequency as your input clock. This is consistent with your drawing, but inconsistent with your constraints - is the forwarded clock a 50MHz clock or a 25MHz clock?
    I will assume your ClkIN goes to a BUFG and generates ClkIN_BUFG.  Your first constraint generates a 50MHz clock on the ClkIN port which will propagate through the BUFG to (among other places) this ODDR.
    create_clock -period 20.000 -name ClkIN -waveform {0.000 10.000} [get_ports ClkIN]
    Assuming your forwarded clock is supposed to be 50MHz, then your 2nd command is close to correct
    create_generated_clock -name Clkif -source [get_pins cfg_if/ODDR_inst/C] -combinational  [get_pins cfg_if/ODDR_inst/Q]
    With this done, you have successfully described the forwarded clock from your design. This is the clock that goes to your device, and hence should be the clock which is used to specify your input and output constraints.
    set_input_delay -clock [get_clocks Clkif] -min 0.530 [get_ports DIN]
    set_input_delay -clock [get_clocks Clkif] -max 7.700 [get_ports DIN]
    set_output_delay -clock [get_clocks Clkif] -min -0.030 [get_ports DOUT]
    set_output_delay -clock [get_clocks Clkif] -max 1.800 [get_ports DOUT]
    If you want to get fancier, you could try adding a set_clock_latency to the forwarded clock to account for the board propagation of the clock
    set_clock_latency -source TDtrace2 [get_clocks Clkif]
    (But I haven't experimented with clock latency on a generated clock and I don't know for a fact that it works).
    Avrum

Maybe you are looking for

  • The sound on my laptop has stopped working entirely, with and without headphones.  What should I do?

    The sound on my computer has stopped working.  I have searched through countles google entries to try and figure out the problem but I can't find anything remotely useful.  I never spilled any liquid or anything on my computer.  I was just searching

  • Mass configuration of standard ES Bundle ESA Add-On 603

    Hi All: We have recently installed and activated the ECC-SE ESA add-on 603 on our SAP ERP 7.0 SP14 with soamanager transaction. I have checked that the add-on, I believe, it is most likely well installed. At least, when I execute the SPROXY transacti

  • Range partition by a virtual column derived from XMLTYPE

    I want to create table and partition it by interval partion (range partition) on a virtual column which is derived from XMLTYPE i get ora-14513 error. create table dicom_archive_virtual id integer not null primary key, parent_id integer, -- where thi

  • Problem in activating Transformation

    Hi All, I have a calmonth field coming from the source system with with sinlge digit value. I am using the info object 0calmonth2 in BI. So I have created a small formula in the transformation to prefix the value from source system with a zero. A zer

  • Update "no permission"??

    I just did a "software update," of which there were five. But two of them could not be installed, and had exclamation points next to them, with a message saying that they could not be installed because I did not have proper permissions. I've done cou