20 Commits

Author SHA1 Message Date
e2f1850987 move VarInt.cpp
All checks were successful
Linux arm64 / Build (push) Successful in 4m47s
2024-04-15 17:02:47 +02:00
95e6967d0d fart sound on death
All checks were successful
Linux arm64 / Build (push) Successful in 4m29s
2024-04-15 16:53:44 +02:00
b2323d2761 Update MainRenderer.cpp to load GLB model for the world with better map
All checks were successful
Linux arm64 / Build (push) Successful in 4m36s
2024-04-15 16:40:58 +02:00
84ae607cd1 footsteps velocity
All checks were successful
Linux arm64 / Build (push) Successful in 4m27s
2024-04-15 16:05:28 +02:00
e254d677d0 add foosteps
All checks were successful
Linux arm64 / Build (push) Successful in 4m32s
2024-04-15 15:58:45 +02:00
f0023c1b22 Update display name in ClientMain.cpp to Blitz
All checks were successful
Linux arm64 / Build (push) Successful in 4m20s
2024-04-14 22:14:06 +02:00
71600e7a8b Map with thick walls for collisions and update MainRenderer.cpp 2024-04-14 22:13:39 +02:00
b917a8d1fa fix endgame gui timers
All checks were successful
Linux arm64 / Build (push) Successful in 4m42s
2024-04-14 19:55:51 +02:00
8880056b1c move Client to client namespace
All checks were successful
Linux arm64 / Build (push) Successful in 5m17s
2024-04-14 19:27:42 +02:00
9bb5c85f41 refactor ColoredPart 2024-04-14 19:15:28 +02:00
c6c811ca17 refactor PlayerInfo 2024-04-14 19:11:08 +02:00
40c551a4dc move KeyAction to input 2024-04-14 19:06:29 +02:00
a5bb2f74dd move VarInt to protocol 2024-04-14 19:01:59 +02:00
d9cc43a7a1 rename display to input 2024-04-14 18:58:12 +02:00
9a297026cd move EMASmoother to maths 2024-04-14 18:53:22 +02:00
2f141698ad better ObjectNotifier doc 2024-04-14 18:41:56 +02:00
af5f084234 moved client listeners 2024-04-14 18:40:45 +02:00
fd61870ebe include wiki in readme
All checks were successful
Linux arm64 / Build (push) Successful in 4m28s
2024-04-14 18:13:31 +02:00
5595213f3d Add valgrind testing to readme
All checks were successful
Linux arm64 / Build (push) Successful in 4m21s
2024-04-14 13:09:59 +02:00
8158dda315 fix mainmenu client when server crashes
All checks were successful
Linux arm64 / Build (push) Successful in 4m17s
2024-04-13 19:12:34 +02:00
70 changed files with 1212 additions and 142 deletions

View File

