Drastically Optimized Water Calculations


        This took me 5 grueling hours to get the water optimized so that no matter how much water is in the game a terrible lag will not occur.
I don't know how many different tricks I attempted to use to optimize this. The culprit was setting a pixel for every change that happened in the water. Eventually I found the solution to be a simple one. The solution was to handle the colors of a vertical line and then manipulate that line through sf::sprite as needed.   This was actually essential to fix because the water ruined the entire game with terrible lagging in a multiplayer connection.
Changes are updated in waterphysics.h  right here: https://github.com/Happy-Flappy/Blupi-Empire/blob/main/waterphysics.h 

By the way, for any coders out there wondering why there are so many spaces in my code: I have no idea :) 

Get Blupi Empire

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.