driiper Posted February 25, 2015 Share Posted February 25, 2015 Hello! I'm having issues drawing Graphics elements in PIXI.I'm having major fps problems and i'm not sure why and IF it should lag on the hardware im testing on. GPU: amd radeon 7500/600mCPU: A decent quad core cpu Game: What you see below is a world map generated from a JSON file.This json file contains X and Y coordinates for each of the Polygon points for specified country.There are in total 1100 polygons, sice is as you can see varying.I have made a little function to skip some polygon points in attempts to boost the performance, But no luck (Example skip every 2 point) Ive tried to remove interactivity from the graphics objects, this did not help either.All of these countries is inside its own container, and the lag is clear when attempting to move this container. So is there anything i might be able to do to make this run abit more "lightweight"Ive been thinking about the possibility to convert each of the graphics elements to a Sprite instead, but i have no way to identify where the sprite should be positioned.Anyone have an idea? If you have a semi crap computer laying around: http://128.39.148.43:9001/ to test yourself ThanksDriiper Quote Link to comment Share on other sites More sharing options...
digibo Posted February 25, 2015 Share Posted February 25, 2015 I belief this will create thousands and thousands of triangles which will totally kill the GPU performance. As you guessed, you should generate a texture from the Graphics object of each country (or the entire thing if you don't need them separately) and then create a new Sprite from this texture and the Sprite to your Container/Stage. If you rely on the JSON data for the countries positioning, indeed positioning the Sprites may be tricky, but it should probably be a one time effort. One "trick" I like using in such situations is to make the object I want to position easily accessible from the DevTools Console and play with the x/y properties until I get them right and then change them in the code. Thinking about it, in the JSON data, the leftmost point of each country, should be the x coordinate of the country and the topmost will be the y, so maybe you can extract those values from the data. driiper 1 Quote Link to comment Share on other sites More sharing options...
driiper Posted February 25, 2015 Author Share Posted February 25, 2015 Ill give it a try Thanks! Quote Link to comment Share on other sites More sharing options...
driiper Posted February 25, 2015 Author Share Posted February 25, 2015 Thinking about it, in the JSON data, the leftmost point of each country, should be the x coordinate of the country and the topmost will be the y, so maybe you can extract those values from the data.Holy shit, This actually worked! Thanks alot Quote Link to comment Share on other sites More sharing options...
agamemnus Posted February 26, 2015 Share Posted February 26, 2015 digibo 1 Quote Link to comment Share on other sites More sharing options...
digibo Posted February 26, 2015 Share Posted February 26, 2015 @driiper I'm glad I helped:) @agamemnus haha, I always laugh at this:) If someone doesn't get the reference, it's from here http://hyperboleandahalf.blogspot.com/2010/04/alot-is-better-than-you-at-everything.html Quote Link to comment Share on other sites More sharing options...
msha Posted February 26, 2015 Share Posted February 26, 2015 It will be faster if you create a single graphics object instead of one per country. But then you won't be able to handle mouse move/clicks.... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.