branchsbox-tabletennis-vr/mastercancel
20 Commits over 214 Days - 0.00cph!
Update README and LICENSE - anyone can learn / take code for their own s&box games
Update paddle hit physics, calculate bounce with relative ball velocity to the paddle, dont add multiplied paddle velocity to ball on bounce normal, simply transfer the velocity 1:1
Fix up debug mode so the game throws endless balls at you to return
Calculate drag properly, remember that we use kg/in³ and in/s² - fuck knows how what I was doing before worked in the slightest, this feels much better
Bounce a bit higher
Only use this paddle sound, it's cooler
Keep cleaning / refactoring, keep game logic seperated from everything else, isolate RPCs for future lag comp
Tidy up, remove any concept of serverside balls, isolate all physics logic to its own class
More sync fixes, got a better idea though
Adjust networking even more, this is very playable now, but I think I can still do better
Don't bounce on carpet, scale bounce sound w/ velocity
Client decides when it wants to take control, various other desync fixes
Haptic feedback when hitting ball
Make the ball completely clientside with a backing server entity for sync, make all of serving clientside too
Quick hack to update client values to server values when authority changes to you
Pack our ball velocity into the usercmd as well so the server/other client can take it over
Alternating client authoritative networking
* Implement an alternating client authoritative model - whichever clients side of the table the ball is on gets complete authority over the ball position and velocity.
* Physics are simulated entirely on the current authoritative client now. Pack the ball position into the UserCmd and the server sets the ball entity's position so the other client can see it and takeover when authority switches.
* Substep the physics at fixed(ish) 0.005ms steps within FrameSimulate's delta time, each step moves the ball and checks against the paddle sweep. This may be unconventional but it gives us a perfect result and never misses.
* Fix paddle collision sometimes sending the ball backwards because of a negative velocity length, added an abs.
Bounce particle goes on the hit pos, don't follow the ball you silly bugger
Use HitPosition instead of EndPosition on our sweep traces
Sweep trace the paddle into the ball, way way more reliable, setup a nice cylinder hull for the paddle too
Better physics, account for paddle angular velocity, original ball velocity reflects, and resolve movement after we've been hit instead of before
setting default map and removing something redundant
set ident to facepunch.tabletennis
Can drop the ball with your left hand by pressing X, and transfer paddle velocity into the ball on hit. Need to do this better by figuring out local velocity of the point from the angular velocity of the paddle.
Move the paddle a bit further down so you're actually holding it
Make surface assets for the ball, paddle and wood with realistic restitution values (can you hook these up to the models/materials @bakscratch)
Tidy up our physics code a bit and use the restitution coefficients
Set MaxPlayers to 2
Oops, make sure it's this paddle that's colliding with the ball
Put different client pawns at the end of each table
how'd I cock this up
Improve VR anchor positions
Turn the paddle around, black side is back hand I think?
Better test camera position & fov so I can see wtf is going on
Add a PlayerPawn which has a Paddle which tracks the ActiveBall
Paddle hits the ball from a Simulated context, if the ball hit the paddle it'd be shite, do this from Simulate so it can be predicted/clientside authorative
Also get some bounce / hit sounds going
Hook our paddles up to Input.VR.RightHand and set our anchor position, can whack balls in VR now
Initial commit
Base empty s&box game
Some basic table tennis physics with accurate gravity, mass, bounce factor and some air drag.