[Suggestion]box2d vertex limit - Solution Idea!

Discussion and feedback on Construct 2

Post » Tue Mar 03, 2015 1:44 pm

When I face the box2d vertex limit problem, resolved in some way in r198, and looking to the problem I found some solutions at least for other engines. One of the solution was to implement polygon decomposition, It could be a good idea implement this on the editor. It works creating a Body with several Fixtures. Those fixtures will have max 8 vertices and will share some of the vertices, so ill will simulate a bigger piece using smaller parts, which are stuck together.

In the editor maybe It can be implemented in a way to auto decompose the main polygon into pieces. Or maybe after adding more than 8 vertices it will auto decompose to the next polygon.

This way we don't decrease performance or project size importing multiple images.

The Actual Output of the Construct2 polygon system as I saw in the project file is:

<collision-poly>
<point x="0.163934" y="0.191257" />
<point x="0.315574" y="0.0846994" />
<point x="0.5" y="0.0437158" />
<point x="0.673497" y="0.0812841" />
<point x="0.822404" y="0.17623" />
<point x="0.916667" y="0.326503" />
<point x="0.956284" y="0.504098" />
<point x="0.910519" y="0.681011" />
<point x="0.818306" y="0.822404" />
<point x="0.678962" y="0.919399" />
<point x="0.528689" y="0.948941" />
<point x="0.529201" y="0.58312" />
<point x="0.469603" y="0.584785" />
</collision-poly>

so maybe we could ending having something like:

<collision-poly>
<vertices set="0">
<point x="0.163934" y="0.191257" />
<point x="0.315574" y="0.0846994" />
<point x="0.5" y="0.0437158" />
<point x="0.673497" y="0.0812841" />
<point x="0.822404" y="0.17623" />
<point x="0.916667" y="0.326503" />
<point x="0.956284" y="0.504098" />
<point x="0.910519" y="0.681011" />
<vertices>
<vertices set="1">
<point x="0.818306" y="0.822404" />
<point x="0.678962" y="0.919399" />
<point x="0.528689" y="0.948941" />
<point x="0.529201" y="0.58312" />
<point x="0.469603" y="0.584785" />
<vertices>
</collision-poly>

note: this post was posted by error on the closed bugs section, I delete it from there and re post it here!
You do not have the required permissions to view the files attached to this post.
B
30
S
5
G
4
Posts: 6
Reputation: 2,813

Post » Tue Mar 03, 2015 4:47 pm

I do not actually remember that error existing in the web variant of box2d, only in the asm.js one, it might be better to actually look into why there is one in the first place.
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
48
S
20
G
18
Posts: 2,111
Reputation: 16,771

Post » Tue Mar 03, 2015 9:07 pm

It's an inconsistent problem (with asm.js), which is irritating... Just for the fun of it, here's an example that has an object with 33 vertices - no probs!
You do not have the required permissions to view the files attached to this post.
I only occasionally visit - I'm learning C# for Unity, but c2 is still a respectable game engine imo....
B
69
S
18
G
65
Posts: 2,195
Reputation: 41,465

Post » Tue Mar 03, 2015 10:34 pm

@Colludium
That polygon is concave. The physics behavior breaks concave polygons into multiple convex ones internally. The reason it works is none of those convex polygons likely have more than 8 points, or 16 starting with release 198. The limit is likely an optimization, but instead of giving an error it would be nice if convex polygons with more than 8 points were just split into multiple to allow users to not worry about it.
B
89
S
30
G
95
Posts: 5,154
Reputation: 63,444

Post » Wed Mar 04, 2015 12:07 am

Thanks for the clarification, @R0johound. There I go again - displaying my limited understanding in how the engine works....!
I only occasionally visit - I'm learning C# for Unity, but c2 is still a respectable game engine imo....
B
69
S
18
G
65
Posts: 2,195
Reputation: 41,465

Post » Wed Mar 04, 2015 12:23 pm

Great clarification indeed!!!
B
30
S
5
G
4
Posts: 6
Reputation: 2,813


Return to Construct 2 General

Who is online

Users browsing this forum: gianghl1983, repkino, Yahoo [Bot] and 8 guests