User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11

Thread: FPS and Bullets Compromise

  1. #1
    No Products Registered

    Join Date
    Jul 2009
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    FPS and Bullets Compromise

    Hello, people!
    I am making top-down shooter that uses loop-based bullets system. I have chosen loop-based system because it is the most preccision way to aviod problems when bullets fly trough a wall. For great quallity (FPS) I have to use 100 fps runtime mode. So, when I run my game with 100 fps all loop-based events run with crazy speed(much more than i need).
    How could I run my game at 100 fps without problems in loop-based events?

  2. #2
    Clicker Multimedia Fusion 2
    SEELE's Avatar
    Join Date
    Jul 2007
    Location
    Terra australis incognito
    Posts
    1,916
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: FPS and Bullets Compromise

    100fps! :crazy:

    That's not really necessary, your target audience will almost certainly have screens with a refresh rate of 75 or less... Rendering faster then that is just a waist of CPU.

    You cauld try replacing whatever 'loop-based' events are with fastloop based events.

  3. #3
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jun 2006
    Location
    Darlington, UK
    Posts
    3,298
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: FPS and Bullets Compromise

    You can create framerate-independent movements by dividing an object's speed by the current FPS (which I believe there is an expression to get these days) before adding to their position.

    So instead of:
    Always:
    Add speed to position
    You have:
    Always:
    Add speed / fps to position
    or:
    Always:
    Add speed * frame time to position

    Note that speeds are now in pixels per second instead of pixels per frame.

    Does that help?

  4. #4
    Clicker Multimedia Fusion 2
    SEELE's Avatar
    Join Date
    Jul 2007
    Location
    Terra australis incognito
    Posts
    1,916
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: FPS and Bullets Compromise

    You can get the current FPS by typing the word 'framerate' or by retreiving it from the 'storyboard controls' object.

    However although Dynasoft's idea makes seance in theory, due to abstract math involved in determining the current frame rate it won't work correctly, an easy way to prove this is with the following events (run at a high FPS to accentuate results)

    +timer <= 10 seconds
    +every one second
    -add framerate to global value a

    +timer <= 10 seconds
    -add 1 to global value b

    If Dynasoft's idea is to work, it would require that both global value a and b are identical at the end of execution; however this is not the case.

    I wrote an article explaining how to correctly handle frame rate Independent movement/game play, it is available here

    However I'm aware it's difficult to follow, so in a nutshell; you need to keep a track of exactly how much action per time you have taken in the past and base future actions per time on that.

    Good luck with all this

  5. #5
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jun 2006
    Location
    Darlington, UK
    Posts
    3,298
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: FPS and Bullets Compromise

    The "framerate" is probably calculated as 1/(frame time), so you'd need to sample it every frame to be accurate, not every second.

    EDIT: If every frame you set one counter to the calculated time since last frame and another to 1/framerate, are they the same (within float error)? I don't have MMF installed again yet or I'd try it myself.

  6. #6
    No Products Registered

    Join Date
    Jul 2009
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: FPS and Bullets Compromise

    Thanks, but I don't really think it is necessary to calculate anything. Why MMF2 does not separate FPS for screen and FPS for action(events)?
    That would be great and developers could make their projects without troubles. Anyway, let's take Tormshire(the game project). It has great graphics and it's game world is large enough. I don't know what FPS mode does this game use, but it looks cool and clear at video.

  7. #7
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jun 2006
    Location
    Darlington, UK
    Posts
    3,298
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: FPS and Bullets Compromise

    If you turn on "Machine Independent Speed" then it does seperate the two, but only by allowing the graphics fps to drop below the action fps if needed.

    Most professional games do tie the two together, because there is no point to code running too much faster than what you can see. The exception is often physics code, which will loop several times for every frame of graphics / gameplay code in order to get an accurate result. People even do that in MMF, by using fast loop movements.

  8. #8
    No Products Registered

    Join Date
    Jul 2009
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: FPS and Bullets Compromise

    Ok! Thanks!
    I also have a question about number of objects. I have a great system using a lot of simple active objects(for laser tracer), but this way takes a lot of memory(over 1000 objects for 1000 pixels of screen). Does build#249 fix the problem with number objects limit?

  9. #9
    Clicker Multimedia Fusion 2
    SEELE's Avatar
    Join Date
    Jul 2007
    Location
    Terra australis incognito
    Posts
    1,916
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: FPS and Bullets Compromise

    The limit is set by an option under the frame properties, the default it 500, but it can be changed to 20,000.

  10. #10
    No Products Registered

    Join Date
    Jul 2009
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: FPS and Bullets Compromise

    SEELE, I know that it is possible but the game lags when the number of active objects more than 1500 even when I have set 5000 for the limit.

Page 1 of 2 1 2 LastLast

Similar Threads

  1. 49 Bullets: When it rains in the desert
    By NecroLuigi in forum Desktop Releases (PC & Mac)
    Replies: 7
    Last Post: 15th September 2016, 09:31 AM
  2. Ring of bullets
    By Windybeard in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 4th March 2013, 03:35 PM
  3. Programming bullets
    By Skeets in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 12th June 2007, 09:43 PM
  4. Fastloop bullets example
    By DavidN in forum File Archive
    Replies: 3
    Last Post: 21st April 2007, 11:13 PM
  5. Bullets Going Through Walls?
    By Brandon in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 29th December 2006, 10:10 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •