Jump to content
  • Advertisement
Sign in to follow this  
NukeCorr

2D tilemap water physics

This topic is 2750 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey hey, I see a new website and forum. Long time since I was here, but anyway..

I'm programming a 2D game with C++ and openGL. I have implemented 2D water physics but it seem to eat lot of fps on slower computers. I have tilemap 200x200 size and water is a tile or many tiles.
My code runs through the whole tilemap with for() loops searching for tiles that are water and drops them or moves them, etc.
I've noticed the for() loops through the 200x200 tilemap is very slow and on my betatesters' older computers fps drops alot.
What would be the efficient method to check tiles for water and not lose too much fps on large tilemaps?

edit. so the question would be: what are the alternative methods for for() loop?

ps. if the video gives you any better perspective on this topic, here's a clip how the water/lava works

Share this post


Link to post
Share on other sites
Advertisement
I am not completly sure if this will help, but while looking up octree's i came accross an article that used them for collision. It splits the screen into 4, then each part into another 4 and so on, and so on, using this method you may be able to check sections of your array or screen, and leaving out others that have no water at all. Like i said i really dont know if that will help you at all. But its worth looking into :)

Share this post


Link to post
Share on other sites
That might be the method I've been looking for, atleast for now.
I'll try that one, although I'm open for every suggestion

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!