Windows Lighting System Dropping the FPS

Discussion in 'Programming' started by 3jgamesdev, Sep 13, 2019.

  1. 3jgamesdev

    3jgamesdev Member

    Joined:
    Jul 9, 2016
    Posts:
    69
    Hi good day everyone,

    I was using this lighting system i found, but when i have added it to my game, the game fps is dropping to almost 25%, my view is 1920x1080 also with a room size of almost 5000 and i am using an average i3 laptop / 4gb ram/512 video card, when i try to take out that lighting system, my game fps is back to normal, is there anyway i can use this lighting system without getting any LAG? or dropping the fps for a 1080p game?

    By the way my game art style is hand painted , lower than rayman and Ori, i have decided to use a 1920x1080 to make the art more realistic , In my game I have added Bloom shader and Blur in the screenshot below the lighting system is only surface, i want it to be more dynamic just like the lighting system above, but when i try to add it, the FPS is dropping really low makes the game LAG, I have decided to use a lower laptop specs, because it will be our minimum requirement for our game, In my country that is the average specs we have, So we are making sure they can enjoy it even using an average PC

    [​IMG]

    Thanks in Advance
     
  2. Relic

    Relic Member

    Joined:
    Jun 27, 2017
    Posts:
    699
    I've not gone through the tutorial, but I can see the tutorial game room is not 5000x5000 - but something that fits on screen. Thus the tutorial code may not have the rigor to deal with larger environments. Would you say the code as you have it would be creating lights/shadows for the entire room? Even if 90% of the room is not visible on the screen? That will be the issue - its too demanding on your machine.

    You will have to limit what happens when these lights and shadows are created during the game - limit the calculations to only the stuff currently on screen, or perhaps just a fraction out side of it. Use surfaces no bigger than the view to limit the drawing pressure.
     
  3. Nocturne

    Nocturne Friendly Tyrant Forum Staff Admin

    Joined:
    Apr 13, 2016
    Posts:
    6,871
    I'll just leave this here.... https://marketplace.yoyogames.com/assets/5229/aura-2-0-lighting-engine ;)

    Shameless advertising aside, what @Relic says is absolutely the issue here. You will need to look at the code you have and work out ways to cull what is being drawn to ONLY be within the visible screen space and not the whole room. The asset linked above does this using a small script to detect if a light is within the view or not (based on the light radius) and if it's not it simply skips the drawing of the light and any shadows it casts. You'll also want to look at making the actual light surface the size of the view too, and then clearing and redrawing it ONLY when the view changes position (which will probably mean you have to offset stuff to draw them correctly to the surface).
     
    DBenji and Cpaz like this.
  4. 3jgamesdev

    3jgamesdev Member

    Joined:
    Jul 9, 2016
    Posts:
    69
    I already make those lighting and shadow will fit in my game view, but it was still dropping almost 25%
     
  5. 3jgamesdev

    3jgamesdev Member

    Joined:
    Jul 9, 2016
    Posts:
    69
    Thanks I will try to look your asset, if i wasnt able to figure it out, maybe i will use your asset thanks
     
  6. The Reverend

    The Reverend Member

    Joined:
    Sep 8, 2016
    Posts:
    552
    Do that. Aura is great :)
     
  7. 3jgamesdev

    3jgamesdev Member

    Joined:
    Jul 9, 2016
    Posts:
    69
    Thanks I will try it Promise :)
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice