Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Game feels laggy #5

Open
alcalyn opened this issue Dec 7, 2019 · 1 comment
Open

Game feels laggy #5

alcalyn opened this issue Dec 7, 2019 · 1 comment

Comments

@alcalyn
Copy link
Owner

alcalyn commented Dec 7, 2019

As soon as we are on a big map with few units, game already feels laggy when dragging it.

We should be able to drag map on bigger-than-big maps without any lags.

@alcalyn alcalyn mentioned this issue Dec 7, 2019
@Greegko
Copy link

Greegko commented Jan 21, 2020

I have the same issue even when not doing anything with the game, just leaving on the screen.
The root cause is GPU 100% used by react-svg-pan-zoom lib, autoPanLoop requestAnimationFrame event calls which makes the whole thing to rerender every x ms.

I was mistaken, the issue is react-hexgrid with <image /> as content. If you comment out the

<image
x={-10}
y={-10}
width={20}
height={20}
xlinkHref={Themes.getImageFor(hex.entity)}
className={this.hexContentClasses(hex)}
/>
part it won't use the GPU almost at all.

To be more precise, the SVG filter on the image cause that much GPU usage, this beauty:

<filter id="gold-highlight" x="-200%" y="-200%" width="400%" height="400%">
<feGaussianBlur id="gold-shadow" in="SourceAlpha" stdDeviation="2" result="blur"/>
<feFlood floodColor="#FFFF00" result="offsetColor"/>
<feComposite in="offsetColor" in2="blur" operator="in" result="offsetBlur"/>
<feMerge>
<feMergeNode in="offsetBlur"/>
<feMergeNode in="SourceGraphic"/>
</feMerge>
</filter>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants