In this pull request I fought with optimization. I tested it in level 4 because it's one of the lowest fps level. My result is
Platform
Before
After
Google Chrome (Mobile)
21 fps
33 fps
Windows
500 fps
570 fps
What have been done:
Implemented GridNode. See more in comments. It uses actor positions to store nodes and reduce visibility checks.
All actors cache PositionComponent and PhysicsComponent.
Improved ActorRenderComponent. All actors call ActorRenderComponent::SetImage even they are invisible. Now ActorRenderComponent::SetImage is lazy. Component does not look up and update image until it's really needed.
BaseGameLogic::GetClawActor call is cached.
Some refactoring. Removed unnecessary object coping, reserved vector sizes and so on.
Fixed emscripten build steps after updating.
Small nice features:
I implemented zIndexes enum instead of magic numbers. It helps to support code base because all zIndexes values are in xmls or a single enum.
zIndex affects powder ked and crate positions as in original game. I think it looks much better:
Hi folks
What have been done:
GridNode
. See more in comments. It uses actor positions to store nodes and reduce visibility checks.PositionComponent
andPhysicsComponent
.ActorRenderComponent
. All actors callActorRenderComponent::SetImage
even they are invisible. NowActorRenderComponent::SetImage
is lazy. Component does not look up and update image until it's really needed.BaseGameLogic::GetClawActor
call is cached.Small nice features:
zIndexes
enum instead of magic numbers. It helps to support code base because all zIndexes values are in xmls or a single enum.