AS3 2.1 Port (Alchemy), WCK Update and Kinematic Demos

Frnk:

1. Overriding create() to enforce values for component properties should work. No idea why you are having problems. I use this approach everywhere.

2. I suspect presolve and solve are not dispatched for sensors, since there is no solving needed. The approach you are taking is correct. Although you could alternatively listen for the StepEvent.STEP event type.

sketchbook:

1. I did not slice up the world. It is all being simulated at the same time. The size of the Flash stage is actually more of a limitation to level size than performance concerns.

2. If you take a look at the experimental "Actor" and "GroundFinder" classes you can see the core of the algorithm. Based on the roll direction (clockwise/counter clockwise) it finds the "ideal" contact for movement, and negates the friction on all other contacts (friction drives movement). This prevents the ball from getting stuck in corners. Sticky mode involves applying a force between the player and that contact, and disabling gravity. If suddenly the player becomes airborne, a corrective force must be applied to get him back to the ground (he actually "hangs" for a frame when rounding corners). It is still buggy in places. For example, at the point between two polygons mocking the outside of a circle, the player will be jerked backwards because it thinks it's rounding a right angle before hitting the next polygon (actually... it just occurred to me some overlap might fix that).

3. World has a "orientToGravity" flag that will make sure the gravity applied to the player (actually, the scrolling focus object) determines the rotation of the world. So "up" is always "up." The gravity is just an stretched instance of GravityCapsule.
Thanks, mayo!

Terrain - what would be the easiest way to do this in wck ?

I've seen the linearcs stuff but i was thinking of something more irregular shaped as seen here:
viewtopic.php?f=3&t=5000 or here http://www.ezqueststudios.com/blog/box2 ... er-curves/
Ideally i would prefer to simply draw the terrain in a symbol

Cheers
Hi mayo,

Great work on WCK. I haven't used it directly, but I'm using it as a model somewhat of how to implement level editors using Flash CS5 for my own engine that extends Box2d. In particular I saw how it uses component definitions. I've started using them for my own editor too in lieu of scripting, but I'm discovering they can be a pain. They're the best idea in Flash that is the most poorly implemented and documented.

In particular, I'm trying to figure out a good way to handle this:

1.) An artist drags a bunch of component-definitionified assets from the library onto stage.
2.) All the assets should have similar properties, for example friction=.5
3.) friction=.5 is the default value for the component definition Inspectable, so no problem initially.
4.) But wait, later on, it's decided that all these object should have friction=.7.
5.) Since you can't edit multiple component definitions, the artist has to select them one-by-one and edit each friction field individually, which can be a huge hassle with dozens of objects.

Do you have any suggestions for a good way to get around this?

Thank you very much.

- Doug
Hey Doug,

First of all, mayo probably has a better answer/solution

However I ran into the same issue and here are the solutions that worked for me:
There's an option to override friction in the pseudo constructor create() with e.g. this.friction = 0.7;
The other option (which i used) is to move all values for each instance to a collective XML file. The artist can then edit the data in excel / OpenOffice instead of using the component inspector. Each instance is in a new sheet inside the excel file. Therefore its easy to do a global change on friction for all instances, or to copy/paste large areas of values. Also you wont loose your values once you rename variables or delete/remove variables from the class.
Thanks for the reply Frnk...

The first option doesn't work in my case, because often the artist wants to change half the objects to .7 and the other half to .8, for example.

The second option sounds like it can account for this situation, but I'm unclear how instances are associated with xml entries. If I have a bunch of unnamed instances on the stage, how do I match a particular instance to a particular set of XML values?

If only artists learned how to program, none of this would be necessary 😉
Just wanted to add that I've used the xml approach many times, for example when the association between the data and the object was implicitly defined somehow, whether it be by the object's position on the stage, in the display list, or in the timeline, or by giving each object an instance name and referencing that in the XML.

However, with dozens of instances placed arbitrarily all over the stage/timeline, neither of those strategies is practical.
I need to name most instances anyhow for the game logic, inventory etc..
Yes agreed, if there are too many instances to name them then its no good approach

Have you tried accessing the property inspector data directly in the fla or wherever its stored? Maybe there are some export/import tools that easily let you edit all instance properties. Let me know if you find anything
Frnk:

Re: Terrain: I use the polygon decomposition JSFL file in the scripts folder. If you draw a simple polygon in Flash, select it, then run that script, it will output the points (decomposed into convex polygons) to the console. Then I copy paste those points into a one line call on the timeline:
Code:
shape(polys, [[[x, y], [x, y], [x, y]], [[x, y], [x, y], [x, y]]...]

I usually do my complicated polygons a piece at a time because I like to guide the decomposition. Also, the script doesn't know about the 8 vertex limit so you have to watch out for that.

dougk16: I just added a JSFL file that will let you set a property on multiple components at once:

http://github.com/jesses/wck/blob/maste ... perty.jsfl

I may expand on that in the future but that gets the job done.
@mayobutter, nice work on the jsfl script.
i was considering making one like the CS4 multi library item property editor. with check boxes and property/value fields, some input text others drop downs. probably won't make it for a while, so I'm really glad you made that simpler one.

-i hate jsfl, the error reports are terrible.
-and the cs4 multi library item doesn't actually work well on sounds files w/o opening and closing properties of every item, but the interface is what i was referring to here.

anyway, I'm certain i could patch the code to work with gravity modifiers replacing the true/false values w/o breaking anything. It would require a component update for full support though. would you be willing to make the component change if i can get the code to not break existing items?

-i did manage to get your World override suggestion to work, still i would like to push towards per body gravity modifiers.
is there any interest in making wck encryption friendly?

i know at some point i will have a client that insists on this feature.

Original thread: https://box2d.org/forum/viewtopic.php?t=4105