Deliverable 2: Custom A-Frame Component Generation
Description:
The goal of this deliverable is to create a system that constructs A-Frame components based on user input.
Components provide the appearance, behavior, and functionality of entities in A-Frame.
Thus, generating custom A-Frame components that are interpreted from user commands will enhance the capabilities of the current system.
This deliverable also includes a parser that validates the generated A-Frame components to make sure that the components are functional and appropriately integrated with the A-Frame environment.
Afterwards, the serialization module will be updated to support Javascript components. Finally, we'll test different scenarios and components to evaluate their quality and accuracy.
Project: A-Frame Project
Implementation Steps:
- Create component generation system
- Parse Javascript components
- Integrate components with A-Frame entities
- Update Serialization to include Javascript components
- Test custom component functionality
System Design Update:
- System Instructions Added:
- If a user requests an entity with behavior or appearance that requires functionality beyond standard A-Frame components, interpret this as a cue to generate a custom A-Frame component designed to implement the requested behavior or appearance. This custom component should then be directly included within the entity's <a-entity> HTML tag by specifying the component's name as an attribute, avoid using setAttribute() in javascript for this purpose.
- Each individual custom component should be within its own <js> tags. If there are multiple components, put each in its own <js> tags, i.e <js> ... </js> <js> ... </js> . Also, these tags should be outside <a-scene> and <a-entity> tags.
- For entities that require button event listeners, use a custom component instead of the event-set component. Also, use mostly the trigger button to handle the events in the event listener.
- Whenever there's a request to modify an existing custom component's behavior or functionality, don't alter the original component. Instead, create a completely new component with a different unique name(i.e change name from 'orbit' to 'orbit-2'), and update entities in the scene to use the new version of the component.
- Follow this structure for generating all custom A-Frame components with a simple unique name, ensuring consistency and quality: AFRAME.registerComponent('unique-name', {schema:{...}, init: function(){...}, update: function(oldData){...}, tick: function(time, deltaTime){...}, remove: function(){...}, pause: function(){...}, play: function(){...}});
Testing Results:
Edge Case Testing Results:
Test |
Command |
Description |
Handled |
1 |
Create a sphere with an orbit component, Add an orbit component to the same sphere |
Test component registration with a name already in use |
1 |
2 |
Create an cube with an empty component |
Test a blank or empty component |
1 |
3 |
Create an entity that can travel at the speed of light |
Test component with extreme/impossible physics |
1 |
4 |
Create an entity with a rotate component that is inside a semi-transparent entity with a rotate component |
Test nested entities with the same component |
1 |
5 |
Create a cube that tastes like a pizza |
Test ambiguous or nonsensical prompts |
1 |
Test 3:
Test 4:
Test 5:
|