bloodmasters
bloodmasters copied to clipboard
Think about the game architecture
In #27, I had to implement some ad-hoc "architecture", if you will. Before that, certain classes were included in several projects and compiled using conditional compilation (#if CLIENT
, #if SERVER
, #if LAUNCHER
).
I have simply converted each of such cases into a hierarchy of classes and sometimes interfaces.
In particular, the following items were touched and/or introduced during the process:
- [ ]
ClientCollision
- [ ]
ClientPhysicsState
- [ ]
ClientWallCollision
- [ ]
ClientPlayerCollision
- [ ]
ClientMap
- [ ]
ClientSector
- [ ]
ClientSidedef
- [ ]
ClientGateway
- [ ]
SharedGeneral
- [ ]
ServerPhysicsState
- [ ]
ServerPlayerCollision
- [ ]
ServerWallCollision
- [ ]
ServerGateway
- [ ]
ServerMap
- [ ]
ServerSector
- [ ]
IClientCollision
In places that were expecting specific implementations, I have simply added type casts, and extracted class factory methods sometimes.
All this is highly dubious. Especially the type casts. They have worse performance than the linear code, and also they are pretty ugly and tend to fail in runtime if not used correctly.
We'll have to review this architecture and implement a better architectural solution in each particular case.
For the General
classes, I think we can make them non-static and use DI.
For everything else, I haven't still decided. Any advice is welcome.