Geometric primitives?

New releases and general discussions.

Post » Thu Nov 12, 2009 11:00 am

I was wondering if it would be possible to introduce primitives - simple geometric objects such as circle, triangle, square etc. through DX9?

Basically a feature that would draw the shape as per the supplied instructions (equation, vectors), which would also be compared in the game for collision purposes. So instead of checking for pixels, you check the actual equation that is used to draw the geometric structure. These primitives would also be scaleable - since you're drawing per vector instructions, it would always remain sharp.

I have little to no clue about programming, DX9 and stuff, so I am wondering if this would be possible. See, all graphics currently are redrawn each frame by reading the supplied texture pixel-by-pixel. What if instead it would draw directly, following supplied instructions? Isn't that what shader effects currently do - alter the texture per instructions?

Be nice to be able to draw simple geometric shapes and benefit from perfect collision checking!
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Thu Nov 12, 2009 11:56 am

This could be added, but I don't see much advantage over using sprites with geometric textures. You still get pixel-perfect collisions, you can pre-render antialiasing on the texture rather than relying on expensive multisampling for improving quality, and for some shapes like circles, textures are actually the only way to do it. Genuinely the best way to render a circle in DirectX is to draw a texture with a circle on it. The other option (a ring of vertices) would be slower, and worse quality (aliased)!
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,468

Post » Thu Nov 12, 2009 3:09 pm

[quote="Ashley":24ozntd0]This could be added, but I don't see much advantage over using sprites with geometric textures. You still get pixel-perfect collisions, you can pre-render antialiasing on the texture rather than relying on expensive multisampling for improving quality, and for some shapes like circles, textures are actually the only way to do it. Genuinely the best way to render a circle in DirectX is to draw a texture with a circle on it. The other option (a ring of vertices) would be slower, and worse quality (aliased)![/quote:24ozntd0]

Why do everyone cares so much about "the best way"?! There is not a best way to do a thing! I could have advatages even if I draw a polygonal circle instead of a texture! Is that kind of feature so hard to do? If you want to create a FULL 2D game creation app don't you think that you NEED to let the developer to decide if he wants to use a texture or a polygon?? We have DUAL and QUAD cores!! And apart that, who cares about the lose of 1-2-3-4 FPSs??! I could have my reason to draw a polygonal shape instead of a texture!! Don't you think?
I wonder why everyone is so against this kind of feature. Polygons with textures and collision checking. Is that so difficult? So difficult for you that MADE the entire CONSTRUCT?
This is not even the first time a user asks for this kind of feature. And noone helps those users. We are not all expert coders!!

Ok, now I feel better. :mrgreen:
B
2
S
1
G
3
Posts: 193
Reputation: 1,486

Post » Thu Nov 12, 2009 4:23 pm

Chill pill, Genesys? :P

Anyway, @Ashley: It is not a matter of efficiency; there are times when I wished I could simply draw a geometric shape (or polygon) instead of having to use a pre-rendered texture. Having the feature I described would be quite a boon for game developers.

Here are the advantages I can think of:
- you can update the shape in real time, while a static texture remains the same. Imagine real time graphs! And that is not the only thing you could do in the game.
- collision checking is easy between geometric primitives, because you can simply solve rather than check for each pixel, where even slightly transparent pixel can throw the alarm bells off.
- I mentioned transparent pixels... well, static textures, when zoomed in, have these all over the place. There would be no such "dirt" with polygons.
- low memory footprint. A huge circle (to preserve crispiness) can easily take a good chunk off memory, while a primitive circle would take substantially less (if we draw directly to the visible screen, skipping offscreen). Static texture still retains the same space, even if it is not drawn offscreen.

Efficiency is not a concern, when it comes to numerous possibilities we can create with these objects.
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Thu Nov 12, 2009 4:45 pm

[quote="Genesys":wie2lrby]Why do everyone cares so much about "the best way"?! There is not a best way to do a thing![/quote:wie2lrby]
Perhaps, but some ways are clearly better than others. And isn't your entire rant about doing something a better way? :)
[quote="Genesys":wie2lrby]I wonder why everyone is so against this kind of feature. Polygons with textures and collision checking. Is that so difficult? So difficult for you that MADE the entire CONSTRUCT?[/quote:wie2lrby]
The devs don't even have much time to work on bugfixes, which are of much, much higher priority. Maybe they could consider it for C2, but there's more important stuff to be done on C1.
[quote="Genesys":wie2lrby]This is not even the first time a user asks for this kind of feature. And noone helps those users. We are not all expert coders!![/quote:wie2lrby]
They can't implement everything people want immediately. Construct is a free piece of software written in the dev's spare time. I think we all can agree that there are more important things to work on first, like bugfixes, and perhaps even online capabilities (not sure what the status is on that. Seems to be a lot of different info), etc.

I'm not against the feature - I just think that most of what could be achieved with it can already be done, and other stuff is more important.
Moderator
B
87
S
32
G
33
Posts: 3,005
Reputation: 27,397

Post » Thu Nov 12, 2009 5:05 pm

I know Construct is free. But I feel like the devs never hear what we ask! I feel alone! :(

I Totally Quote Mipey.

And I also know that devs doesn't have much time to work, so they work on bugfixes for now. But I feel alone anyway :lol:
B
2
S
1
G
3
Posts: 193
Reputation: 1,486

Post » Thu Nov 12, 2009 5:33 pm

I think the collision thing you speak of would require a lot of work. Probably the fastest way to check the collisions would be to render the vector graphic onto a texture then pixel check that. Otherwise I guess they would have to write some sort of equation solving collision engine (unless dx already has some sort of library built in for this, which I'm guessing is more than plausible.).

Anyways, I'm all for some sort of geometric drawing capability, but I believe it's too much work right now to expect anything useable in the near future. What I would really like to see is polygonal drawing capabilities with the canvas. Speaking of canvas, there's a hell of a lot of bugs with it... Guess I better go report them. :mrgreen:
B
25
S
3
G
6
Posts: 1,197
Reputation: 5,620

Post » Thu Nov 12, 2009 6:24 pm

For the record, it is not like I am demanding this feature, I was just wondering if it was feasible. Of course I can live without it, but hey, if this was possible, it would certainly expand game developer's options!

What about shaders? Would it be possible to draw primitives based on given parameters? Grab an empty sprite, assign the effect to it and set some parameters. Not the most elegant way, but hey... imagine drawing with shaders. Hella slow, I bet.

I would use canvas, but it is restrictive in many ways.
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Thu Nov 12, 2009 7:24 pm

IndieLib does this, and it's really nice. =D
B
14
S
2
G
5
Posts: 37
Reputation: 2,777

Post » Thu Nov 12, 2009 7:57 pm

I ain't no programmer and IndieLib is a C++ library. :cry:
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Next

Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 3 guests