Description

Click here to download a demo

Click here to download a simplified demo

Forum thread

This asset provides you with realistic water physics and water visualization for your 2D game. It includes a guide, a well-commented example, and documentation for each script making it easy to implement it into your game. The physics and visualization are done with shaders, making the water simulation very fast. You can have more than a million blocks of water simulated simultaneously with great frame rates. The asset is highly customizable, letting you tweak the water extensively.

Features:

  • Water currents (water can push objects around).
  • Water pressure (water can be pushed up through e.g. pipes).
  • Highly customizable reflections (reflections are optional in case you prefer no reflections).
  • Light source reflection (letting e.g. the sun and moon have longer reflections in water).
  • Textured water.
  • Adjustable colors (for water bodies, water surfaces, and falling water).
  • Refraction (making the water's background look distorted through the water).
  • Reflection displacement (different types of distortions to apply to reflections).
  • Customizable waves.
  • Waterfalls.
  • Four gravity directions.
  • Choose between two shader languages, HLSL 9 and GLSL ES.
  • Reading/writing of volume and velocity, allowing e.g. a player to swim and splash the water around.
  • Reading of pressure (e.g. to damage a player if he has dived too deep without diving equipment).
  • Synchronization system between GPU memory and RAM.
  • Saving/loading of water from files.
  • A guide for implementation.
  • Commented and organized code.
  • Fast and optimized, made with efficiency in mind.
  • Supports logic and display separation.
  • Irrespective of room speed, dependent on delta_time (and easily convertable to other game loops if need be).
  • All in GML, HLSL 9, and GLSL ES.

End User Licence Agreement (EULA).

Changes in 1.0.2

Fixed windows YYC bugs.

Version 1.0.2. Published March 28, 2017

Created with GameMaker: Studio v1.4.1763

Age Rating: 4+

Average Rating

Your review

You can only review assets you've bought.


Gravatar

Florin V 17 April 2017


Gravatar

Daniel B 17 March 2017

Works Great

This review was left for a previous version of this asset.


Gravatar

Matthew K 05 March 2017

Gem

Very detailed and optimized, the author put a great deal of attention towards this asset. Brilliantly done!

This review was left for a previous version of this asset.


Gravatar

Anonymous 22 December 2016

Awesome :D

I was really exited about this purs. for learning shaders and implementing into my game w/ new render engine! Nice work dude!

This review was left for a previous version of this asset.

Package contents

Total size 8.29 MB

Water Physics.extension.gmx 14.3 KB Water Physics
Assets
datafiles Fonts Objects Rooms Scripts
bl_init.gml 636 Bytes bl_rectangle_create.gml 1.53 KB bl_rectangle_destroy.gml 217 Bytes bl_rectangle_draw.gml 9.08 KB bl_rectangle_update.gml 1.79 KB example_block_get_image_index.gml 1.46 KB example_block_set.gml 2.55 KB example_create_block_surfaces.gml 1.65 KB example_create_sf_behind_water.gml 5.98 KB example_create_sf_light.gml 4.58 KB example_draw_gui.gml 1022 Bytes example_draw_without_reflections.gml 1.62 KB example_draw_with_reflections.gml 4.24 KB example_draw_world.gml 804 Bytes example_init_blocks.gml 2.03 KB example_init_gui.gml 666 Bytes example_init_volume_count.gml 805 Bytes example_init_world.gml 288 Bytes example_load_world.gml 3.38 KB example_point_collision.gml 663 Bytes example_set_player_position.gml 1.66 KB example_set_player_velocity.gml 2.28 KB example_update_volume_count.gml 1.62 KB GUIDE.gml 8.06 KB wp_free.gml 78 Bytes wp_rectangle_add_reflections_and_draw.gml 8.63 KB wp_rectangle_buffer_to_surface.gml 7.37 KB wp_rectangle_create.gml 25.9 KB wp_rectangle_destroy.gml 728 Bytes wp_rectangle_draw.gml 14 KB wp_rectangle_enable_automatic_reflection_precalculation.gml 1.13 KB wp_rectangle_enable_boundaries.gml 1.74 KB wp_rectangle_enable_pressure_transport.gml 737 Bytes wp_rectangle_get_buffer.gml 874 Bytes wp_rectangle_get_pressure.gml 1.92 KB wp_rectangle_get_velocity.gml 4.33 KB wp_rectangle_get_volume.gml 1.88 KB wp_rectangle_load_volume.gml 710 Bytes wp_rectangle_precalculate_reflections.gml 489 Bytes wp_rectangle_save_volume.gml 555 Bytes wp_rectangle_set_acceleration_direction.gml 467 Bytes wp_rectangle_set_animation_time_factor.gml 612 Bytes wp_rectangle_set_foam_color.gml 688 Bytes wp_rectangle_set_moving_water_color.gml 816 Bytes wp_rectangle_set_reflection_displacement.gml 1.84 KB wp_rectangle_set_reflection_falloff.gml 621 Bytes wp_rectangle_set_reflection_offset.gml 881 Bytes wp_rectangle_set_reflection_scale.gml 636 Bytes wp_rectangle_set_reflection_strength.gml 502 Bytes wp_rectangle_set_refraction_displacement.gml 1.93 KB wp_rectangle_set_velocity.gml 3.1 KB wp_rectangle_set_volume.gml 2.97 KB wp_rectangle_set_water_body_color.gml 679 Bytes wp_rectangle_set_wave.gml 822 Bytes wp_rectangle_surface_to_buffer.gml 1.45 KB wp_rectangle_update_blocks.gml 10.5 KB wp_rectangle_update_simulation.gml 17.4 KB
Shaders
sh_bl_bicubic.shader 1.58 KB sh_bl_blur_x.shader 1.44 KB sh_bl_blur_y.shader 1.47 KB sh_bl_draw.shader 458 Bytes sh_bl_remove_edge.shader 1.35 KB sh_wp_add_velocity_glsl_es.shader 770 Bytes sh_wp_add_velocity_hlsl_9.shader 1.01 KB sh_wp_add_volume_glsl_es.shader 830 Bytes sh_wp_add_volume_hlsl_9.shader 1.08 KB sh_wp_precalculate_reflections_glsl_es.shader 909 Bytes sh_wp_precalculate_reflections_hlsl_9.shader 1.14 KB sh_wp_replace_velocity_glsl_es.shader 686 Bytes sh_wp_replace_velocity_hlsl_9.shader 929 Bytes sh_wp_replace_volume_glsl_es.shader 684 Bytes sh_wp_replace_volume_hlsl_9.shader 951 Bytes sh_wp_update_0_down_glsl_es.shader 4.9 KB sh_wp_update_0_down_hlsl_9.shader 9.45 KB sh_wp_update_0_left_glsl_es.shader 4.9 KB sh_wp_update_0_left_hlsl_9.shader 9.47 KB sh_wp_update_0_right_glsl_es.shader 4.9 KB sh_wp_update_0_right_hlsl_9.shader 9.45 KB sh_wp_update_0_up_glsl_es.shader 4.87 KB sh_wp_update_0_up_hlsl_9.shader 9.47 KB sh_wp_update_1_down_glsl_es.shader 2.14 KB sh_wp_update_1_down_hlsl_9.shader 2.44 KB sh_wp_update_1_left_glsl_es.shader 2.13 KB sh_wp_update_1_left_hlsl_9.shader 2.42 KB sh_wp_update_1_right_glsl_es.shader 2.13 KB sh_wp_update_1_right_hlsl_9.shader 2.42 KB sh_wp_update_1_up_glsl_es.shader 2.14 KB sh_wp_update_1_up_hlsl_9.shader 2.44 KB sh_wp_update_2_horizontal_glsl_es.shader 1.7 KB sh_wp_update_2_horizontal_hlsl_9.shader 2.01 KB sh_wp_update_2_vertical_glsl_es.shader 1.71 KB sh_wp_update_2_vertical_hlsl_9.shader 2.01 KB sh_wp_update_3_down_glsl_es.shader 3.57 KB sh_wp_update_3_left_glsl_es.shader 3.55 KB sh_wp_update_3_right_glsl_es.shader 3.55 KB sh_wp_update_3_up_glsl_es.shader 3.55 KB sh_wp_update_4_down_glsl_es.shader 5.03 KB sh_wp_update_4_left_glsl_es.shader 5.03 KB sh_wp_update_4_right_glsl_es.shader 4.94 KB sh_wp_update_4_up_glsl_es.shader 5.03 KB sh_wp_visualize_0_horizontal_glsl_es.shader 2.64 KB sh_wp_visualize_0_horizontal_hlsl_9.shader 2.81 KB sh_wp_visualize_0_vertical_glsl_es.shader 2.64 KB sh_wp_visualize_0_vertical_hlsl_9.shader 2.81 KB sh_wp_visualize_1_horizontal_glsl_es.shader 3.34 KB sh_wp_visualize_1_horizontal_hlsl_9.shader 3.6 KB sh_wp_visualize_1_vertical_glsl_es.shader 3.34 KB sh_wp_visualize_1_vertical_hlsl_9.shader 3.6 KB sh_wp_visualize_2_horizontal_glsl_es.shader 4.99 KB sh_wp_visualize_2_horizontal_hlsl_9.shader 5.24 KB sh_wp_visualize_2_vertical_glsl_es.shader 4.99 KB sh_wp_visualize_2_vertical_hlsl_9.shader 5.24 KB sh_wp_visualize_3_horizontal_glsl_es.shader 5.19 KB sh_wp_visualize_3_horizontal_hlsl_9.shader 5.4 KB sh_wp_visualize_3_vertical_glsl_es.shader 5.19 KB sh_wp_visualize_3_vertical_hlsl_9.shader 5.4 KB sh_wp_visualize_4_horizontal_glsl_es.shader 2.92 KB sh_wp_visualize_4_horizontal_hlsl_9.shader 3.09 KB sh_wp_visualize_4_vertical_glsl_es.shader 2.92 KB sh_wp_visualize_4_vertical_hlsl_9.shader 3.09 KB sh_wp_visualize_5_horizontal_glsl_es.shader 3.57 KB sh_wp_visualize_5_horizontal_hlsl_9.shader 3.83 KB sh_wp_visualize_5_vertical_glsl_es.shader 3.57 KB sh_wp_visualize_5_vertical_hlsl_9.shader 3.83 KB
Sprites
spr_example_block_bricks.sprite.gmx 2.23 KB spr_example_block_dirt.sprite.gmx 2.18 KB spr_example_block_glass.sprite.gmx 2.21 KB spr_example_block_grass.sprite.gmx 2.21 KB spr_example_block_iron.sprite.gmx 2.18 KB spr_example_block_leaves.sprite.gmx 2.23 KB spr_example_block_stone.sprite.gmx 2.21 KB spr_example_block_wood.sprite.gmx 2.18 KB spr_example_button_gravity.sprite.gmx 694 Bytes spr_example_button_world.sprite.gmx 692 Bytes spr_example_color_select.sprite.gmx 690 Bytes spr_example_high_pressure.sprite.gmx 693 Bytes spr_example_moon_real.sprite.gmx 695 Bytes spr_example_moon_reflection.sprite.gmx 701 Bytes spr_example_player.sprite.gmx 686 Bytes spr_example_slider.sprite.gmx 808 Bytes spr_example_sun_real.sprite.gmx 692 Bytes spr_example_sun_reflection.sprite.gmx 700 Bytes spr_example_toggle_box.sprite.gmx 1.25 KB spr_example_water_overlay.sprite.gmx 698 Bytes spr_example_world_background_layers_real.sprite.gmx 1.03 KB spr_example_world_background_layers_reflection.sprite.gmx 720 Bytes spr_wp_displacement.sprite.gmx 690 Bytes spr_wp_visualization_noise.sprite.gmx 771 Bytes images
spr_example_block_bricks_0.png 143 Bytes spr_example_block_bricks_1.png 144 Bytes spr_example_block_bricks_10.png 139 Bytes spr_example_block_bricks_11.png 142 Bytes spr_example_block_bricks_12.png 142 Bytes spr_example_block_bricks_13.png 139 Bytes spr_example_block_bricks_14.png 139 Bytes spr_example_block_bricks_15.png 140 Bytes spr_example_block_bricks_16.png 140 Bytes spr_example_block_bricks_17.png 137 Bytes spr_example_block_bricks_18.png 137 Bytes spr_example_block_bricks_19.png 137 Bytes spr_example_block_bricks_2.png 142 Bytes spr_example_block_bricks_20.png 137 Bytes spr_example_block_bricks_21.png 137 Bytes spr_example_block_bricks_22.png 140 Bytes spr_example_block_bricks_23.png 138 Bytes spr_example_block_bricks_3.png 147 Bytes spr_example_block_bricks_4.png 146 Bytes spr_example_block_bricks_5.png 142 Bytes spr_example_block_bricks_6.png 145 Bytes spr_example_block_bricks_7.png 148 Bytes spr_example_block_bricks_8.png 147 Bytes spr_example_block_bricks_9.png 139 Bytes spr_example_block_dirt_0.png 304 Bytes spr_example_block_dirt_1.png 287 Bytes spr_example_block_dirt_10.png 308 Bytes spr_example_block_dirt_11.png 293 Bytes spr_example_block_dirt_12.png 302 Bytes spr_example_block_dirt_13.png 315 Bytes spr_example_block_dirt_14.png 298 Bytes spr_example_block_dirt_15.png 298 Bytes spr_example_block_dirt_16.png 287 Bytes spr_example_block_dirt_17.png 293 Bytes spr_example_block_dirt_18.png 292 Bytes spr_example_block_dirt_19.png 283 Bytes spr_example_block_dirt_2.png 283 Bytes spr_example_block_dirt_20.png 285 Bytes spr_example_block_dirt_21.png 303 Bytes spr_example_block_dirt_22.png 286 Bytes spr_example_block_dirt_23.png 283 Bytes spr_example_block_dirt_3.png 293 Bytes spr_example_block_dirt_4.png 286 Bytes spr_example_block_dirt_5.png 291 Bytes spr_example_block_dirt_6.png 319 Bytes spr_example_block_dirt_7.png 311 Bytes spr_example_block_dirt_8.png 302 Bytes spr_example_block_dirt_9.png 287 Bytes spr_example_block_glass_0.png 183 Bytes spr_example_block_glass_1.png 183 Bytes spr_example_block_glass_10.png 163 Bytes spr_example_block_glass_11.png 153 Bytes spr_example_block_glass_12.png 153 Bytes spr_example_block_glass_13.png 160 Bytes spr_example_block_glass_14.png 160 Bytes spr_example_block_glass_15.png 156 Bytes spr_example_block_glass_16.png 156 Bytes spr_example_block_glass_17.png 129 Bytes spr_example_block_glass_18.png 129 Bytes spr_example_block_glass_19.png 129 Bytes spr_example_block_glass_2.png 181 Bytes spr_example_block_glass_20.png 129 Bytes spr_example_block_glass_21.png 129 Bytes spr_example_block_glass_22.png 174 Bytes spr_example_block_glass_23.png 169 Bytes spr_example_block_glass_3.png 178 Bytes spr_example_block_glass_4.png 173 Bytes spr_example_block_glass_5.png 170 Bytes spr_example_block_glass_6.png 176 Bytes spr_example_block_glass_7.png 166 Bytes spr_example_block_glass_8.png 172 Bytes spr_example_block_glass_9.png 163 Bytes spr_example_block_grass_0.png 220 Bytes spr_example_block_grass_1.png 240 Bytes spr_example_block_grass_10.png 289 Bytes spr_example_block_grass_11.png 282 Bytes spr_example_block_grass_12.png 287 Bytes spr_example_block_grass_13.png 293 Bytes spr_example_block_grass_14.png 309 Bytes spr_example_block_grass_15.png 279 Bytes spr_example_block_grass_16.png 283 Bytes spr_example_block_grass_17.png 293 Bytes spr_example_block_grass_18.png 292 Bytes spr_example_block_grass_19.png 283 Bytes spr_example_block_grass_2.png 241 Bytes spr_example_block_grass_20.png 285 Bytes spr_example_block_grass_21.png 303 Bytes spr_example_block_grass_22.png 249 Bytes spr_example_block_grass_23.png 235 Bytes spr_example_block_grass_3.png 251 Bytes spr_example_block_grass_4.png 232 Bytes spr_example_block_grass_5.png 264 Bytes spr_example_block_grass_6.png 296 Bytes spr_example_block_grass_7.png 274 Bytes spr_example_block_grass_8.png 287 Bytes spr_example_block_grass_9.png 289 Bytes spr_example_block_iron_0.png 131 Bytes spr_example_block_iron_1.png 128 Bytes spr_example_block_iron_10.png 106 Bytes spr_example_block_iron_11.png 102 Bytes spr_example_block_iron_12.png 102 Bytes spr_example_block_iron_13.png 108 Bytes spr_example_block_iron_14.png 108 Bytes spr_example_block_iron_15.png 102 Bytes spr_example_block_iron_16.png 102 Bytes spr_example_block_iron_17.png 82 Bytes spr_example_block_iron_18.png 82 Bytes spr_example_block_iron_19.png 82 Bytes spr_example_block_iron_2.png 129 Bytes spr_example_block_iron_20.png 82 Bytes spr_example_block_iron_21.png 82 Bytes spr_example_block_iron_22.png 112 Bytes spr_example_block_iron_23.png 111 Bytes spr_example_block_iron_3.png 124 Bytes spr_example_block_iron_4.png 128 Bytes spr_example_block_iron_5.png 116 Bytes spr_example_block_iron_6.png 127 Bytes spr_example_block_iron_7.png 120 Bytes spr_example_block_iron_8.png 122 Bytes spr_example_block_iron_9.png 106 Bytes spr_example_block_leaves_0.png 261 Bytes spr_example_block_leaves_1.png 263 Bytes spr_example_block_leaves_10.png 261 Bytes spr_example_block_leaves_11.png 253 Bytes spr_example_block_leaves_12.png 253 Bytes spr_example_block_leaves_13.png 260 Bytes spr_example_block_leaves_14.png 260 Bytes spr_example_block_leaves_15.png 252 Bytes spr_example_block_leaves_16.png 252 Bytes spr_example_block_leaves_17.png 226 Bytes spr_example_block_leaves_18.png 226 Bytes spr_example_block_leaves_19.png 226 Bytes spr_example_block_leaves_2.png 265 Bytes spr_example_block_leaves_20.png 226 Bytes spr_example_block_leaves_21.png 226 Bytes spr_example_block_leaves_22.png 268 Bytes spr_example_block_leaves_23.png 253 Bytes spr_example_block_leaves_3.png 267 Bytes spr_example_block_leaves_4.png 264 Bytes spr_example_block_leaves_5.png 269 Bytes spr_example_block_leaves_6.png 264 Bytes spr_example_block_leaves_7.png 266 Bytes spr_example_block_leaves_8.png 266 Bytes spr_example_block_leaves_9.png 261 Bytes spr_example_block_stone_0.png 179 Bytes spr_example_block_stone_1.png 173 Bytes spr_example_block_stone_10.png 163 Bytes spr_example_block_stone_11.png 173 Bytes spr_example_block_stone_12.png 166 Bytes spr_example_block_stone_13.png 165 Bytes spr_example_block_stone_14.png 163 Bytes spr_example_block_stone_15.png 167 Bytes spr_example_block_stone_16.png 161 Bytes spr_example_block_stone_17.png 160 Bytes spr_example_block_stone_18.png 153 Bytes spr_example_block_stone_19.png 153 Bytes spr_example_block_stone_2.png 182 Bytes spr_example_block_stone_20.png 172 Bytes spr_example_block_stone_21.png 160 Bytes spr_example_block_stone_22.png 169 Bytes spr_example_block_stone_23.png 184 Bytes spr_example_block_stone_3.png 175 Bytes spr_example_block_stone_4.png 177 Bytes spr_example_block_stone_5.png 174 Bytes spr_example_block_stone_6.png 181 Bytes spr_example_block_stone_7.png 172 Bytes spr_example_block_stone_8.png 170 Bytes spr_example_block_stone_9.png 168 Bytes spr_example_block_wood_0.png 238 Bytes spr_example_block_wood_1.png 234 Bytes spr_example_block_wood_10.png 211 Bytes spr_example_block_wood_11.png 174 Bytes spr_example_block_wood_12.png 174 Bytes spr_example_block_wood_13.png 206 Bytes spr_example_block_wood_14.png 206 Bytes spr_example_block_wood_15.png 180 Bytes spr_example_block_wood_16.png 180 Bytes spr_example_block_wood_17.png 153 Bytes spr_example_block_wood_18.png 153 Bytes spr_example_block_wood_19.png 153 Bytes spr_example_block_wood_2.png 217 Bytes spr_example_block_wood_20.png 153 Bytes spr_example_block_wood_21.png 153 Bytes spr_example_block_wood_22.png 220 Bytes spr_example_block_wood_23.png 186 Bytes spr_example_block_wood_3.png 226 Bytes spr_example_block_wood_4.png 220 Bytes spr_example_block_wood_5.png 214 Bytes spr_example_block_wood_6.png 218 Bytes spr_example_block_wood_7.png 211 Bytes spr_example_block_wood_8.png 221 Bytes spr_example_block_wood_9.png 211 Bytes spr_example_button_gravity_0.png 174 Bytes spr_example_button_world_0.png 293 Bytes spr_example_color_select_0.png 866 Bytes spr_example_high_pressure_0.png 367 Bytes spr_example_moon_real_0.png 8.5 KB spr_example_moon_reflection_0.png 42.1 KB spr_example_player_0.png 105 Bytes spr_example_slider_0.png 245 Bytes spr_example_slider_1.png 303 Bytes spr_example_slider_2.png 278 Bytes spr_example_sun_real_0.png 23.2 KB spr_example_sun_reflection_0.png 160 KB spr_example_toggle_box_0.png 375 Bytes spr_example_toggle_box_1.png 425 Bytes spr_example_toggle_box_2.png 381 Bytes spr_example_toggle_box_3.png 431 Bytes spr_example_toggle_box_4.png 455 Bytes spr_example_toggle_box_5.png 506 Bytes spr_example_toggle_box_6.png 425 Bytes spr_example_toggle_box_7.png 474 Bytes spr_example_toggle_box_8.png 487 Bytes spr_example_toggle_box_9.png 539 Bytes spr_example_water_overlay_0.png 44.8 KB spr_example_world_background_layers_real_0.png 8.34 KB spr_example_world_background_layers_real_1.png 318 KB spr_example_world_background_layers_real_2.png 68.4 KB spr_example_world_background_layers_real_3.png 2.4 MB spr_example_world_background_layers_real_4.png 53.8 KB spr_example_world_background_layers_reflection_0.png 374 KB spr_wp_displacement_0.png 158 KB spr_wp_visualization_noise_0.png 2.25 MB spr_wp_visualization_noise_1.png 2.28 MB

What is the issue?

Back to Top