Thursday, December 8, 2011

Work Progress - Dec 7 - Dec 14

This is the 99th post of my pCSDT work.

Work done:
* Improved button group layout of AF tool (See here)


* Core upgraded to v0.41
** Change the definition of scale (now it is number of pixel per unit).
** Both x and y axes use the same scale.
** Instead of specifying min and max for each axis, one needs to set up a range of value that an axis spans. The program will compute the respective min and max from translate_x and translate_y which tells the relative translation of the origin. -1 and 1 are the values for the two opposite edges.
** Fix aspect ratio of pCSDT tool. Changing the canvas dimension does not distort the grid. The grid drawing is now made to the whole visible area of the simulation canvas (see CC and GG), unless one sets bDrawGridBeyongRange to false (SB).


Wednesday, November 30, 2011

Work Progress - Nov 30 - Dec 6

Demo: "SB in beta" link above

Work done:
* Skateboarder's "Word to yell" sensor


* improved local deployment -- By putting local resources in local jar files and include them as jar resource in the JNLP file, we can load local resources on both local computers and the web without specifying any absolute path.

In progress:
* aspect ratio control -- need to resize the canvas once the stage boundary changes

TO DO:
* Check casting - for binary op, the logic is at PVariant.Assign(lhs, op, rhs)
* disable during play - optional

Wednesday, November 16, 2011

Work Progress - Nov 16 - Nov 29

Demo: "Stable SB app" above

Done:
* Include description of new Core features in pCSDT doc.
* Introduce a few more operator codelets, including AND and OR.



* AF tool - merge fixed in one version of AF tool to the one in the repository, fix Flash problem on Firefox
* Introduce proper type casting in method codelet. The script below now parses the theta value of type float with a method expecting String input properly and display the theta value as expected.


TODO:
* Improved local deployment (avoid the need to specify absolute locations in .html and .jnlp files if possible)
* Aspect ratio of the grid

Thursday, November 10, 2011

Work Progress - Nov 9 - Nov 15

Demo: "Stable SB app" link above

Work done: Finish drop-down menu. The sample script asks the skateboarder to yell after pressing "a" key. On contacting Arc5, the yell message is changed to "Reaching Arc5". On reaching the edge, it sends a message "Stop" to the stage. When the stage receives that message, it will stop the simulation.


  • The pull-down menu is forbidden from being replaced and dragged away.
  • The script can be loaded correctly. You may check this out by pressing "a" key to ask the skateboarder to yell and pressing "b" to ask the skateboarder to stop yelling. This script is made by the "Save As" feature of the program. This means the save feature has also been implemented correctly.
  • Changing the order of the objects in the object manager doesn't change the currently selected object in the drop-down menu. To test it out, change the object order in the object manager with the up and down arrows and then start the simulation. Everything should be the same.
  • Changing the name of an object will trigger the respective name in the pull-down menu to change. To test it out, make sure the object "Jessie" is selected. Change the selected item of a pull-down menu in the scriptlet panel to be "Jessie". Then change the name of Jessie to something else. The pull-down menu should now display the new name.
Programmer note:
  • One can set a static list as the respective ArgVal using the [...] syntax. For example, in Skateboarder.java of SB app,
    @AutomatableEventList(name="On key Pressed", desc="Fired when a key is pressed", argNames={"key"}, argDesc={""}, argTypes={"String"}, argVals={"[a,b,c,d,e,f,g]"})
    public PEventList ekeyPressed = new PEventList(this);
  • We have an example dynamic list (fill in "@ValueListObjectNames" in the argVals field) that essentially pull the list of values from a class method. For example, in PObjectJBox2d.java of SB app,
    @AutomatableEventList(name="On Touching", desc="Fired when it is touching something", argNames={""}, argDesc={""}, argTypes={"PObject"}, argVals={"@ValueListObjectNames"})
    public PEventList eTouching = new PEventList(this);
  • It is also possible for an application to implement their own dynamic lists. In that case, one needs to extend from AbstractValueList to define the function used to generate the list of values. He then needs to extend from AbstractStatementFactory to define the key String and PType value that are necessary to trigger the production of the respective PStatementDynamicConst. Finally, in the Engine class of his own application, he needs to instantiate the respective Statement Factory and call Engine.AttachStatementFactory(.) to include the factory into consideration. Have a look at ValueListObjectNames.java and StatementFactoryCloning.java for an example.

Wednesday, November 2, 2011

Work Progress - Nov 2 - Nov 8

Progress:
* Drop down for pre-defined items -- still need to fix a few problems such as selected item consistency on changing object order, load and save, and avoiding it from being replaced by other codelets.


TODO:
* aspect ratio of the grid should be fixed for whatever dimension of the simulation window
* grid should automatically extend to the whole window area
* On new hit -> on new contact
* On contact, on new hit: include object hit as argument

Wednesday, October 26, 2011

Work Progress - Oct 26 - Nov 1

Demo: "stable SB app" above

Work done
* Hide the timer when it is not necessary
* If angular increment < 5, show an error message.
* "On outside stage" event added to Skateboarder object. It is triggered when the skateboarder is outside the rectangle spanned by the points (minx, maxx) and (miny, maxy) of the Stage/Background object.
* Message similar to MIT Scratch: "Broadcast message" method, "Send meesage" method, "On Receive message", On Receive message From" event. Try to load this for a demo use case. When the skateboarder is outside the stage area, a "Stop" message is broadcast. When the stage receives the "Stop" message, it will stop the simulation.

Scripts for the skateboarder

Script for the stage

Wednesday, October 19, 2011

Work Progress - Oct 19 - Oct 25

Demo: "Stable SB app" above

Done:
* parameterized event codelet
Code example (SB.Skateboarder)
@AutomatableEventList(name="On key Pressed", desc="Fired when a key is pressed", argNames={"key"}, argDesc={""}, argTypes={"String"}, argVals={"a"})
public PEventList ekeyPressed = new PEventList(this);

One should provide one or more PEventInvokeVerifier to the PEventList to help the PEvent make use of the input arguments. In the above example, we add the following in the Skateboarder's constructor
ekeyPressed.AttachInvokeVerifier(new KeyPressedPEventInvokeVerifier());
where KeyPressedPEventInvokeVerifier implements IEventInvokeVerifier, the following method of which does the job.
public boolean VerifyInvoke(PEvent e, Object... params);

* (x1,y1) subscript, parentheses. For an AutomatableProperty, one can now use the additional DisplayName field to suggest the HTML-formatted field name shown in the InitialPropertyManager. If that DisplayName field is not specified, we will take the value specified in the name field. Also, the description field also supports the use of HTML tags to format.
@AutomatableProperty(name="x1,y1", DisplayName="x1, y1", desc="x1, y1", DesignTimeBehavior="B", RunTimeBehavior="H")
public String p1;

* timer - bigger, higher contrast

* Fix the bug that on switching between basic and advanced tab, the desc doesn't change accordingly.
* Fix the bug that traces of codelet are left behind when dragging the codelet in Scriptlet panel.

To do:
* Hide the timer when it is not necessary
* Pull-down selection codelet (detect when to hit boundary)
* Messaging as in MIT Scratch
* Disable various editing panels during simulation
* instantaneous change of display on changing starting values
* Tutorial info window
* Capability to access other objects' sensors and methods, perhaps with a pull-down menu
* not distort the aspect ratio when enlarging the view
* Changing window view angle -- with Jed
* fractal sketching tool -- combine the two versions

My own list:
* Implement AND/OR codelet
* Possible improved texture loading routine -- currently it seems every object keeps its own texture. Should make it class-wise.
* Procedure vs function
* moving is not smooth in scriptlet window