[Request] Geometry shape object

This forum is currently in read-only mode.
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
  • Basically an object that would draw a geometric shape of choice - rectangle, triangle, circle, polygons, whatever, with a very small footprint and innate collision mask. Transparent or filled.

    Why not just draw one in sprite? Well, if you need something like a circle with radius of 256 pixels, the texture takes 512x512 pixels regardless of content or blank space. Annoying. Plus it doesn't scale too well!

    The uses are many - to simply draw circles, polygons or whatever for many purposes (range overlay, firing arc for turrets etc.) - should be scalable (vector!).

    There you go. Up for the challenge?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You have to use textured sprites for circles anyway. DirectX doesn't provide any better way to draw circles other than putting one on a texture and drawing that, which is exactly what Sprite does. If you draw a fairly big, white circle (I wouldn't go bigger than 512x512 to save VRAM), you can colour it with the filter, and set the width/height to change its size. It'll still look nice.

    You can use Box for a rectangle/square too!

  • That seems rather wasteful to draw, say, dozens of circles to represent weapon ranges, arcs and so on. Hmm, I should be fine by using template sprites, I guess; just worried about the rendering speed when there is a lot of stuff overlapping on screen.

  • As I said, there's no better, or less wasteful, way. If you're creating <100 of these objects, I doubt you'll ever notice an FPS difference.

  • i agree with ashley; your graphics card only needs to load the texture once, and putting it on a few dozen sprites will barely impact performance.

    for those cases where you need really big diameter circles, you could use distorted sprites as a workaround ( example ). note that this will impact render performance more than a simple sprite, because the graphics card needs to process more vertices. but it's still a viable alternative if you don't have enough vram, dislike blown-up blurry pixels yet don't mind aliased edges.

    this is by no means a comfortable way to do it, but if you really need it, i guess you could bend sprites into other geometric shapes as well.

  • I don't think mesh distortion would work well for a larger circle. You'd need too many vertices for it to be efficient (remember 4 vertices is equivalent to 1 sprite). Textures are the way to go.

  • depending on the circle diameter, you'd only have to build the segment that is actually visible; but you're right, piling vertices for smooth edges is a performance hog.

    another idea would be to use quarter-circle textures & build a circle out of 4 sprites. that way, you could achieve smooth antialiased circles with a diameter of up to 8192px, given a limit of 4096px square for textures on most graphic cards.

    (this won't suffice! its less than 9000!)

  • Well, problem is that sprites don't scale too well, especially if I want the thickness to remain the same (like 1-2 pixels), scaling it up makes edges thicker, scaling it down makes edges thinner... you get the idea. Plus you get ugly bumps if you scale stuff up (despite linear filtering).

    But yeah, I'll have to use sprites of different sizes, no big deal.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)