Pottus / ColAndreas

Collision Plugin For San Andreas Multiplayer
GNU General Public License v3.0
72 stars 44 forks source link

Water mesh is too small #29

Open IstuntmanI opened 7 years ago

IstuntmanI commented 7 years ago

In "src/WaterArray.h":

{ -10000.0, 10000.0, 0.0, 3000.0, 10000.0, 0.0, -10000.0, 3000.0, 0.0 },
{ 3000.0, 10000.0, 0.0, 10000.0, 10000.0, 0.0, 10000.0, -3000.0, 0.0 },
{ 10000.0, -3000.0, 0.0, 10000.0, -10000.0, 0.0, -3000.0, -10000.0, 0.0 },
{ -10000.0, 3000.0, 0.0, -10000.0, -10000.0, 0.0, -3000.0, -10000.0, 0.0 },
{ -10000.0, 3000.0, 0.0, 3000.0, 10000.0, 0.0, 3000.0, 3000.0, 0.0 },
{ 3000.0, 10000.0, 0.0, 10000.0, -3000.0, 0.0, 3000.0, -3000.0, 0.0 },
{ -3000.0, -3000.0, 0.0, 10000.0, -3000.0, 0.0, -3000.0, -10000.0, 0.0 },
{ -10000.0, 3000.0, 0.0, -3000.0, 3000.0, 0.0, -3000.0, -10000.0, 0.0 }

All those +- 10000 values should be set to infinity. By default, the world boundaries are ( -20000, -20000, 20000, 20000 ), so players can go behind those +- 10000 values by default. World boundaries could be increased, so I think that this would be ok:

{ - ( ( float ) 0x7F800000 ), ( float ) 0x7F800000, 0.0, 3000.0, ( float ) 0x7F800000, 0.0, - ( ( float ) 0x7F800000 ), 3000.0, 0.0 },
{ 3000.0, ( float ) 0x7F800000, 0.0, ( float ) 0x7F800000, ( float ) 0x7F800000, 0.0, ( float ) 0x7F800000, -3000.0, 0.0 },
{ ( float ) 0x7F800000, -3000.0, 0.0, ( float ) 0x7F800000, - ( ( float ) 0x7F800000 ), 0.0, -3000.0, - ( ( float ) 0x7F800000 ), 0.0 },
{ - ( ( float ) 0x7F800000 ), 3000.0, 0.0, - ( ( float ) 0x7F800000 ), - ( ( float ) 0x7F800000 ), 0.0, -3000.0, - ( ( float ) 0x7F800000 ), 0.0 },
{ - ( ( float ) 0x7F800000 ), 3000.0, 0.0, 3000.0, ( float ) 0x7F800000, 0.0, 3000.0, 3000.0, 0.0 },
{ 3000.0, ( float ) 0x7F800000, 0.0, ( float ) 0x7F800000, -3000.0, 0.0, 3000.0, -3000.0, 0.0 },
{ -3000.0, -3000.0, 0.0, ( float ) 0x7F800000, -3000.0, 0.0, -3000.0, - ( ( float ) 0x7F800000 ), 0.0 },
{ - ( ( float ) 0x7F800000 ), 3000.0, 0.0, -3000.0, 3000.0, 0.0, -3000.0, - ( ( float ) 0x7F800000 ), 0.0 }

or a bit nicer:

// top
#define FLOAT_INFINITY ( ( float ) 0x7F800000 )

// array
{ -FLOAT_INFINITY, FLOAT_INFINITY, 0.0, 3000.0, FLOAT_INFINITY, 0.0, -FLOAT_INFINITY, 3000.0, 0.0 },
{ 3000.0, FLOAT_INFINITY, 0.0, FLOAT_INFINITY, FLOAT_INFINITY, 0.0, FLOAT_INFINITY, -3000.0, 0.0 },
{ FLOAT_INFINITY, -3000.0, 0.0, FLOAT_INFINITY, -FLOAT_INFINITY, 0.0, -3000.0, -FLOAT_INFINITY, 0.0 },
{ -FLOAT_INFINITY, 3000.0, 0.0, -FLOAT_INFINITY, -FLOAT_INFINITY, 0.0, -3000.0, -FLOAT_INFINITY, 0.0 },
{ -FLOAT_INFINITY, 3000.0, 0.0, 3000.0, FLOAT_INFINITY, 0.0, 3000.0, 3000.0, 0.0 },
{ 3000.0, FLOAT_INFINITY, 0.0, FLOAT_INFINITY, -3000.0, 0.0, 3000.0, -3000.0, 0.0 },
{ -3000.0, -3000.0, 0.0, FLOAT_INFINITY, -3000.0, 0.0, -3000.0, -FLOAT_INFINITY, 0.0 },
{ -FLOAT_INFINITY, 3000.0, 0.0, -3000.0, 3000.0, 0.0, -3000.0, -FLOAT_INFINITY, 0.0 }

By the way, I downloaded the latest colandreas.inc from the Releases page and it is bugged. Also, files should come in an archive, just like the previous version.

Crayder commented 7 years ago

By the way, I downloaded the latest colandreas.inc from the Releases page and it is bugged. Also, files should come in an archive, just like the previous version.

Yeah for some reason GitHub keeps appending the old include when I upload a new one. Even when I delete and reupload it. I've tried many times!

Crayder commented 7 years ago

And about the water, not sure if infinite polygons are a great idea. If anything I think we should set them to 20000.0. That is the boundary we should all stay in no matter what.

IstuntmanI commented 7 years ago

Well, you could test infinite polygons for the water mesh. This would be the proper way to do it, as the margin water is most probably infinite in GTA. I think that bulletPhysics supports that. If you won't make it infinite, make it 30000.0, just in case. I don't think too many developers extended the world boundaries past 20000.0. Those boundaries aren't a solid wall, but something that is pushing you back, so the limit should be at least 20050.0 I guess (maybe you could push the limit a bit with an airplane ? didn't test that).

Crayder commented 7 years ago

Players can go past the boundary no problem, the problem is the syncing bugs and slight side effects that occur past 20000. It's best to stick to these boundaries not to encourage going past it. Bullet can most definitely support infinite it's just not really recommended within SA-MP. I'd be fine with setting the boundary to 20000 though.