GithubHelp home page GithubHelp logo

Game feels laggy about openhex HOT 1 OPEN

alcalyn avatar alcalyn commented on May 15, 2024
Game feels laggy

from openhex.

Comments (1)

Greegko avatar Greegko commented on May 15, 2024

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>

from openhex.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.