@@ -86,3 +86,25 @@ xmake project -k compile_commands
```
Alternatively, you can install the [XMake extension](https://marketplace.visualstudio.com/items?itemName=tboox.xmake-vscode) for VsCode.
# Valgrind 🔍
We can inspect the client binary to look for memory leak.
First, switch compilation mode to valgrind :
```
xmake f -m valgrind
```
Then build and run :
```
xmake
xmake run
```
# Wiki 📚
Available [here](https://git.ale-pri.com/Blitz/Blitz/wiki)

Binary file not shown.

View File

@@ -0,0 +1,797 @@
# Blender 4.0.2
# www.blender.org
mtllib base_deambu.mtl
o sol
v -50.000000 0.150000 18.150000
v 50.000000 0.150000 18.150000
v -50.000000 0.150000 -18.150000
v 50.000000 0.150000 -18.150000
v -50.000000 0.000000 18.150000
v 50.000000 0.000000 18.150000
v -50.000000 0.000000 -18.150000
v 50.000000 0.000000 -18.150000
vn -0.0000 1.0000 -0.0000
vn -0.0000 -1.0000 -0.0000
vn -1.0000 -0.0000 -0.0000
vn -0.0000 -0.0000 1.0000
vn 1.0000 -0.0000 -0.0000
vn -0.0000 -0.0000 -1.0000
vt 0.000000 0.000000
vt 1.000000 0.000000
vt 1.000000 1.000000
vt 0.000000 1.000000
s 0
f 1/1/1 2/2/1 4/3/1 3/4/1
f 5/1/2 7/4/2 8/3/2 6/2/2
f 1/1/3 3/4/3 7/4/3 5/1/3
f 2/2/4 1/1/4 5/1/4 6/2/4
f 4/3/5 2/2/5 6/2/5 8/3/5
f 3/4/6 4/3/6 8/3/6 7/4/6
o mur_dc_partie_basse
v 40.400005 0.000003 -9.649998
v -32.133335 -0.000002 -9.650001
v 40.400005 2.500000 -9.649998
v -32.133335 2.500000 -9.650001
v 40.400005 2.500000 -9.079998
v -32.133335 2.500000 -9.080001
v 40.400005 2.650000 -9.079998
v -32.133335 2.650000 -9.080001
v 40.400005 2.650000 -7.729998
v -32.133335 2.650000 -7.730001
v 40.400005 2.750000 -7.729998
v -32.133335 2.750000 -7.730001
v 40.400005 2.750000 -7.669998
v -32.133335 2.750000 -7.670001
v 40.400005 4.250000 -7.669998
v -32.133335 4.250000 -7.670001
v 40.400005 4.250000 -7.669998
v -32.133335 4.250000 -7.670001
v 40.400005 4.250000 -7.969998
v -32.133335 4.250000 -7.970001
v 40.400005 6.000000 -7.969998
v -32.133335 6.000000 -7.970001
v 40.400005 2.500000 -9.649998
v -32.133335 2.500000 -9.650001
v 40.400005 6.000000 -9.649998
v 40.400005 6.000000 -9.079998
v 40.400005 4.250000 -9.079998
v 40.400005 4.250000 -7.729998
v 40.400005 4.250000 -7.729998
v 40.400005 4.250000 -7.669998
v 40.400005 4.250000 -9.085698
v 40.400005 6.000000 -9.085698
v -32.133335 6.000000 -9.650001
v -32.133335 6.000000 -9.080001
v -32.133335 4.250000 -9.080001
v -32.133335 4.250000 -7.730001
v -32.133335 4.250000 -7.730001
v -32.133335 4.250000 -7.670001
v -32.133335 4.250000 -9.085701
v -32.133335 6.000000 -9.085701
v -50.000000 5.999996 -9.650001
v -50.000000 -0.000004 -9.650001
v 40.400005 6.000003 -9.649997
v -40.666664 5.999997 -9.650001
v -40.666668 -0.000003 -9.650001
v -32.133335 -0.000002 -9.650000
v -32.133339 5.999998 -9.650000
v -40.666664 11.999997 -9.650001
v -40.666668 -0.000003 -9.650001
v -32.133335 -0.000002 -9.650000
v -32.133339 11.999998 -9.650000
v -40.666664 5.999997 -18.150002
v -40.666668 -0.000003 -18.150002
v -32.133335 -0.000002 -18.150000
v -32.133339 5.999998 -18.150000
v 40.400005 2.500000 -9.649997
v -32.133335 2.500000 -9.650000
v -50.000000 5.999996 -18.150002
v -50.000000 -0.000004 -18.150002
v 50.000000 6.000004 -18.149998
v 50.000000 0.000004 -18.149998
v 50.000000 5.761985 18.149998
v 50.000000 0.000004 18.149998
v -50.000000 5.761978 18.150002
v -50.000000 -0.000004 18.150002
v -50.000000 6.000000 18.150002
v -50.000000 0.000000 18.150002
v -50.000000 6.000000 -18.149998
v -50.000000 0.000000 -18.149998
v 50.000000 0.000000 18.150002
v 50.000000 6.000000 18.150002
v 50.000000 0.000000 -18.149998
v 50.000000 6.000000 -18.149998
v 47.300003 6.000003 1.649999
v 47.299999 0.000003 1.649999
v 32.900002 0.000002 1.650000
v 32.900005 6.000002 1.650000
v 29.699999 0.000002 1.649999
v 29.699999 6.000002 1.649999
v 32.900002 0.000002 1.650000
v 32.900005 12.000002 1.650000
v 29.699999 0.000002 1.649999
v 29.699999 12.000002 1.649999
v 15.300000 0.000001 1.650001
v 15.299998 6.000001 1.650001
v 12.099999 0.000001 1.650001
v 12.100004 6.000001 1.650001
v 15.300000 0.000001 1.650001
v 15.299998 12.000001 1.650001
v 12.099999 0.000001 1.650001
v 12.100005 12.000001 1.650001
v -2.300000 0.000000 1.650001
v -2.300000 6.000000 1.650001
v -5.500000 -0.000000 1.650002
v -5.500001 6.000000 1.650002
v -2.300000 0.000000 1.650001
v -2.300001 12.000000 1.650001
v -5.500000 -0.000000 1.650002
v -5.500001 12.000000 1.650002
v -19.899998 -0.000001 1.650002
v -19.900000 5.999999 1.650002
v -19.899998 -0.000001 1.650002
v -19.900000 11.999998 1.650002
v -22.600000 -0.000002 1.650002
v -22.600000 11.999998 1.650002
v 32.900002 0.000002 12.316666
v 32.900005 6.000002 12.316666
v 29.699997 0.000002 12.316666
v 29.699997 6.000002 12.316666
v 15.300002 0.000001 12.316668
v 15.300000 6.000001 12.316668
v 12.099999 0.000001 12.316668
v 12.100004 6.000001 12.316668
v -2.300000 0.000000 12.316668
v -2.300001 6.000000 12.316668
v -5.500000 -0.000000 12.316668
v -5.500001 6.000000 12.316668
v 15.300000 0.000002 12.316666
v 15.300000 6.000002 12.316666
v -2.300000 0.000001 12.316668
v -2.299995 6.000001 12.316668
v -19.900000 -0.000000 12.316668
v -19.900000 6.000000 12.316668
v 45.200001 6.000003 -9.649997
v 45.199997 0.000003 -9.649997
v 45.200001 6.000003 -18.183331
v 45.199997 0.000003 -18.183331
v 45.200001 6.000003 -8.633330
v 45.199997 0.000003 -8.633330
v 40.400002 6.000003 -9.649997
v 40.399994 0.000003 -9.649997
v 40.400002 6.000003 -18.183331
v 40.399994 0.000003 -18.183331
v 47.300003 6.000003 1.649999
v 47.299999 0.000003 1.649999
v 47.300003 6.000003 12.316666
v 47.299999 0.000003 12.316666
v 32.900005 6.000004 12.316666
v 32.900002 0.000003 12.316666
v -19.899998 -0.000001 1.650002
v -19.900000 5.999999 1.650002
v -19.900000 -0.000001 12.316669
v -19.900000 5.999999 12.316669
v -23.099998 -0.000001 1.650002
v -23.100000 5.999998 1.650002
v -23.100000 -0.000001 12.316668
v -23.100000 5.999998 12.316668
v -37.500000 -0.000001 12.316668
v -37.500000 5.999999 12.316668
v -37.500000 -0.000001 1.650001
v -37.500000 5.999999 1.650001
v -23.100000 -0.000001 1.650002
v -23.100000 5.999998 1.650002
v -19.899998 -0.000001 1.650002
v -19.900000 11.999998 1.650002
v -23.099998 -0.000001 1.650002
v -23.100000 11.999998 1.650002
v -37.500000 -0.000001 1.650001
v -37.500000 11.999998 1.650001
v -40.700001 -0.000001 1.650002
v -40.700001 11.999998 1.650002
v -40.700001 -0.000001 1.650002
v -40.700001 5.999999 1.650002
v -40.700001 -0.000001 18.150002
v -40.700001 5.999999 18.150002
v -40.700001 -0.000001 1.650002
v -40.700001 5.999999 1.650002
v -40.700001 -0.000001 0.050001
v -40.700001 5.999999 0.050001
v -40.700001 -0.000001 0.050001
v -40.700001 11.999998 0.050001
v -48.166668 -0.000001 0.050001
v -48.166668 11.999998 0.050001
v -48.166668 -0.000001 6.450001
v -48.166668 11.999998 6.450001
v -40.699997 -0.000001 6.450001
v -40.699997 11.999998 6.450001
v -40.700001 -0.000001 -6.349998
v -40.700001 5.999999 -6.349998
v -48.166668 -0.000001 -6.349998
v -48.166668 5.999999 -6.349998
v -48.166668 -0.000001 0.050002
v -48.166668 5.999999 0.050002
v -40.700001 -0.000001 0.050002
v -40.700001 5.999999 0.050002
v 50.000000 5.761985 18.149998
v -50.000000 5.761978 18.150002
v 50.000000 5.761985 18.149998
v -50.000000 5.761978 18.150002
v 50.000000 5.761985 18.149998
v -50.000000 5.761978 18.150002
v 50.000000 5.761985 18.149998
v -50.000000 5.761978 18.150002
v 49.999996 5.761985 -18.157017
v -50.000000 5.761978 -18.157013
v 40.400005 0.000003 -9.659998
v -32.133335 -0.000002 -9.660001
v 40.195881 2.524495 -9.658163
v -31.929211 2.524495 -9.658166
v 40.111332 2.534641 -9.085772
v -31.844660 2.534641 -9.085774
v 40.111332 2.684641 -9.085772
v -31.844660 2.684641 -9.085774
v 40.111332 2.684641 -7.735771
v -31.844660 2.684641 -7.735775
v 40.111332 2.784641 -7.735771
v -31.844660 2.784641 -7.735775
v 40.111332 2.784641 -7.675771
v -31.844660 2.784641 -7.675775
v 40.400005 4.250000 -7.679998
v -32.133335 4.250000 -7.680001
v 40.400005 4.207573 -7.677069
v -32.133335 4.207573 -7.677072
v 40.111332 4.215359 -7.975771
v -31.844660 4.215359 -7.975775
v 40.046452 6.000000 -7.977069
v -31.779781 6.000000 -7.977072
v 40.400005 2.500000 -9.659998
v -32.133335 2.500000 -9.660001
v 39.900005 6.000000 -9.649998
v 39.900005 6.000000 -9.079998
v 39.900005 4.250000 -9.079998
v 39.900005 4.250000 -7.729998
v 39.900005 4.250000 -7.729998
v 39.900005 4.250000 -7.669998
v 39.900005 4.250000 -9.085698
v 39.900005 6.000000 -9.085698
v -31.633335 6.000000 -9.650001
v -31.633335 6.000000 -9.080001
v -31.633335 4.250000 -9.080001
v -31.633335 4.250000 -7.730001
v -31.633335 4.250000 -7.730001
v -31.633335 4.250000 -7.670001
v -31.633335 4.250000 -9.085701
v -31.633335 6.000000 -9.085701
v -50.000000 5.999996 -9.660001
v -50.000000 -0.000004 -9.660001
v 40.400005 6.000003 -9.659997
v -41.020218 5.999997 -9.657071
v -41.020222 -0.000003 -9.657071
v -31.633335 -0.000002 -9.650000
v -31.779787 5.999998 -9.657071
v -40.351173 11.953449 -9.650001
v -40.351181 0.046545 -9.650001
v -31.863012 0.050473 -9.650000
v -31.863018 11.949522 -9.650000
v -41.166664 5.999997 -18.150002
v -41.166668 -0.000003 -18.150002
v -31.633335 -0.000002 -18.150000
v -31.633341 5.999998 -18.150000
v 40.400005 2.500000 -9.659997
v -31.686121 2.500000 -9.654472
v -50.000000 5.999996 -18.160000
v -50.000000 -0.000004 -18.160000
v 50.000000 6.000004 -18.159996
v 50.000000 0.000004 -18.159996
v 50.499897 5.761985 18.149799
v 50.000000 0.000004 18.159998
v -49.500099 5.761978 18.149803
v -49.999996 -0.000004 18.160002
v -50.500000 6.000000 18.150002
v -50.500000 0.000000 18.150002
v -50.500000 6.000000 -18.149998
v -50.500000 0.000000 -18.149998
v 50.500000 0.000000 18.150002
v 50.500000 6.000000 18.150002
v 50.500000 0.000000 -18.149998
v 50.500000 6.000000 -18.149998
v 47.300007 6.000004 1.659999
v 47.300003 0.000003 1.659999
v 33.253555 0.000002 1.657071
v 33.253559 6.000002 1.657071
v 29.346449 0.000002 1.657070
v 29.346449 6.000002 1.657070
v 32.871048 0.005282 1.640056
v 32.871052 11.994722 1.640056
v 29.673853 0.005284 1.640051
v 29.673853 11.994720 1.640051
v 15.653554 0.000001 1.657072
v 15.653553 6.000001 1.657072
v 11.746446 0.000001 1.657072
v 11.746451 6.000001 1.657072
v 15.286518 0.005288 1.640043
v 15.286516 11.994714 1.640043
v 12.089335 0.005289 1.640041
v 12.089341 11.994713 1.640041
v -1.946446 0.000000 1.657072
v -1.946447 6.000000 1.657072
v -5.853553 -0.000000 1.657073
v -5.853554 6.000000 1.657073
v -2.297972 0.005289 1.640039
v -2.297973 11.994711 1.640039
v -5.495152 0.005289 1.640041
v -5.495153 11.994711 1.640041
v -19.899998 -0.000001 1.660002
v -19.899998 5.999999 1.660002
v -19.882467 0.005284 1.640046
v -19.882469 11.994713 1.640046
v -22.580095 0.005283 1.640048
v -22.580095 11.994713 1.640048
v 33.400002 0.000002 12.316666
v 33.400005 6.000002 12.316666
v 29.346443 0.000002 12.309595
v 29.346443 6.000002 12.309595
v 15.800001 0.000001 12.316668
v 15.800000 6.000001 12.316668
v 11.746446 0.000001 12.309597
v 11.746451 6.000001 12.309597
v -1.800000 0.000000 12.316668
v -1.800001 6.000000 12.316668
v -5.853553 -0.000000 12.309597
v -5.853554 6.000000 12.309597
v 15.299997 0.000002 12.306665
v 15.299997 6.000002 12.306665
v -2.300000 0.000001 12.306667
v -2.299995 6.000001 12.306667
v -19.900000 -0.000000 12.306667
v -19.900000 6.000000 12.306667
v 44.700005 6.000003 -9.649997
v 44.699997 0.000003 -9.649997
v 44.700005 6.000003 -18.183331
v 44.699997 0.000003 -18.183331
v 44.700005 6.000003 -8.633330
v 44.699997 0.000003 -8.633330
v 39.900002 6.000003 -9.649997
v 39.899998 0.000003 -9.649997
v 39.900002 6.000003 -18.183331
v 39.899998 0.000003 -18.183331
v 46.800007 6.000003 1.649999
v 46.799999 0.000003 1.649999
v 46.946449 6.000004 12.309595
v 46.946445 0.000003 12.309595
v 32.900005 6.000004 12.306665
v 32.900002 0.000003 12.306665
v -19.400000 -0.000001 1.650002
v -19.400002 5.999999 1.650002
v -19.400000 -0.000001 12.316669
v -19.400002 5.999999 12.316669
v -23.599998 -0.000001 1.650002
v -23.600000 5.999998 1.650002
v -23.453554 -0.000001 12.309597
v -23.453554 5.999998 12.309597
v -37.146446 -0.000001 12.309597
v -37.146446 5.999999 12.309597
v -37.146446 -0.000001 1.657072
v -37.146446 5.999999 1.657072
v -23.100000 -0.000001 1.660002
v -23.100000 5.999998 1.660002
v -19.882467 0.005284 1.640046
v -19.882469 11.994713 1.640046
v -23.079653 0.005283 1.640049
v -23.079655 11.994713 1.640049
v -37.467014 0.005276 1.640061
v -37.467014 11.994720 1.640061
v -40.664215 0.005274 1.640066
v -40.664215 11.994723 1.640066
v -41.200001 -0.000001 1.650002
v -41.200001 5.999998 1.650002
v -41.200001 -0.000001 18.150002
v -41.200001 5.999998 18.150002
v -41.200001 -0.000001 1.650002
v -41.200001 5.999998 1.650002
v -41.200001 -0.000001 0.050001
v -41.200001 5.999998 0.050001
v -40.658409 0.006130 0.040089
v -40.658409 11.993867 0.040089
v -48.117512 0.006122 0.040102
v -48.117512 11.993876 0.040102
v -48.136864 0.003712 6.440039
v -48.136864 11.996285 6.440039
v -40.674801 0.003714 6.440033
v -40.674801 11.996284 6.440033
v -41.053551 -0.000001 -6.342928
v -41.053551 5.999998 -6.342928
v -47.813114 -0.000001 -6.342927
v -47.813114 5.999999 -6.342927
v -47.813114 -0.000001 0.042931
v -47.813114 5.999999 0.042931
v -40.700001 -0.000001 0.040002
v -40.700001 5.999999 0.040002
v 50.000000 5.761985 18.139997
v -50.000000 5.761978 18.140001
v 50.000000 5.761985 18.139997
v -50.000000 5.761978 18.140001
v 50.000000 5.761985 18.139997
v -50.000000 5.761978 18.140001
v 50.000000 5.804412 18.142927
v -50.000000 5.804404 18.142931
v 49.999996 5.821985 -18.157017
v -50.000000 5.821978 -18.157013
vn -0.0000 -0.0000 1.0000
vn -0.0000 -1.0000 -0.0000
vn -0.0000 1.0000 -0.0000
vn 1.0000 -0.0000 -0.0000
vn -1.0000 -0.0000 -0.0000
vn -0.0000 -0.0000 -1.0000
vn -0.0000 0.0007 -1.0000
vn -0.0000 0.9998 -0.0177
vn -0.0000 -0.0029 -1.0000
vn -0.0000 0.0689 0.9976
vn -0.0000 -0.9997 -0.0261
vn -0.0000 -0.0007 -1.0000
vn -0.0000 0.0747 -0.9972
vn -0.9947 -0.0725 -0.0730
vn -0.9910 -0.1338 -0.0000
vn -0.9898 -0.1427 -0.0000
vn -0.9871 -0.0181 0.1589
vn 0.9947 -0.0725 -0.0730
vn 0.9910 -0.1338 -0.0000
vn 0.9898 -0.1427 -0.0000
vn 0.9871 -0.0181 0.1589
vn 0.0003 -0.0000 -1.0000
vn 0.9999 0.0122 0.0081
vn -0.9999 -0.0000 0.0172
vn -0.0001 -0.0004 -1.0000
vn -0.0000 0.0018 1.0000
vn -0.0002 -0.0000 1.0000
vn 0.0002 -0.0000 1.0000
vn 0.9999 -0.0000 -0.0137
vn 0.0002 -0.0000 -1.0000
vn -0.9999 -0.0000 0.0137
vn -0.9997 -0.0000 -0.0229
vn -0.0004 -0.0000 -1.0000
vn -0.0000 -0.0689 0.9976
vn -0.0000 1.0000 0.0005
vn 0.0891 0.0040 -0.9960
vn -0.0891 0.0040 -0.9960
vn -0.0200 -0.0000 -0.9998
vn 0.0200 -0.0000 -0.9998
vn -0.0538 -0.0067 -0.9985
vn 0.0538 -0.0067 -0.9985
vn -0.2612 -0.9553 -0.1384
vn 0.2612 -0.9553 -0.1384
vn 0.1191 0.9929 -0.0000
vn -0.1191 0.9929 -0.0000
vn -0.0074 -0.0011 1.0000
vn 0.0117 0.0017 -0.9999
vn -0.0074 -0.0023 1.0000
vn 0.0074 0.0023 -1.0000
vn -0.0074 -0.0025 1.0000
vn 0.0074 0.0025 -1.0000
vn 0.0440 -0.9988 -0.0197
vn -0.0117 0.0017 -0.9999
vn 0.0074 -0.0011 1.0000
vn -0.0074 0.0023 -1.0000
vn 0.0074 -0.0023 1.0000
vn -0.0074 0.0025 -1.0000
vn 0.0074 -0.0025 1.0000
vn -0.0440 -0.9988 -0.0197
vn 0.0047 0.0009 1.0000
vn 0.0196 -0.0017 -0.9998
vn -0.0196 0.0017 0.9998
vn 1.0000 -0.0000 -0.0003
vn -1.0000 -0.0000 0.0003
vt 0.791666 0.178667
vt 1.000000 0.178667
vt 1.000000 0.904000
vt 0.791667 0.904000
vt 0.000000 0.000000
vt 1.000000 0.000000
vt 1.000000 0.093333
vt 0.000000 0.093333
vt 0.000000 0.178667
vt 0.000000 0.904000
vt 1.000000 1.000000
vt 0.000000 1.000000
vt 0.000000 0.027000
vt 1.000000 0.027000
vt 1.000000 0.171000
vt 0.000000 0.171000
vt 0.000000 0.203000
vt 1.000000 0.203000
vt 1.000000 0.347000
vt 0.000000 0.347000
vt 0.000000 0.379000
vt 1.000000 0.379000
vt 1.000000 0.523000
vt 0.000000 0.523000
vt 0.000000 0.555000
vt 1.000000 0.555000
vt 1.000000 0.699000
vt 0.000000 0.699000
vt 0.000000 0.952000
vt 1.000000 0.952000
s 0
f 12/5/7 10/6/7 9/7/7 11/8/7
f 12/5/8 11/8/8 13/8/8 14/5/8
f 14/5/7 13/8/7 15/8/7 16/5/7
f 16/5/8 15/8/8 17/8/8 18/5/8
f 18/5/7 17/8/7 19/8/7 20/5/7
f 20/5/8 19/8/8 21/8/8 22/5/8
f 22/5/7 21/8/7 23/8/7 24/5/7
f 24/5/7 23/8/7 25/8/7 26/5/7
f 26/5/9 25/8/9 27/8/9 28/5/9
f 28/5/7 27/8/7 29/8/7 30/5/7
f 11/8/7 12/5/7 32/5/7 31/8/7
f 13/8/10 11/8/10 33/8/10 34/8/10
f 17/8/10 15/8/10 35/8/10 36/8/10
f 21/8/10 19/8/10 37/8/10 38/8/10
f 29/8/10 27/8/10 39/8/10 40/8/10
f 12/5/11 14/5/11 42/5/11 41/5/11
f 16/5/11 18/5/11 44/5/11 43/5/11
f 20/5/11 22/5/11 46/5/11 45/5/11
f 28/5/11 30/5/11 48/5/11 47/5/11
f 49/9/7 50/10/7 53/11/7 52/12/7
f 54/6/11 65/5/11 55/13/11 63/13/11 62/6/11
f 52/12/10 53/11/10 61/11/10 60/12/10
f 55/13/7 65/5/7 64/8/7 51/14/7
f 66/9/7 67/10/7 69/15/7 68/16/7
f 70/9/12 71/10/12 73/15/12 72/16/12
f 74/9/10 75/10/10 77/15/10 76/16/10
f 78/9/11 79/10/11 81/15/11 80/16/11
f 82/17/12 83/18/12 84/19/12 85/20/12
f 87/21/12 86/22/12 92/23/12 93/24/12
f 95/25/12 94/26/12 100/27/12 101/28/12
f 103/29/12 102/30/12 108/31/12 109/32/12
f 102/30/10 103/29/10 125/29/10 124/30/10
f 101/28/11 100/27/11 122/27/11 123/28/11
f 94/26/10 95/25/10 121/25/10 120/26/10
f 93/24/11 92/23/11 118/23/11 119/24/11
f 86/22/10 87/21/10 117/21/10 116/22/10
f 85/20/11 84/19/11 114/19/11 115/20/11
f 124/30/7 125/29/7 131/29/7 130/30/7
f 120/26/7 121/25/7 129/25/7 128/26/7
f 116/22/7 117/21/7 127/21/7 126/22/7
f 132/33/10 133/34/10 135/34/10 134/33/10
f 133/34/10 132/33/10 136/33/10 137/34/10
f 138/33/10 139/34/10 141/34/10 140/33/10
f 143/18/10 142/17/10 144/17/10 145/18/10
f 145/18/7 144/17/7 146/17/7 147/18/7
f 149/32/11 148/31/11 150/31/11 151/32/11
f 152/31/10 153/32/10 155/32/10 154/31/10
f 154/31/7 155/32/7 157/32/7 156/31/7
f 156/31/11 157/32/11 159/32/11 158/31/11
f 158/31/12 159/32/12 161/32/12 160/31/12
f 171/32/10 173/32/10 172/31/10 170/31/10
f 174/31/10 176/31/10 177/32/10 175/32/10
f 177/32/10 176/31/10 186/31/10 187/32/10
f 187/32/12 186/31/12 188/31/12 189/32/12
f 189/32/11 188/31/11 190/31/11 191/32/11
f 191/32/7 190/31/7 192/31/7 193/32/7
f 70/9/7 72/16/7 195/16/7 194/9/7
f 194/9/7 195/16/7 197/16/7 196/9/7
f 196/9/7 197/16/7 199/16/7 198/9/7
f 198/9/7 199/16/7 201/16/7 200/9/7
f 200/9/8 201/16/8 203/16/8 202/9/8
f 207/5/13 206/8/13 204/7/13 205/6/13
f 207/5/14 209/5/14 208/8/14 206/8/14
f 209/5/12 211/5/12 210/8/12 208/8/12
f 211/5/9 213/5/9 212/8/9 210/8/9
f 213/5/12 215/5/12 214/8/12 212/8/12
f 215/5/9 217/5/9 216/8/9 214/8/9
f 217/5/15 219/5/15 218/8/15 216/8/15
f 219/5/16 221/5/16 220/8/16 218/8/16
f 221/5/17 223/5/17 222/8/17 220/8/17
f 223/5/18 225/5/18 224/8/18 222/8/18
f 206/8/19 226/8/19 227/5/19 207/5/19
f 208/8/20 229/8/20 228/8/20 206/8/20
f 212/8/21 231/8/21 230/8/21 210/8/21
f 216/8/22 233/8/22 232/8/22 214/8/22
f 224/8/23 235/8/23 234/8/23 222/8/23
f 207/5/24 236/5/24 237/5/24 209/5/24
f 211/5/25 238/5/25 239/5/25 213/5/25
f 215/5/26 240/5/26 241/5/26 217/5/26
f 223/5/27 242/5/27 243/5/27 225/5/27
f 244/9/28 247/12/28 248/11/28 245/10/28
f 249/6/29 257/6/29 258/13/29 250/13/29 260/5/29
f 247/12/30 255/12/30 256/11/30 248/11/30
f 250/13/31 246/14/31 259/8/31 260/5/31
f 261/9/12 263/16/12 264/15/12 262/10/12
f 265/9/32 267/16/32 268/15/32 266/10/32
f 269/9/11 271/16/11 272/15/11 270/10/11
f 273/9/10 275/16/10 276/15/10 274/10/10
f 277/17/33 280/20/33 279/19/33 278/18/33
f 282/21/7 288/24/7 287/23/7 281/22/7
f 290/25/7 296/28/7 295/27/7 289/26/7
f 298/29/34 304/32/34 303/31/34 297/30/34
f 297/30/11 319/30/11 320/29/11 298/29/11
f 296/28/35 318/28/35 317/27/35 295/27/35
f 289/26/11 315/26/11 316/25/11 290/25/11
f 288/24/35 314/24/35 313/23/35 287/23/35
f 281/22/11 311/22/11 312/21/11 282/21/11
f 280/20/35 310/20/35 309/19/35 279/19/35
f 319/30/36 325/30/36 326/29/36 320/29/36
f 315/26/36 323/26/36 324/25/36 316/25/36
f 311/22/36 321/22/36 322/21/36 312/21/36
f 327/33/11 329/33/11 330/34/11 328/34/11
f 328/34/11 332/34/11 331/33/11 327/33/11
f 333/33/11 335/33/11 336/34/11 334/34/11
f 338/18/37 340/18/37 339/17/37 337/17/37
f 340/18/36 342/18/36 341/17/36 339/17/36
f 344/32/10 346/32/10 345/31/10 343/31/10
f 347/31/37 349/31/37 350/32/37 348/32/37
f 349/31/12 351/31/12 352/32/12 350/32/12
f 351/31/10 353/31/10 354/32/10 352/32/10
f 353/31/33 355/31/33 356/32/33 354/32/33
f 366/32/11 365/31/11 367/31/11 368/32/11
f 369/31/11 370/32/11 372/32/11 371/31/11
f 372/32/38 382/32/38 381/31/38 371/31/38
f 382/32/7 384/32/7 383/31/7 381/31/7
f 384/32/10 386/32/10 385/31/10 383/31/10
f 386/32/39 388/32/39 387/31/39 385/31/39
f 265/9/9 389/9/9 390/16/9 267/16/9
f 389/9/7 391/9/7 392/16/7 390/16/7
f 391/9/7 393/9/7 394/16/7 392/16/7
f 393/9/40 395/9/40 396/16/40 394/16/40
f 395/9/41 397/9/41 398/16/41 396/16/41
f 9/7/8 10/6/8 205/6/8 204/7/8
f 11/8/42 9/7/42 204/7/42 206/8/42
f 10/6/43 12/5/43 207/5/43 205/6/43
f 14/5/44 16/5/44 211/5/44 209/5/44
f 15/8/45 13/8/45 208/8/45 210/8/45
f 18/5/44 20/5/44 215/5/44 213/5/44
f 19/8/45 17/8/45 212/8/45 214/8/45
f 22/5/46 24/5/46 219/5/46 217/5/46
f 23/8/47 21/8/47 216/8/47 218/8/47
f 24/5/10 26/5/10 221/5/10 219/5/10
f 25/8/11 23/8/11 218/8/11 220/8/11
f 26/5/48 28/5/48 223/5/48 221/5/48
f 27/8/49 25/8/49 220/8/49 222/8/49
f 30/5/9 29/8/9 224/8/9 225/5/9
f 31/8/8 32/5/8 227/5/8 226/8/8
f 11/8/50 31/8/50 226/8/50 206/8/50
f 32/5/51 12/5/51 207/5/51 227/5/51
f 34/8/9 33/8/9 228/8/9 229/8/9
f 13/8/52 34/8/52 229/8/52 208/8/52
f 33/8/53 11/8/53 206/8/53 228/8/53
f 36/8/9 35/8/9 230/8/9 231/8/9
f 17/8/54 36/8/54 231/8/54 212/8/54
f 35/8/55 15/8/55 210/8/55 230/8/55
f 38/8/9 37/8/9 232/8/9 233/8/9
f 21/8/56 38/8/56 233/8/56 216/8/56
f 37/8/57 19/8/57 214/8/57 232/8/57
f 40/8/12 39/8/12 234/8/12 235/8/12
f 29/8/9 40/8/9 235/8/9 224/8/9
f 39/8/58 27/8/58 222/8/58 234/8/58
f 41/5/9 42/5/9 237/5/9 236/5/9
f 12/5/59 41/5/59 236/5/59 207/5/59
f 42/5/60 14/5/60 209/5/60 237/5/60
f 43/5/9 44/5/9 239/5/9 238/5/9
f 16/5/61 43/5/61 238/5/61 211/5/61
f 44/5/62 18/5/62 213/5/62 239/5/62
f 45/5/9 46/5/9 241/5/9 240/5/9
f 20/5/63 45/5/63 240/5/63 215/5/63
f 46/5/64 22/5/64 217/5/64 241/5/64
f 47/5/12 48/5/12 243/5/12 242/5/12
f 28/5/65 47/5/65 242/5/65 223/5/65
f 48/5/9 30/5/9 225/5/9 243/5/9
f 49/9/9 52/12/9 247/12/9 244/9/9
f 50/10/11 49/9/11 244/9/11 245/10/11
f 51/14/10 64/8/10 259/8/10 246/14/10
f 53/11/8 50/10/8 245/10/8 248/11/8
f 55/13/9 51/14/9 246/14/9 250/13/9
f 60/12/12 61/11/12 256/11/12 255/12/12
f 62/6/12 63/13/12 258/13/12 257/6/12
f 54/6/8 62/6/8 257/6/8 249/6/8
f 63/13/9 55/13/9 250/13/9 258/13/9
f 52/12/9 60/12/9 255/12/9 247/12/9
f 61/11/8 53/11/8 248/11/8 256/11/8
f 65/5/66 54/6/66 249/6/66 260/5/66
f 64/8/8 65/5/8 260/5/8 259/8/8
f 66/9/9 68/16/9 263/16/9 261/9/9
f 67/10/11 66/9/11 261/9/11 262/10/11
f 69/15/8 67/10/8 262/10/8 264/15/8
f 68/16/10 69/15/10 264/15/10 263/16/10
f 71/10/67 70/9/67 265/9/67 266/10/67
f 73/15/8 71/10/8 266/10/8 268/15/8
f 72/16/68 73/15/68 268/15/68 267/16/68
f 74/9/9 76/16/9 271/16/9 269/9/9
f 75/10/7 74/9/7 269/9/7 270/10/7
f 77/15/8 75/10/8 270/10/8 272/15/8
f 76/16/12 77/15/12 272/15/12 271/16/12
f 78/9/8 80/16/8 275/16/8 273/9/8
f 79/10/7 78/9/7 273/9/7 274/10/7
f 81/15/9 79/10/9 274/10/9 276/15/9
f 80/16/12 81/15/12 276/15/12 275/16/12
f 82/17/9 85/20/9 280/20/9 277/17/9
f 83/18/69 82/17/69 277/17/69 278/18/69
f 84/19/8 83/18/8 278/18/8 279/19/8
f 87/21/9 93/24/9 288/24/9 282/21/9
f 92/23/8 86/22/8 281/22/8 287/23/8
f 95/25/9 101/28/9 296/28/9 290/25/9
f 100/27/8 94/26/8 289/26/8 295/27/8
f 103/29/9 109/32/9 304/32/9 298/29/9
f 108/31/8 102/30/8 297/30/8 303/31/8
f 109/32/70 108/31/70 303/31/70 304/32/70
f 115/20/7 114/19/7 309/19/7 310/20/7
f 119/24/7 118/23/7 313/23/7 314/24/7
f 123/28/7 122/27/7 317/27/7 318/28/7
f 102/30/8 124/30/8 319/30/8 297/30/8
f 125/29/9 103/29/9 298/29/9 320/29/9
f 101/28/9 123/28/9 318/28/9 296/28/9
f 122/27/8 100/27/8 295/27/8 317/27/8
f 94/26/8 120/26/8 315/26/8 289/26/8
f 121/25/9 95/25/9 290/25/9 316/25/9
f 93/24/9 119/24/9 314/24/9 288/24/9
f 118/23/8 92/23/8 287/23/8 313/23/8
f 86/22/8 116/22/8 311/22/8 281/22/8
f 117/21/9 87/21/9 282/21/9 312/21/9
f 85/20/9 115/20/9 310/20/9 280/20/9
f 114/19/8 84/19/8 279/19/8 309/19/8
f 126/22/70 127/21/70 322/21/70 321/22/70
f 128/26/11 129/25/11 324/25/11 323/26/11
f 130/30/70 131/29/70 326/29/70 325/30/70
f 124/30/8 130/30/8 325/30/8 319/30/8
f 131/29/9 125/29/9 320/29/9 326/29/9
f 120/26/8 128/26/8 323/26/8 315/26/8
f 129/25/9 121/25/9 316/25/9 324/25/9
f 116/22/8 126/22/8 321/22/8 311/22/8
f 127/21/9 117/21/9 312/21/9 322/21/9
f 134/33/12 135/34/12 330/34/12 329/33/12
f 132/33/9 134/33/9 329/33/9 327/33/9
f 135/34/8 133/34/8 328/34/8 330/34/8
f 137/34/7 136/33/7 331/33/7 332/34/7
f 133/34/8 137/34/8 332/34/8 328/34/8
f 136/33/9 132/33/9 327/33/9 331/33/9
f 139/34/7 138/33/7 333/33/7 334/34/7
f 140/33/12 141/34/12 336/34/12 335/33/12
f 138/33/9 140/33/9 335/33/9 333/33/9
f 141/34/8 139/34/8 334/34/8 336/34/8
f 142/17/12 143/18/12 338/18/12 337/17/12
f 143/18/8 145/18/8 340/18/8 338/18/8
f 144/17/9 142/17/9 337/17/9 339/17/9
f 147/18/11 146/17/11 341/17/11 342/18/11
f 145/18/8 147/18/8 342/18/8 340/18/8
f 146/17/9 144/17/9 339/17/9 341/17/9
f 148/31/12 149/32/12 344/32/12 343/31/12
f 151/32/7 150/31/7 345/31/7 346/32/7
f 149/32/9 151/32/9 346/32/9 344/32/9
f 150/31/8 148/31/8 343/31/8 345/31/8
f 153/32/12 152/31/12 347/31/12 348/32/12
f 152/31/8 154/31/8 349/31/8 347/31/8
f 155/32/9 153/32/9 348/32/9 350/32/9
f 154/31/8 156/31/8 351/31/8 349/31/8
f 157/32/9 155/32/9 350/32/9 352/32/9
f 156/31/8 158/31/8 353/31/8 351/31/8
f 159/32/9 157/32/9 352/32/9 354/32/9
f 160/31/10 161/32/10 356/32/10 355/31/10
f 158/31/8 160/31/8 355/31/8 353/31/8
f 161/32/9 159/32/9 354/32/9 356/32/9
f 171/32/12 170/31/12 365/31/12 366/32/12
f 172/31/7 173/32/7 368/32/7 367/31/7
f 173/32/9 171/32/9 366/32/9 368/32/9
f 170/31/8 172/31/8 367/31/8 365/31/8
f 174/31/7 175/32/7 370/32/7 369/31/7
f 176/31/8 174/31/8 369/31/8 371/31/8
f 175/32/9 177/32/9 372/32/9 370/32/9
f 177/32/9 187/32/9 382/32/9 372/32/9
f 186/31/8 176/31/8 371/31/8 381/31/8
f 187/32/9 189/32/9 384/32/9 382/32/9
f 188/31/8 186/31/8 381/31/8 383/31/8
f 189/32/9 191/32/9 386/32/9 384/32/9
f 190/31/8 188/31/8 383/31/8 385/31/8
f 193/32/10 192/31/10 387/31/10 388/32/10
f 191/32/9 193/32/9 388/32/9 386/32/9
f 192/31/8 190/31/8 385/31/8 387/31/8
f 70/9/8 194/9/8 389/9/8 265/9/8
f 195/16/9 72/16/9 267/16/9 390/16/9
f 194/9/7 196/9/7 391/9/7 389/9/7
f 197/16/7 195/16/7 390/16/7 392/16/7
f 196/9/7 198/9/7 393/9/7 391/9/7
f 199/16/7 197/16/7 392/16/7 394/16/7
f 198/9/11 200/9/11 395/9/11 393/9/11
f 201/16/10 199/16/10 394/16/10 396/16/10
f 202/9/12 203/16/12 398/16/12 397/9/12
f 200/9/10 202/9/10 397/9/10 395/9/10
f 203/16/11 201/16/11 396/16/11 398/16/11

BIN
assets/sounds/fart.wav Normal file

Binary file not shown.

BIN
assets/sounds/step.wav Normal file

Binary file not shown.

View File

@@ -9,6 +9,7 @@ class GameListener {
public:
virtual void OnPlayerJoin(game::PlayerID player) {}
virtual void OnPlayerLeave(game::PlayerID player) {}
virtual void OnPlayerDeath(game::PlayerID player) {}
virtual void OnGameStateUpdate(game::GameState newState) {}
};

View File

@@ -1,6 +1,7 @@
#pragma once
namespace blitz {
namespace maths {
class EMASmoother {
private:
@@ -16,4 +17,5 @@ class EMASmoother {
void SetSmoothingTime(float t);
};
} // namespace maths
} // namespace blitz

View File

@@ -43,6 +43,8 @@ class ObjectNotifier {
/**
* \brief Notify listeners that were bound
* \param function the function to call
* \param args the parameters of the function to call
*/
template <typename Func, typename... Args>
void NotifyListeners(Func function, Args... args) const {

View File

@@ -41,6 +41,7 @@ class PacketHandler {
virtual void HandlePacket(const ConnexionInfoPacket* packet) {}
virtual void HandlePacket(const DisconnectPacket* packet) {}
virtual void HandlePacket(const KeepAlivePacket* packet) {}
virtual void HandlePacket(const PlayerDeathPacket* packet) {}
virtual void HandlePacket(const PlayerJoinPacket* packet) {}
virtual void HandlePacket(const PlayerLeavePacket* packet) {}
virtual void HandlePacket(const PlayerListPacket* packet) {}

View File

@@ -2,6 +2,7 @@
#include "packets/ConnexionInfoPacket.h"
#include "packets/DisconnectPacket.h"
#include "packets/KeepAlivePacket.h"
#include "packets/PlayerDeathPacket.h"
#include "packets/PlayerJoinPacket.h"
#include "packets/PlayerLeavePacket.h"
#include "packets/PlayerListPacket.h"

View File

@@ -7,6 +7,7 @@ class ChatPacket;
class ConnexionInfoPacket;
class DisconnectPacket;
class KeepAlivePacket;
class PlayerDeathPacket;
class PlayerJoinPacket;
class PlayerLeavePacket;
class PlayerListPacket;

View File

@@ -25,6 +25,7 @@ enum class PacketType : std::uint8_t {
// client <-- server
ConnexionInfo, /**< Corresponds to ConnexionInfoPacket */
PlayerDeath, /**< Corresponds to PlayerDeathPacket */
PlayerJoin, /**< Corresponds to PlayerJoinPacket */
PlayerLeave, /**< Corresponds to PlayerLeavePacket */
PlayerList, /**< Corresponds to PlayerListPacket */

View File

@@ -12,6 +12,8 @@ namespace blitz {
class DataBuffer;
namespace protocol {
/**
* \class VarInt
* \brief Variable-length format such that smaller numbers use fewer bytes.
@@ -55,4 +57,5 @@ class VarInt {
friend DataBuffer& operator>>(DataBuffer& in, VarInt& var);
};
} // namespace protocol
} // namespace blitz

View File

@@ -20,11 +20,11 @@ struct ColoredPart {
/**
* \brief The color of the part.
*/
Vec4f color;
Vec4f m_Color;
/**
* \brief The text of the part.
*/
std::string text;
std::string m_Text;
};
typedef std::vector<ColoredPart> ColoredText;

View File

@@ -5,7 +5,7 @@
* \brief File containing the blitz::protocol::KeepAlivePacket class
*/
#include "blitz/common/VarInt.h"
#include "blitz/protocol/VarInt.h"
#include "blitz/protocol/Protocol.h"
namespace blitz {

View File

@@ -0,0 +1,60 @@
#pragma once
/**
* \file PlayerDeathPacket.h
* \brief File containing the blitz::protocol::PlayerDeathPacket class
*/
#include "blitz/common/Defines.h"
#include "blitz/protocol/Protocol.h"
namespace blitz {
namespace protocol {
/**
* \class PlayerDeathPacket
* \brief Packet for when a player leaves the game.
* %Packet structure :
* | PacketType |
* |------------------------|
* | PacketType::PlayerDeath|
*
* | Field Name | Field Type | Notes |
* |--------------------|-------------------|-------------------------------|
* | m_PlayerID | PlayerID |The ID of the player that died |
*/
class PlayerDeathPacket : public Packet {
private:
game::PlayerID m_PlayerID;
public:
/**
* \brief Default constructor.
*/
PlayerDeathPacket() {}
/**
* \brief Constructor.
* \param playerID The ID of the player that died.
*/
PlayerDeathPacket(game::PlayerID playerID) : m_PlayerID(playerID) {}
virtual ~PlayerDeathPacket() {}
virtual DataBuffer Serialize(bool packetID = true) const;
virtual void Deserialize(DataBuffer& data);
virtual void Dispatch(PacketHandler* handler) const;
/**
* \brief Get the ID of the player that died.
* \return The ID of the player that died.
*/
game::PlayerID GetPlayerID() const {
return m_PlayerID;
}
virtual PacketType GetType() const {
return PacketType::PlayerDeath;
}
};
} // namespace protocol
} // namespace blitz

View File

@@ -17,7 +17,7 @@ namespace protocol {
* \brief Represents information about a player.
*/
struct PlayerInfo {
std::string name;
std::string m_Name;
};
typedef std::map<std::uint8_t, PlayerInfo> PlayerList;

View File

@@ -4,8 +4,8 @@
#include "blitz/misc/ObjectNotifier.h"
#include "blitz/misc/Time.h"
#include "blitz/protocol/packets/ChatPacket.h"
#include "client/Listeners.h"
#include "client/config/BlitzConfig.h"
#include "client/game/Listeners.h"
#include <cstdint>
#include <memory>
#include <string>
@@ -14,19 +14,17 @@ namespace blitz {
static const int PlayerUpdatePosRate = 50;
namespace client {
class ClientConnexion;
class ClientGame;
} // namespace client
namespace server {
class Server;
} // namespace server
namespace client {
class ClientConnexion;
class ClientGame;
// Singleton
class Client : public utils::ObjectNotifier<game::ClientListener>, public game::PlayerInputListener {
class Client : public utils::ObjectNotifier<client::ClientListener>, public client::PlayerInputListener {
private:
std::unique_ptr<server::Server> m_Server;
std::unique_ptr<client::ClientConnexion> m_Connexion;
@@ -78,4 +76,5 @@ class Client : public utils::ObjectNotifier<game::ClientListener>, public game::
void UpdatePosition(std::uint64_t delta);
};
} // namespace client
} // namespace blitz

View File

@@ -4,11 +4,10 @@
#include "blitz/network/Connexion.h"
namespace blitz {
namespace client {
class Client;
namespace client {
class ClientConnexion : public network::Connexion {
private:
Client* m_Client;

View File

@@ -13,7 +13,7 @@ typedef std::vector<ColoredPart> ColoredText;
} // namespace protocol
namespace game {
namespace client {
class PlayerInputListener {
public:
@@ -25,7 +25,7 @@ class ClientListener {
public:
virtual void OnTextChatReceived(const protocol::ColoredText& text) {}
virtual void OnSpectatorChange(game::PlayerID player) {}
virtual void OnPlayerShoot(PlayerID player, const Vec3f& position, float yaw, float pitch) {}
virtual void OnPlayerShoot(game::PlayerID player, const Vec3f& position, float yaw, float pitch) {}
virtual void OnClientPlayerJoin() {}
virtual void OnGameConfigUpdate() {}
virtual void OnGameJoin() {}

View File

@@ -1,14 +1,16 @@
#pragma once
#include "blitz/game/Listeners.h"
#include "client/Listeners.h"
#include "client/audio/AudioListener.h"
#include "client/audio/AudioSource.h"
#include "client/game/Listeners.h"
#include <map>
namespace blitz {
namespace client {
class Client;
} // namespace client
namespace game {
class Player;
@@ -19,26 +21,31 @@ namespace audio {
struct PlayerSound {
AudioSourcePtr m_Laser;
AudioSourcePtr m_FootStep;
AudioSourcePtr m_Death;
};
class AudioManager : public game::ClientListener, public game::GameListener {
class AudioManager : public client::ClientListener, public game::GameListener {
private:
Client* m_Client;
client::Client* m_Client;
game::Player* m_Player;
AudioListener m_Listener;
AudioSourcePtr m_MenuMusic;
AudioSourcePtr m_EndMusic;
AudioBufferPtr m_DeathSound;
AudioBufferPtr m_LaserSound;
AudioBufferPtr m_FootStepSound;
std::map<game::PlayerID, PlayerSound> m_PlayerSources;
public:
AudioManager(Client* client);
AudioManager(client::Client* client);
~AudioManager();
virtual void OnGameJoin() override;
virtual void OnGameLeave() override;
virtual void OnGameStateUpdate(game::GameState gameState) override;
virtual void OnClientPlayerJoin() override;
virtual void OnPlayerDeath(game::PlayerID player) override;
virtual void OnPlayerShoot(game::PlayerID player, const Vec3f& position, float yaw, float pitch) override;
virtual void OnPlayerJoin(game::PlayerID player) override;
virtual void OnPlayerLeave(game::PlayerID player) override;

View File

@@ -11,6 +11,8 @@
namespace blitz {
namespace input {
/**
* \enum KeyAction
* \brief Enum containing the key actions
@@ -24,7 +26,9 @@ enum KeyAction {
kaMax,
};
typedef std::array<int, kaMax> Keybinds;
} // namespace input
typedef std::array<int, input::kaMax> Keybinds;
/**
* \class BlitzConfig

View File

@@ -6,11 +6,10 @@
#include <vector>
namespace blitz {
namespace client {
class Client;
namespace client {
class ClientGame : public game::Game, public protocol::PacketHandler {
private:
Client* m_Client;
@@ -22,6 +21,7 @@ class ClientGame : public game::Game, public protocol::PacketHandler {
void Tick(std::uint64_t delta) override;
virtual void HandlePacket(const protocol::PlayerDeathPacket* packet) override;
virtual void HandlePacket(const protocol::PlayerJoinPacket* packet) override;
virtual void HandlePacket(const protocol::PlayerLeavePacket* packet) override;
virtual void HandlePacket(const protocol::PlayerListPacket* packet) override;

View File

@@ -1,11 +1,13 @@
#pragma once
#include "GuiWidget.h"
#include "client/display/InputManager.h"
#include "client/input/InputManager.h"
namespace blitz {
namespace client {
class Client;
} // namespace client
namespace gui {
@@ -14,7 +16,7 @@ class BlitzGui : public GuiWidget {
enum SubMenu { Main = 0 };
public:
BlitzGui(Client* client, input::InputManager& inputManager);
BlitzGui(client::Client* client, input::InputManager& inputManager);
virtual void Render() override;

View File

@@ -1,11 +1,13 @@
#pragma once
#include "GuiWidget.h"
#include "client/display/InputManager.h"
#include "client/input/InputManager.h"
namespace blitz {
namespace client {
class Client;
} // namespace client
namespace gui {
@@ -14,7 +16,7 @@ class CreateGameMenu : public GuiWidget {
input::InputManager& m_InputManager;
public:
CreateGameMenu(GuiWidget* parent, Client* client, input::InputManager& inputManager);
CreateGameMenu(GuiWidget* parent, client::Client* client, input::InputManager& inputManager);
virtual void Render() override;
};

View File

@@ -3,6 +3,11 @@
#include "GuiWidget.h"
namespace blitz {
namespace client {
class Client;
} // namespace client
namespace gui {
class CrossHair : public GuiWidget {
@@ -10,7 +15,7 @@ class CrossHair : public GuiWidget {
std::uint64_t m_CrossHairTexture;
public:
CrossHair(Client* client);
CrossHair(client::Client* client);
virtual void Render() override;
};

View File

@@ -4,13 +4,15 @@
namespace blitz {
namespace client {
class Client;
} // namespace client
namespace gui {
class FPSMenu : public GuiWidget {
public:
FPSMenu(GuiWidget* parent, Client* client) : GuiWidget(parent, client) {}
FPSMenu(GuiWidget* parent, client::Client* client) : GuiWidget(parent, client) {}
virtual void Render() override;
};

View File

@@ -2,15 +2,19 @@
#include "GuiWidget.h"
#include "client/Client.h"
#include "client/display/InputManager.h"
#include "client/input/InputManager.h"
#include <string>
#include <vector>
namespace blitz {
namespace client {
class Client;
} // namespace client
namespace gui {
class GameChatGui : public GuiWidget, game::ClientListener {
class GameChatGui : public GuiWidget, client::ClientListener {
private:
char InputBuf[256];
std::vector<protocol::ColoredText> m_Lines;
@@ -27,7 +31,7 @@ class GameChatGui : public GuiWidget, game::ClientListener {
void DrawMini(const char* title, bool* p_open);
public:
GameChatGui(GuiWidget* parent, Client* client, input::InputManager& inputManager);
GameChatGui(GuiWidget* parent, client::Client* client, input::InputManager& inputManager);
virtual ~GameChatGui();
virtual void OnTextChatReceived(const protocol::ColoredText& text) override;

View File

@@ -7,19 +7,21 @@
namespace blitz {
namespace client {
class Client;
} // namespace client
namespace gui {
class GuiWidget {
protected:
bool m_Enabled;
Client* m_Client;
client::Client* m_Client;
GuiWidget* m_Parent;
std::vector<std::unique_ptr<GuiWidget>> m_SubWidgets;
public:
GuiWidget(GuiWidget* parent, Client* client) : m_Enabled(false), m_Client(client), m_Parent(parent) {}
GuiWidget(GuiWidget* parent, client::Client* client) : m_Enabled(false), m_Client(client), m_Parent(parent) {}
virtual ~GuiWidget() {}
void Enable() {

View File

@@ -5,23 +5,30 @@
namespace blitz {
namespace client {
class Client;
} // namespace client
namespace game {
class Player;
} // namespace game
namespace gui {
class Hud : public GuiWidget {
class Hud : public GuiWidget, public game::GameListener, public client::ClientListener {
private:
std::uint64_t m_GunTexture;
std::uint64_t m_JPTexture;
utils::DelayTimer<float> m_Timer{5.0f};
public:
Hud(GuiWidget* parent, Client* client);
Hud(GuiWidget* parent, client::Client* client);
virtual ~Hud();
virtual void Render() override;
virtual void OnGameStateUpdate(game::GameState gameState) override;
virtual void OnGameJoin() override;
virtual void OnGameLeave() override;
private:
std::string FormatString();
void Draw(const char* title, bool* p_open);

View File

@@ -1,11 +1,13 @@
#pragma once
#include "GuiWidget.h"
#include "client/display/InputManager.h"
#include "client/input/InputManager.h"
namespace blitz {
namespace client {
class Client;
} // namespace client
namespace gui {
@@ -14,7 +16,7 @@ class JoinGameMenu : public GuiWidget {
input::InputManager& m_InputManager;
public:
JoinGameMenu(GuiWidget* parent, Client* client, input::InputManager& inputManager);
JoinGameMenu(GuiWidget* parent, client::Client* client, input::InputManager& inputManager);
virtual void Render() override;
};

View File

@@ -5,16 +5,24 @@
namespace blitz {
namespace client {
class Client;
} // namespace client
namespace gui {
class LeaderBoardGui : public GuiWidget {
class LeaderBoardGui : public GuiWidget, public game::GameListener, public client::ClientListener {
private:
void Draw(const char* title, bool* p_open);
utils::DelayTimer<float> m_Timer{5.0f};
public:
LeaderBoardGui(GuiWidget* parent, Client* client);
LeaderBoardGui(GuiWidget* parent, client::Client* client);
~LeaderBoardGui();
virtual void OnGameStateUpdate(game::GameState gameState) override;
virtual void OnGameJoin() override;
virtual void OnGameLeave() override;
virtual void Render() override;
};

View File

@@ -1,11 +1,13 @@
#pragma once
#include "GuiWidget.h"
#include "client/game/Listeners.h"
#include "client/Listeners.h"
namespace blitz {
namespace client {
class Client;
} // namespace client
namespace input {
class InputManager;
@@ -13,14 +15,14 @@ class InputManager;
namespace gui {
class MainMenu : public GuiWidget, public game::ClientListener {
class MainMenu : public GuiWidget, public client::ClientListener {
private:
enum SubMenu { CREATE_MENU = 0, JOIN_MENU, OPTION_MENU };
input::InputManager& m_InputManager;
public:
MainMenu(Client* client, input::InputManager& inputManager);
MainMenu(client::Client* client, input::InputManager& inputManager);
virtual ~MainMenu();
virtual void OnGameLeave() override;

View File

@@ -3,13 +3,15 @@
#include "GuiWidget.h"
#include "blitz/misc/Time.h"
#include "client/config/BlitzConfig.h"
#include "client/display/InputManager.h"
#include "client/input/InputManager.h"
#include <array>
#include <string>
namespace blitz {
namespace client {
class Client;
} // namespace client
namespace gui {
@@ -20,11 +22,11 @@ class OptionsMenu : public GuiWidget, public input::InputListener {
bool m_IsKeyPopupOpen;
bool m_KeyPopupShouldClose;
utils::Timer m_Timer{100};
KeyAction m_CurrentAction;
input::KeyAction m_CurrentAction;
input::InputManager& m_InputManager;
public:
OptionsMenu(GuiWidget* parent, Client* client, input::InputManager& inputManager);
OptionsMenu(GuiWidget* parent, client::Client* client, input::InputManager& inputManager);
virtual ~OptionsMenu();
virtual void Render() override;
@@ -32,7 +34,7 @@ class OptionsMenu : public GuiWidget, public input::InputListener {
virtual void OnKeyDown(int key) override;
private:
std::string GetKeyActionCodeName(KeyAction);
std::string GetKeyActionCodeName(input::KeyAction);
void HotkeyBindingButton();
void HotkeyBindingPopUp();
};

View File

@@ -1,9 +1,14 @@
#pragma once
#include "GuiWidget.h"
#include "client/display/InputManager.h"
#include "client/input/InputManager.h"
namespace blitz {
namespace client {
class Client;
} // namespace client
namespace gui {
class ServerGui : public GuiWidget {
@@ -11,7 +16,7 @@ class ServerGui : public GuiWidget {
input::InputManager& m_InputManager;
public:
ServerGui(GuiWidget* parent, Client* client, input::InputManager& inputManager);
ServerGui(GuiWidget* parent, client::Client* client, input::InputManager& inputManager);
virtual void Render() override;
};

View File

@@ -5,8 +5,8 @@
* \brief File containing the blitz::Display class
*/
#include "client/display/InputManager.h"
#include "client/display/PlayerController.h"
#include "client/input/InputManager.h"
#include "client/input/PlayerController.h"
#include <memory>
#include <string>
@@ -14,12 +14,16 @@ class SDL_Window;
namespace blitz {
namespace client {
class Client;
} // namespace client
namespace gui {
class BlitzGui;
} // namespace gui
namespace input {
/**
* \class Display
* \brief Class used to manage the display
@@ -37,7 +41,7 @@ class Display {
bool m_ShouldClose;
bool m_FullScreen;
Client* m_Client;
client::Client* m_Client;
input::InputManager& m_InputManager;
std::unique_ptr<gui::BlitzGui> m_BlitzGui;
input::PlayerController m_PlayerController;
@@ -51,7 +55,7 @@ class Display {
* \param client The client
* \param inputManager The InputManager
*/
Display(int width, int height, const std::string& windowName, Client* client, input::InputManager& inputManager);
Display(int width, int height, const std::string& windowName, client::Client* client, input::InputManager& inputManager);
~Display();
/**
@@ -112,4 +116,5 @@ class Display {
void InitImGui();
};
} // namespace input
} // namespace blitz

View File

@@ -5,15 +5,17 @@
* \brief File containing the blitz::input::PlayerController class.
*/
#include "blitz/common/Smoothing.h"
#include "blitz/maths/Smoothing.h"
#include "blitz/misc/ObjectNotifier.h"
#include "blitz/misc/Time.h"
#include "client/display/InputManager.h"
#include "client/game/Listeners.h"
#include "client/input/InputManager.h"
#include "client/Listeners.h"
namespace blitz {
namespace client {
class Client;
} // namespace client
namespace game {
@@ -28,14 +30,14 @@ namespace input {
* \details This class is responsible for handling player input and sending it to the server.
* It also handles the player's velocity and position.
*/
class PlayerController : public utils::ObjectNotifier<game::PlayerInputListener>, game::ClientListener, InputListener {
class PlayerController : public utils::ObjectNotifier<client::PlayerInputListener>, client::ClientListener, InputListener {
private:
game::Player* m_Player;
Client* m_Client;
client::Client* m_Client;
input::InputManager& m_InputManager;
utils::CooldownTimer<float> m_ShootTimer{1.0f};
EMASmoother m_DxSmoother;
EMASmoother m_DySmoother;
maths::EMASmoother m_DxSmoother;
maths::EMASmoother m_DySmoother;
// current (target) velocity
Vec3f m_Velocity;
/// maximum x-axis velocity
@@ -47,7 +49,7 @@ class PlayerController : public utils::ObjectNotifier<game::PlayerInputListener>
/**
* \brief Default constructor
*/
PlayerController(Client* client, input::InputManager& inputManager);
PlayerController(client::Client* client, input::InputManager& inputManager);
virtual ~PlayerController();
/**

View File

@@ -1,7 +1,6 @@
#pragma once
#include "client/Client.h"
#include "client/display/PlayerController.h"
#include "client/input/PlayerController.h"
#include "client/render/BulletRenderer.h"
#include "client/render/Camera.h"
#include "client/render/loader/GLLoader.h"
@@ -9,6 +8,10 @@
namespace blitz {
namespace client {
class Client;
} // namespace client
namespace shader {
class EntityShader;
@@ -20,9 +23,9 @@ class GunShader;
namespace render {
class MainRenderer : public game::ClientListener, public game::PlayerInputListener {
class MainRenderer : public client::ClientListener, public client::PlayerInputListener {
private:
Client* m_Client;
client::Client* m_Client;
ModelLoader::Model m_PlayerModel;
ModelLoader::Model m_WorldModel;
ModelLoader::Model m_GunModel;
@@ -36,7 +39,7 @@ class MainRenderer : public game::ClientListener, public game::PlayerInputListen
input::PlayerController& m_PlayerController;
public:
MainRenderer(Client* client, input::PlayerController& playerController);
MainRenderer(client::Client* client, input::PlayerController& playerController);
~MainRenderer();
virtual void OnSpectatorChange(game::PlayerID player) override;

View File

@@ -1,15 +1,15 @@
#include "blitz/network/Network.h"
#include "client/Client.h"
#include "client/audio/AudioManager.h"
#include "client/display/Display.h"
#include "client/display/InputManager.h"
#include "client/input/Display.h"
#include "client/input/InputManager.h"
#include "client/render/MainRenderer.h"
int main(int argc, char** argv) {
blitz::Client client;
blitz::client::Client client;
blitz::input::InputManager inputManager;
blitz::Display display(1920, 1080, "BlitzKrieg", &client, inputManager);
blitz::input::Display display(1920, 1080, "Blitz", &client, inputManager);
if (!display.Create())
return EXIT_FAILURE;

View File

@@ -1,8 +1,9 @@
#include "blitz/common/Smoothing.h"
#include "blitz/maths/Smoothing.h"
#include <cassert>
#include <cmath>
namespace blitz {
namespace maths {
EMASmoother::EMASmoother() : Alpha(1.0f), Current(0.0f) {}
@@ -27,4 +28,5 @@ void EMASmoother::SetSmoothingTime(float t) {
SetAlpha(std::pow(1.0f - 0.999f, 1.0f / t));
};
} // namespace maths
} // namespace blitz

View File

@@ -1,6 +1,6 @@
#include "blitz/misc/Compression.h"
#include "blitz/common/VarInt.h"
#include "blitz/protocol/VarInt.h"
#include <cassert>
#include <zlib.h>
@@ -37,7 +37,7 @@ DataBuffer Compress(const DataBuffer& buffer) {
if (buffer.GetSize() < COMPRESSION_THRESHOLD) {
// Don't compress since it's a small packet
VarInt compressedDataLength = 0;
protocol::VarInt compressedDataLength = 0;
std::uint64_t packetLength = compressedDataLength.GetSerializedLength() + buffer.GetSize();
packet << packetLength;
@@ -48,7 +48,7 @@ DataBuffer Compress(const DataBuffer& buffer) {
DataBuffer compressedData = Deflate(buffer.data(), buffer.GetSize());
VarInt uncompressedDataLength = buffer.GetSize();
protocol::VarInt uncompressedDataLength = buffer.GetSize();
std::uint64_t packetLength = uncompressedDataLength.GetSerializedLength() + compressedData.GetSize();
packet << packetLength;
@@ -58,7 +58,7 @@ DataBuffer Compress(const DataBuffer& buffer) {
}
DataBuffer Decompress(DataBuffer& buffer, std::uint64_t packetLength) {
VarInt uncompressedLength;
protocol::VarInt uncompressedLength;
buffer >> uncompressedLength;
std::uint64_t compressedLength = packetLength - uncompressedLength.GetSerializedLength();

View File

@@ -150,7 +150,7 @@ std::size_t TCPSocket::Receive(DataBuffer& buffer, std::size_t amount) {
Disconnect();
buffer.Clear();
m_Status = Status::Error;
SetStatus(Status::Error);
return 0;
}
buffer.Resize(static_cast<std::size_t>(recvAmount));

View File

@@ -15,6 +15,7 @@ static std::array<PacketCreator, static_cast<std::size_t>(PacketType::PACKET_COU
[]() -> PacketPtr { return std::make_unique<PlayerLoginPacket>(); },
[]() -> PacketPtr { return std::make_unique<UpdateHealthPacket>(); },
[]() -> PacketPtr { return std::make_unique<ConnexionInfoPacket>(); },
[]() -> PacketPtr { return std::make_unique<PlayerDeathPacket>(); },
[]() -> PacketPtr { return std::make_unique<PlayerJoinPacket>(); },
[]() -> PacketPtr { return std::make_unique<PlayerLeavePacket>(); },
[]() -> PacketPtr { return std::make_unique<PlayerListPacket>(); },

View File

@@ -17,6 +17,7 @@ void Packet::WritePacketID(DataBuffer& data, bool packetID) const {
REGISTER_DISPATCH_CLASS(PlayerLoginPacket)
REGISTER_DISPATCH_CLASS(KeepAlivePacket)
REGISTER_DISPATCH_CLASS(PlayerListPacket)
REGISTER_DISPATCH_CLASS(PlayerDeathPacket);
REGISTER_DISPATCH_CLASS(PlayerJoinPacket)
REGISTER_DISPATCH_CLASS(PlayerLeavePacket)
REGISTER_DISPATCH_CLASS(ConnexionInfoPacket)

View File

@@ -1,9 +1,10 @@
#include "blitz/common/VarInt.h"
#include "blitz/protocol/VarInt.h"
#include "blitz/common/DataBuffer.h"
#include <stdexcept>
namespace blitz {
namespace protocol {
static constexpr int SEGMENT_BITS = 0x7F;
static constexpr int CONTINUE_BIT = 0x80;
@@ -49,4 +50,5 @@ DataBuffer& operator>>(DataBuffer& in, VarInt& var) {
return in;
}
} // namespace protocol
} // namespace blitz

View File

@@ -1,6 +1,6 @@
#include "blitz/protocol/packets/ChatPacket.h"
#include "blitz/common/VarInt.h"
#include "blitz/protocol/VarInt.h"
#include "blitz/maths/Vector.h"
#include "blitz/misc/Log.h"
#include <map>
@@ -26,7 +26,7 @@ DataBuffer ChatPacket::Serialize(bool packetID) const {
data << VarInt{m_Message.size()};
for (const auto& part : m_Message) {
data << part.color << part.text;
data << part.m_Color << part.m_Text;
}
return data;
}
@@ -38,7 +38,7 @@ void ChatPacket::Deserialize(DataBuffer& data) {
m_Message.resize(partsNumber.GetValue());
for (std::size_t i = 0; i < partsNumber.GetValue(); ++i) {
data >> m_Message[i].color >> m_Message[i].text;
data >> m_Message[i].m_Color >> m_Message[i].m_Text;
}
}
@@ -139,10 +139,10 @@ std::string ChatPacket::GetColoredTextString(const ColoredText& text) {
std::string result;
for (auto& part : text) {
result += GetTextColor({static_cast<std::uint8_t>(part.color.x * 255), static_cast<std::uint8_t>(part.color.y * 255),
static_cast<std::uint8_t>(part.color.z * 255)})
result += GetTextColor({static_cast<std::uint8_t>(part.m_Color.x * 255), static_cast<std::uint8_t>(part.m_Color.y * 255),
static_cast<std::uint8_t>(part.m_Color.z * 255)})
.c_str();
result += part.text.c_str();
result += part.m_Text.c_str();
}
return result;

View File

@@ -1,6 +1,6 @@
#include "blitz/protocol/packets/KeepAlivePacket.h"
#include "blitz/common/VarInt.h"
#include "blitz/protocol/VarInt.h"
namespace blitz {
namespace protocol {

View File

@@ -0,0 +1,20 @@
#include "blitz/protocol/packets/PlayerDeathPacket.h"
namespace blitz {
namespace protocol {
DataBuffer PlayerDeathPacket::Serialize(bool packetID) const {
DataBuffer data;
WritePacketID(data, packetID);
data << m_PlayerID;
return data;
}
void PlayerDeathPacket::Deserialize(DataBuffer& data) {
data >> m_PlayerID;
}
} // namespace protocol
} // namespace blitz

View File

@@ -1,6 +1,6 @@
#include "blitz/protocol/packets/PlayerListPacket.h"
#include "blitz/common/VarInt.h"
#include "blitz/protocol/VarInt.h"
namespace blitz {
namespace protocol {
@@ -11,7 +11,7 @@ DataBuffer PlayerListPacket::Serialize(bool packetID) const {
WritePacketID(data, packetID);
data << VarInt(m_Players.size());
for (auto [playerID, playerInfo] : m_Players) {
data << playerID << playerInfo.name;
data << playerID << playerInfo.m_Name;
}
return data;
}
@@ -23,7 +23,7 @@ void PlayerListPacket::Deserialize(DataBuffer& data) {
for (std::size_t i = 0; i < playerCount.GetValue(); i++) {
std::uint8_t playerID;
PlayerInfo playerInfo;
data >> playerID >> playerInfo.name;
data >> playerID >> playerInfo.m_Name;
m_Players.insert({playerID, playerInfo});
}
}

View File

@@ -11,18 +11,19 @@
#include <cassert>
namespace blitz {
namespace client {
Client::Client() :
m_Server(std::make_unique<server::Server>()),
m_Connexion(std::make_unique<client::ClientConnexion>(this)),
m_Game(std::make_unique<client::ClientGame>(this, m_Connexion->GetDispatcher())) {}
m_Connexion(std::make_unique<ClientConnexion>(this)),
m_Game(std::make_unique<ClientGame>(this, m_Connexion->GetDispatcher())) {}
Client::~Client() {
Disconnect();
}
void Client::Update() {
if (m_Connexion->GetSocketStatus() != network::TCPSocket::Status::Connected)
if (m_Connexion->GetSocketStatus() == network::TCPSocket::Status::Disconnected)
return;
if (m_Connexion->UpdateSocket()) {
@@ -62,7 +63,7 @@ bool Client::CreateGame(std::uint16_t port, const std::string& pseudo) {
}
void Client::Disconnect() {
if (m_Connexion->GetSocketStatus() != network::TCPSocket::Status::Connected)
if (m_Connexion->GetSocketStatus() == network::TCPSocket::Status::Disconnected)
return;
protocol::DisconnectPacket packet("Client wants to leave !");
@@ -75,7 +76,7 @@ void Client::Disconnect() {
}
m_Connexion->CloseConnection();
NotifyListeners(&game::ClientListener::OnGameLeave);
NotifyListeners(&client::ClientListener::OnGameLeave);
Reset();
}
@@ -96,7 +97,7 @@ void Client::SendChatText(const std::string& text) {
}
void Client::ChatTextReceived(const protocol::ColoredText& text) {
NotifyListeners(&game::ClientListener::OnTextChatReceived, text);
NotifyListeners(&client::ClientListener::OnTextChatReceived, text);
}
void Client::SendPlayerPosAndLook(const Vec3f& position, float yaw, float pitch) {
@@ -134,4 +135,5 @@ void Client::UpdatePosition(std::uint64_t delta) {
}
}
} // namespace client
} // namespace blitz

View File

@@ -16,9 +16,9 @@ namespace client {
static std::string PrintColoredText(const protocol::ColoredText& coloredText) {
std::string text;
for (const auto& part : coloredText) {
text += utils::GetTextColor({static_cast<std::uint8_t>(part.color.r * 255), static_cast<std::uint8_t>(part.color.g * 255),
static_cast<std::uint8_t>(part.color.b * 255)}) +
part.text;
text += utils::GetTextColor({static_cast<std::uint8_t>(part.m_Color.r * 255), static_cast<std::uint8_t>(part.m_Color.g * 255),
static_cast<std::uint8_t>(part.m_Color.b * 255)}) +
part.m_Text;
}
text += utils::GetTextColorReset();
return text;
@@ -54,7 +54,7 @@ void ClientConnexion::HandlePacket(const protocol::ChatPacket* packet) {
void ClientConnexion::HandlePacket(const protocol::DisconnectPacket* packet) {
utils::LOG("[ClientConnexion] Disconnected ! Reason : " + packet->GetReason());
m_Client->NotifyListeners(&game::ClientListener::OnGameLeave);
m_Client->NotifyListeners(&client::ClientListener::OnGameLeave);
m_Client->Disconnect();
}

View File

@@ -9,7 +9,7 @@
namespace blitz {
namespace audio {
AudioManager::AudioManager(Client* client) : m_Client(client), m_Player(nullptr) {
AudioManager::AudioManager(client::Client* client) : m_Client(client), m_Player(nullptr) {
m_Listener.SetGain(1.0f);
InitSounds();
m_MenuMusic->Play();
@@ -27,6 +27,25 @@ void AudioManager::Update() {
m_Listener.SetPosition(m_Player->GetPosition());
m_Listener.SetOrientation(maths::GetDirectionVectorFromRotation(m_Player->GetYaw(), m_Player->GetPitch()), {0.0f, 1.0f, 0.0f});
m_Listener.SetVelocity(m_Player->GetVelocity());
for (const auto& [playerID, player] : m_Client->GetGame()->GetPlayers()) {
auto it = m_PlayerSources.find(playerID);
if (it == m_PlayerSources.end()) {
utils::LOGD("[AudioManager] No sound found for player " + std::to_string(playerID) + " !");
continue;
}
Vec3f horizontalVelocity = {player.GetVelocity().x, 0.0f, player.GetVelocity().z};
PlayerSound& playerSounds = it->second;
if (player.GetPosition().y <= 0.1f && maths::Length(horizontalVelocity) > 0.02f) {
playerSounds.m_FootStep->SetPosition(player.GetPosition());
playerSounds.m_FootStep->SetVelocity(player.GetVelocity());
if (playerSounds.m_FootStep->GetSourceState() != AudioSource::ssPlaying)
playerSounds.m_FootStep->Play();
}
}
}
AudioSourcePtr AudioManager::InitSourceFromFile(const std::string& fileName) {
@@ -56,6 +75,8 @@ void AudioManager::InitSounds() {
m_EndMusic = InitSourceFromFile("sounds/jazz.wav");
m_DeathSound = InitBufferFromFile("sounds/fart.wav");
m_FootStepSound = InitBufferFromFile("sounds/step.wav");
m_LaserSound = InitBufferFromFile("sounds/laser.wav");
}
@@ -64,6 +85,22 @@ void AudioManager::OnGameJoin() {
m_Client->GetGame()->BindListener(this);
}
void AudioManager::OnPlayerDeath(game::PlayerID playerID) {
auto it = m_PlayerSources.find(playerID);
if (it == m_PlayerSources.end()) {
utils::LOGD("[AudioManager] No sound found for player " + std::to_string(playerID) + " !");
return;
}
game::Player* player = m_Client->GetGame()->GetPlayerById(playerID);
assert(player);
PlayerSound& playerSounds = it->second;
playerSounds.m_Death->SetPosition(player->GetPosition());
playerSounds.m_Death->Play();
}
void AudioManager::OnGameLeave() {
m_MenuMusic->Play();
m_EndMusic->Stop();
@@ -73,7 +110,7 @@ void AudioManager::OnGameLeave() {
}
void AudioManager::OnGameStateUpdate(game::GameState gameState) {
if(gameState == game::gsEnd)
if (gameState == game::gsEnd)
m_EndMusic->Play();
}
@@ -82,7 +119,8 @@ void AudioManager::OnClientPlayerJoin() {
}
void AudioManager::OnPlayerJoin(game::PlayerID player) {
m_PlayerSources.insert({player, PlayerSound{InitSourceFromBuffer(m_LaserSound)}});
m_PlayerSources.insert({player,
PlayerSound{InitSourceFromBuffer(m_LaserSound), InitSourceFromBuffer(m_FootStepSound), InitSourceFromBuffer(m_DeathSound)}});
}
void AudioManager::OnPlayerLeave(game::PlayerID player) {

View File

@@ -3,6 +3,7 @@
#include "blitz/misc/Log.h"
#include "blitz/misc/Random.h"
#include "blitz/protocol/PacketDispatcher.h"
#include "blitz/protocol/packets/PlayerDeathPacket.h"
#include "blitz/protocol/packets/PlayerJoinPacket.h"
#include "blitz/protocol/packets/PlayerLeavePacket.h"
#include "blitz/protocol/packets/PlayerListPacket.h"
@@ -36,6 +37,7 @@ void ClientGame::RemovePlayer(game::PlayerID player) {
}
void ClientGame::RegisterHandlers() {
GetDispatcher()->RegisterHandler(protocol::PacketType::PlayerDeath, this);
GetDispatcher()->RegisterHandler(protocol::PacketType::PlayerJoin, this);
GetDispatcher()->RegisterHandler(protocol::PacketType::PlayerLeave, this);
GetDispatcher()->RegisterHandler(protocol::PacketType::PlayerList, this);
@@ -47,18 +49,22 @@ void ClientGame::RegisterHandlers() {
GetDispatcher()->RegisterHandler(protocol::PacketType::ServerConfig, this);
}
void ClientGame::HandlePacket(const protocol::PlayerDeathPacket* packet) {
NotifyListeners(&game::GameListener::OnPlayerDeath, packet->GetPlayerID());
}
void ClientGame::HandlePacket(const protocol::PlayerJoinPacket* packet) {
if (packet->GetPlayerID() == m_Client->GetPlayerID()) {
m_Client->NotifyListeners(&game::ClientListener::OnGameJoin);
m_Client->NotifyListeners(&client::ClientListener::OnGameJoin);
}
AddPlayer(packet->GetPlayerID(), packet->GetPlayerName());
// Initialize camera
if (packet->GetPlayerID() == m_Client->GetPlayerID()) {
m_Client->NotifyListeners(&game::ClientListener::OnSpectatorChange, packet->GetPlayerID());
m_Client->NotifyListeners(&game::ClientListener::OnClientPlayerJoin);
m_Client->NotifyListeners(&client::ClientListener::OnSpectatorChange, packet->GetPlayerID());
m_Client->NotifyListeners(&client::ClientListener::OnClientPlayerJoin);
}
}
@@ -68,7 +74,7 @@ void ClientGame::HandlePacket(const protocol::PlayerLeavePacket* packet) {
void ClientGame::HandlePacket(const protocol::PlayerListPacket* packet) {
for (const auto& [playerID, playerInfo] : packet->GetPlayers()) {
AddPlayer(playerID, playerInfo.name);
AddPlayer(playerID, playerInfo.m_Name);
}
}
@@ -87,6 +93,7 @@ void ClientGame::HandlePacket(const protocol::UpdateHealthPacket* packet) {
// we are dead
if (player->GetHP() <= 0.0f) {
NotifyListeners(&game::GameListener::OnPlayerDeath, player->GetID());
player->SetPosition({utils::GetRandomReal(-10.0f, 10.0f), 0, utils::GetRandomReal(-10.0f, 10.0f)});
}
}
@@ -97,12 +104,12 @@ void ClientGame::HandlePacket(const protocol::UpdateGameStatePacket* packet) {
void ClientGame::HandlePacket(const protocol::ServerConfigPacket* packet) {
m_Config = packet->GetGameConfig();
m_Client->NotifyListeners(&game::ClientListener::OnGameConfigUpdate);
m_Client->NotifyListeners(&client::ClientListener::OnGameConfigUpdate);
}
void ClientGame::HandlePacket(const protocol::PlayerShootPacket* packet) {
m_Client->NotifyListeners(
&game::ClientListener::OnPlayerShoot, packet->GetPlayer(), packet->GetPosition(), packet->GetYaw(), packet->GetPitch());
&client::ClientListener::OnPlayerShoot, packet->GetPlayer(), packet->GetPosition(), packet->GetYaw(), packet->GetPitch());
}
void ClientGame::HandlePacket(const protocol::PlayerPositionAndRotationPacket* packet) {
@@ -121,6 +128,9 @@ void ClientGame::HandlePacket(const protocol::PlayerPositionAndRotationPacket* p
void ClientGame::Tick(std::uint64_t delta) {
for (auto& [playerId, player] : GetPlayers()) {
// already handled by PlayerController
if (playerId == m_Client->GetPlayerID())
continue;
player.SetPosition(player.GetPosition() + player.GetVelocity() * (static_cast<float>(delta) / 100.0f));
}
if (m_GameTimer.GetInterval() > 0) {

View File

@@ -11,7 +11,7 @@
namespace blitz {
namespace gui {
BlitzGui::BlitzGui(Client* client, input::InputManager& inputManager) : GuiWidget(nullptr, client) {
BlitzGui::BlitzGui(client::Client* client, input::InputManager& inputManager) : GuiWidget(nullptr, client) {
Enable();
AddWidget(std::make_unique<GameChatGui>(this, client, inputManager));
AddWidget(std::make_unique<MainMenu>(client, inputManager));

View File

@@ -12,7 +12,7 @@ void RenderColorfulText(const protocol::ColoredText& parts, float alpha) {
const bool need_backup = (g.CurrentWindow->DC.TextWrapPos < 0.0f); // Keep existing wrap position if one is already set
if (need_backup)
ImGui::PushTextWrapPos(0.0f);
ImGui::TextColored({part.color.r, part.color.g, part.color.b, alpha}, "%s", part.text.c_str());
ImGui::TextColored({part.m_Color.r, part.m_Color.g, part.m_Color.b, alpha}, "%s", part.m_Text.c_str());
if (need_backup)
ImGui::PopTextWrapPos();
ImGui::SameLine();

View File

@@ -10,7 +10,7 @@
namespace blitz {
namespace gui {
CreateGameMenu::CreateGameMenu(GuiWidget* parent, Client* client, input::InputManager& inputManager) :
CreateGameMenu::CreateGameMenu(GuiWidget* parent, client::Client* client, input::InputManager& inputManager) :
GuiWidget(parent, client), m_InputManager(inputManager) {}
void CreateGameMenu::Render() {

View File

@@ -7,7 +7,7 @@
namespace blitz {
namespace gui {
CrossHair::CrossHair(Client* client) : GuiWidget(nullptr, client) {
CrossHair::CrossHair(client::Client* client) : GuiWidget(nullptr, client) {
m_CrossHairTexture = TextureLoader::LoadGLTexture("textures/crosshair.png");
}

View File

@@ -3,7 +3,7 @@
#include "blitz/misc/Easing.h"
#include "blitz/misc/Format.h"
#include "blitz/misc/Log.h"
#include "client/display/InputManager.h"
#include "client/input/InputManager.h"
#include "client/gui/ColorFulText.h"
#include "client/gui/GuiWidget.h"
#include <client/Client.h>
@@ -15,7 +15,7 @@ namespace gui {
static const float ChatFadeTime = 2.0f;
GameChatGui::GameChatGui(GuiWidget* parent, Client* client, input::InputManager& inputManager) :
GameChatGui::GameChatGui(GuiWidget* parent, client::Client* client, input::InputManager& inputManager) :
GuiWidget(parent, client), m_InputManager(inputManager) {
m_Client->BindListener(this);
InputBuf[0] = '\0';

View File

@@ -10,9 +10,26 @@
namespace blitz {
namespace gui {
Hud::Hud(GuiWidget* parent, Client* client) : GuiWidget(parent, client) {
Hud::Hud(GuiWidget* parent, client::Client* client) : GuiWidget(parent, client) {
m_GunTexture = TextureLoader::LoadGLTexture("textures/fingergun.png");
m_JPTexture = TextureLoader::LoadGLTexture("textures/jp.png");
m_Client->BindListener(this);
}
Hud::~Hud() {
m_Client->UnbindListener(this);
}
void Hud::OnGameStateUpdate(game::GameState gameState) {
m_Timer.Reset();
}
void Hud::OnGameJoin() {
m_Client->GetGame()->BindListener(this);
}
void Hud::OnGameLeave() {
m_Client->GetGame()->UnbindListener(this);
}
void Hud::Draw(const char* title, bool* p_open) {
@@ -148,9 +165,11 @@ void Hud::Render() {
switch (m_Client->GetGame()->GetGameState()) {
case game::GameState::gsEnd: {
game::Player* firstPlayer = m_Client->GetGame()->GetLeaderBoard().GetPlayers().front();
if (!firstPlayer)
const auto& players = m_Client->GetGame()->GetLeaderBoard().GetPlayers();
if (players.empty())
return;
game::Player* firstPlayer = players.front();
DrawFinishScreen(firstPlayer->GetID() == m_Client->GetPlayerID());
break;
}

View File

@@ -3,14 +3,14 @@
#include "blitz/misc/Format.h"
#include "blitz/misc/Log.h"
#include "client/Client.h"
#include "client/display/InputManager.h"
#include "client/input/InputManager.h"
#include <imgui.h>
#include <string>
namespace blitz {
namespace gui {
JoinGameMenu::JoinGameMenu(GuiWidget* parent, Client* client, input::InputManager& inputManager) :
JoinGameMenu::JoinGameMenu(GuiWidget* parent, client::Client* client, input::InputManager& inputManager) :
GuiWidget(parent, client), m_InputManager(inputManager) {}
void JoinGameMenu::Render() {

View File

@@ -10,9 +10,20 @@
namespace blitz {
namespace gui {
LeaderBoardGui::LeaderBoardGui(GuiWidget* parent, Client* client) : GuiWidget(parent, client) {}
LeaderBoardGui::LeaderBoardGui(GuiWidget* parent, client::Client* client) : GuiWidget(parent, client) {
m_Client->BindListener(this);
}
LeaderBoardGui::~LeaderBoardGui() {}
void LeaderBoardGui::OnGameJoin() {
m_Client->GetGame()->BindListener(this);
}
void LeaderBoardGui::OnGameLeave() {
m_Client->GetGame()->UnbindListener(this);
}
LeaderBoardGui::~LeaderBoardGui() {
m_Client->UnbindListener(this);
}
void LeaderBoardGui::Draw(const char* title, bool* p_open) {
static float leaderboard_width = 800.0f;
@@ -62,6 +73,10 @@ void LeaderBoardGui::Draw(const char* title, bool* p_open) {
ImGui::End();
}
void LeaderBoardGui::OnGameStateUpdate(game::GameState gameState) {
m_Timer.Reset();
}
void LeaderBoardGui::Render() {
if (!m_Client->IsConnected())
return;
@@ -74,8 +89,6 @@ void LeaderBoardGui::Render() {
if (m_Timer.Update(ImGui::GetIO().DeltaTime)) {
Draw("Leaderboard", nullptr);
}
} else {
m_Timer.Reset();
}
}

View File

@@ -9,7 +9,7 @@
namespace blitz {
namespace gui {
MainMenu::MainMenu(Client* client, input::InputManager& inputManager) : GuiWidget(nullptr, client), m_InputManager(inputManager) {
MainMenu::MainMenu(client::Client* client, input::InputManager& inputManager) : GuiWidget(nullptr, client), m_InputManager(inputManager) {
Enable();
AddWidget(std::make_unique<CreateGameMenu>(this, client, inputManager));
AddWidget(std::make_unique<JoinGameMenu>(this, client, inputManager));

View File

@@ -3,15 +3,15 @@
#include "blitz/misc/Format.h"
#include "blitz/misc/Log.h"
#include "client/Client.h"
#include "client/display/InputManager.h"
#include "client/gui/FPSMenu.h"
#include "client/input/InputManager.h"
#include <SDL2/SDL.h>
#include <imgui.h>
namespace blitz {
namespace gui {
static std::string ActionNames[kaMax] = {
static std::string ActionNames[input::kaMax] = {
"Avancer",
"Reculer",
"Droite",
@@ -23,7 +23,7 @@ static std::string ActionNames[kaMax] = {
static std::string GetActionName(KeyAction action) {
static std::string GetActionName(input::KeyAction action) {
return ActionNames[action];
}
@@ -42,7 +42,7 @@ static std::string GetImGuiKeyName(int key) {
OptionsMenu::OptionsMenu(GuiWidget* parent, Client* client, input::InputManager& inputManager) :
OptionsMenu::OptionsMenu(GuiWidget* parent, client::Client* client, input::InputManager& inputManager) :
GuiWidget(parent, client), m_IsKeyPopupOpen(false), m_KeyPopupShouldClose(false), m_InputManager(inputManager) {
AddWidget(std::make_unique<FPSMenu>(this, client));
@@ -69,13 +69,13 @@ OptionsMenu::~OptionsMenu() {
void OptionsMenu::HotkeyBindingButton() {
for (std::size_t i = 0; i < m_Client->GetConfig()->GetKeys().size(); i++) {
if (ImGui::Button(utils::Format("%s##%i", GetKeyActionCodeName(KeyAction(i)).c_str(), i).c_str())) {
if (ImGui::Button(utils::Format("%s##%i", GetKeyActionCodeName(input::KeyAction(i)).c_str(), i).c_str())) {
m_IsKeyPopupOpen = true;
m_CurrentAction = KeyAction(i);
m_CurrentAction = input::KeyAction(i);
ImGui::OpenPopup("Changer de touche");
}
ImGui::SameLine();
ImGui::Text("%s", GetActionName(KeyAction(i)).c_str());
ImGui::Text("%s", GetActionName(input::KeyAction(i)).c_str());
}
}
@@ -135,7 +135,7 @@ void OptionsMenu::OnKeyDown(int key) {
std::string OptionsMenu::GetKeyActionCodeName(KeyAction act) {
std::string OptionsMenu::GetKeyActionCodeName(input::KeyAction act) {
return GetImGuiKeyName(static_cast<int>(m_Client->GetConfig()->GetKeys()[act]));
}

View File

@@ -1,8 +1,8 @@
#include "client/gui/ServerGui.h"
#include "client/Client.h"
#include "client/display/InputManager.h"
#include "client/game/ClientGame.h"
#include "client/input/InputManager.h"
#include "server/Server.h"
#include "server/game/ServerGame.h"
#include <imgui.h>
@@ -10,7 +10,7 @@
namespace blitz {
namespace gui {
ServerGui::ServerGui(GuiWidget* parent, Client* client, input::InputManager& inputManager) :
ServerGui::ServerGui(GuiWidget* parent, client::Client* client, input::InputManager& inputManager) :
GuiWidget(parent, client), m_InputManager(inputManager) {}
void ServerGui::Render() {
@@ -18,7 +18,7 @@ void ServerGui::Render() {
return;
Keybinds keys = m_Client->GetConfig()->GetKeys();
if (ImGui::IsKeyPressed(ImGuiKey(keys[kaFenetreAdmin])) && m_InputManager.MouseGrabbed()) {
if (ImGui::IsKeyPressed(ImGuiKey(keys[input::kaFenetreAdmin])) && m_InputManager.MouseGrabbed()) {
ImGui::OpenPopup("FENETRE D'ADMIN");
}

View File

@@ -1,6 +1,6 @@
#include "client/display/Display.h"
#include "client/input/Display.h"
#include "client/display/InputManager.h"
#include "client/input/InputManager.h"
#include "client/render/OpenGL.h"
#include <SDL2/SDL.h>
#include <backends/imgui_impl_opengl3.h>
@@ -19,8 +19,9 @@
#endif
namespace blitz {
namespace input {
Display::Display(int width, int height, const std::string& windowName, Client* client, input::InputManager& inputManager) :
Display::Display(int width, int height, const std::string& windowName, client::Client* client, input::InputManager& inputManager) :
m_WindowWidth(width),
m_WindowHeight(height),
m_AspectRatio(m_WindowHeight / static_cast<float>(m_WindowWidth)),
@@ -236,4 +237,5 @@ void Display::InitImGui() {
m_BlitzGui = std::make_unique<gui::BlitzGui>(m_Client, m_InputManager);
}
} // namespace input
} // namespace blitz

View File

@@ -1,4 +1,4 @@
#include "client/display/InputManager.h"
#include "client/input/InputManager.h"
#include "imgui.h"
#include <vector>

View File

@@ -1,12 +1,12 @@
#include "client/display/PlayerController.h"
#include "client/input/PlayerController.h"
#include "blitz/game/Player.h"
#include "blitz/maths/Maths.h"
#include "blitz/misc/Log.h"
#include "client/Client.h"
#include "client/config/BlitzConfig.h"
#include "client/display/InputManager.h"
#include "client/game/ClientGame.h"
#include "client/input/InputManager.h"
#include "imgui.h"
#include <algorithm>
#include <iostream>
@@ -20,7 +20,7 @@ static constexpr float DEFAULT_MAX_FB_SPEED = 10.;
static constexpr float DEFAULT_LR_SPEED_SMOOTHING_TIME = 1.0;
static constexpr float DEFAULT_FB_SPEED_SMOOTHING_TIME = 1.0;
PlayerController::PlayerController(Client* client, input::InputManager& inputManager) :
PlayerController::PlayerController(client::Client* client, input::InputManager& inputManager) :
m_Player(nullptr),
m_Client(client),
m_InputManager(inputManager),
@@ -87,13 +87,13 @@ void PlayerController::Update(float delta) {
if (ImGui::IsKeyDown(ImGuiKey::ImGuiKey_Space) && m_OnGround) {
m_Velocity.z = m_MaxVelocity.z;
NotifyListeners(&game::PlayerInputListener::OnLocalPlayerJump);
NotifyListeners(&client::PlayerInputListener::OnLocalPlayerJump);
}
bool canShoot = m_ShootTimer.Update(ImGui::GetIO().DeltaTime);
if (ImGui::IsMouseDown(ImGuiMouseButton_Left) && canShoot) {
NotifyListeners(
&game::PlayerInputListener::OnLocalPlayerShoot, m_Player->GetPosition(), m_Player->GetYaw(), m_Player->GetPitch());
&client::PlayerInputListener::OnLocalPlayerShoot, m_Player->GetPosition(), m_Player->GetYaw(), m_Player->GetPitch());
m_ShootTimer.ApplyCooldown();
}
} else {
@@ -132,6 +132,7 @@ void PlayerController::UpdatePosition(const float delta) {
}
m_Player->AddPosition({dx, dz, dy});
m_Player->SetVelocity({dx, dz, dy});
}
} // namespace input

View File

@@ -24,7 +24,7 @@ namespace render {
static const Vec4f SkyColor = {0.6f, 0.8f, 1.0f, 1.0f};
static const Vec4f MenuColor = {0.0f, 0.0f, 0.0f, 0.0f};
MainRenderer::MainRenderer(Client* client, input::PlayerController& playerController) :
MainRenderer::MainRenderer(client::Client* client, input::PlayerController& playerController) :
m_Client(client), m_ShootTime(0), m_BulletRenderer(m_Camera), m_PlayerController(playerController) {
LoadModels();

View File

@@ -5,6 +5,7 @@
#include "blitz/misc/Log.h"
#include "blitz/misc/Random.h"
#include "blitz/protocol/packets/ChatPacket.h"
#include "blitz/protocol/packets/PlayerDeathPacket.h"
#include "blitz/protocol/packets/PlayerJoinPacket.h"
#include "blitz/protocol/packets/PlayerLeavePacket.h"
#include "blitz/protocol/packets/PlayerPositionAndRotationPacket.h"
@@ -159,6 +160,11 @@ void ServerGame::DamagePlayer(game::Player& player, game::Player& shooter) {
player.SetPosition({utils::GetRandomReal(-10.0f, 10.0f), 0.0f, utils::GetRandomReal(-10.0f, 10.0f)});
UpdatePlayerStats();
NotifyListeners(&game::GameListener::OnPlayerDeath, player.GetID());
protocol::PlayerDeathPacket packet(player.GetID());
m_Server->BroadcastPacket(&packet);
}
}