Slimwaffle Posted August 14, 2018 Share Posted August 14, 2018 Hey guys. I need help again. So I rewrote the scripts for my HUD to look a little nicer. Using Circles instead of bars. And for some reason I am getting crazy FPS drop. With bars I was able to sit at 60fps very comfortably but using circles I drop to between 5-10fps. Can someone please help? I have looked over the code and can't figure it out. As usual I will provide the code and a screen shot. This fps drop happens even when only using one of the new scripts. Hungerbar.lua Health.lua ThirstBar.lua Staminabar.lua Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted August 14, 2018 Share Posted August 14, 2018 You are drawing 4000 rectangles every frame. 1 Quote Link to comment Share on other sites More sharing options...
Slimwaffle Posted August 14, 2018 Author Share Posted August 14, 2018 Is there anyway to draw a circle without doing this? The only shape I could find in the API was DrawRect. Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted August 14, 2018 Share Posted August 14, 2018 I think the best way would be an image of a circle and a custom shader which cuts away part of the circle based on the angle you specify. Maybe someone has posted a shader for this on the forum. Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted August 14, 2018 Share Posted August 14, 2018 A second way is to draw a texture that represent 1 % of a filled healthbar. Then use @macklebee rotate image shader for every percentage of health, you draw the image with a given rotation. A third way is having a spreadsheet with all the possible health statusses and draw the one that matches your percentage. 1 Quote Link to comment Share on other sites More sharing options...
Slimwaffle Posted August 14, 2018 Author Share Posted August 14, 2018 Thanks mate. I am just going to do bars for now. And re-address this circle thing after getting this game more built. But I will let you know how I go and you were 100% right swapping back to bars fixed the fps drop. Running back at 60 fps now. Got it looking like this for now. 2 Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted August 14, 2018 Share Posted August 14, 2018 That looks pretty good too. 1 Quote Link to comment Share on other sites More sharing options...
Slimwaffle Posted August 14, 2018 Author Share Posted August 14, 2018 Thanks mate. I am almost at the point with this thing where I can just build the map. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.