How do I make in-game water that does not drop the frame rate.

Started by
6 comments, last by yaboiryan 1 year, 11 months ago

I have been programming this RTS game for a few months now and I was running into some performance issues, and I found what the issue was when I stopped rendering the water and my FPS went from 25 to 102. However, water is necessary for the boats in the game, as they would look werid floating in the air above the sea floor. Is there any way that I could render the water more efficiently so that the weight on the FPS won't be as severe? I will gladly post any code that is needed.

-RJ

Advertisement

Well, how are you rendering your water? Is it simply a semi-transparent plane, perhaps with a texture applied, or do you have a more-complex approach--involving things like reflections, waves, fluid simulation, or suchlike.?

MWAHAHAHAHAHAHA!!!

My Twitter Account: @EbornIan

A common mistake in games is that developers think everything must be the same as in reality. For waves, you may be computing the wave-form in time, and compute how ships respond to it.

However, games is all about smoke and mirrors. Any method is good, as long as it is convincing to the user. For waves, you could have an animation for the water, and have ships follow a fixed angular rocking motion. Looks the same but much less computing happening.

@Thaumaturge I am rendering it as a plane with a bunch of triangles with fluid simulation and also added a transparency effect so the player can see the sea floor, and over the transparency effect I loaded a texture.

@Alberth That is what concerns me. It seems like doing an animation would cause the model to run slower.

yaboiryan said:
I am rendering it as a plane with a bunch of triangles with fluid simulation and also added a transparency effect

yaboiryan said:
It seems like doing an animation would cause the model to run slower.

These two are at odds.

An animation is usually quite simple to run. You have an animation sequence that loops and requires almost no effort on your part. A fluid simulation that updates a large triangle mesh requires far more work and takes more time. There are some rather advanced shader work that divides the work across a thousand shader processing units or so on the graphics card so it runs more quickly, but it is still far more work than a simple animation.

Games of the era you are trying to duplicate used very simple animations and overlays that looked like waves to players. In the era immediately before that one, they used palette effects to rotate the colors rather than change what was actually drawn, and sometimes an overlay layer on hardware that did that kind of thing.

@frob Oh okay good point. I will go quickly try out animations.

This topic is closed to new replies.

Advertisement