Contraptions Design Specification
Section 3.7.x : Widgets
By Kenneth Manta
Boom! Kerplunk! Chica Chica Chica!
TODO
Convert all widget X,Y positions to unsigned short ? or make them all a class holding both
Warning:Deathscript is horribly broken
Widgets Overview
What do the widgets REALLY do? Each widget should grant the game a new ability that it could not do before.
Generic Widget Properties
Widget Design Patterns
- Scripted
- Serializable
- Undoable: Each widget event response must cause an undoable, retroactive event, or future permanent event
Widget Properties
- Type
- Life
- Rotation
- Temperature
- Powered
- On
- Info: Session specific data
- Tune: Tweakable parameter, edited by the widget editor.
- KillMe: only used on master session to ensure that a killme event only gets called once
Widget Signals
- Activate/Deactivate
- Turn On/Turn Off
- PowerOn/PowerOff: How does this work when the ship is detached? Each power source sends a poweron every frame? each widget can hold up to 4 charges and drains a charge per frame.
- Damage: event when a widget is damaged?
- Create
- Destroy
- Touch
- Client Frame
- Master Frame
Default event responses
- TurnOn/TurnOff: Increment or Decrement the On Value
- PowerOn/PowerOff: Increment or Decrement the Powered Value
Widget Action Patterns
- Dohickey Emitter: Guns
- Widget Generator(Outputs): Coco launcher, Shreaded wheat
- Move Ship: Thruster, Tractor,Repel Beam (The Physics engine does not like these)
- NoEffect: Camera
- Signaler:Remote Control, All Power Sources
- Signal Transmitter
- Event Trigger: Armor, explosives
- Commander: All Types: Warring Types of Fetuses
Widget Properties Info
CWidgetProperties
Certain properties of widgets are the same per type of widget.
Currently Widgets.txt contains the default widget information.
#NewNumber:OldNumber:Rotation:Mass:Text Name:3DS Multiplier:3DS file:Description
"Widget Properties" Design Patterns
Per widget Properties
- Name
- WidgetNumber
- Description
- Mass
- Initial Life
- Bounce
- Friction
- EditorImage
- GameImage
---Old Properties---
- OldNumber
- 4 Rotations based on old number
Global widget Properties
- Life multiplier
- Initial Life
- HyperGuns
- HyperThrusters
- Widget launcher type
Delayed response of destruction of widgets
Since the existance of a widget has a huge impact on the physics engine. Weather or not a widget is destroyed in a laggy game can drasticly affect if the clients become out of sync.
The destruction of a widget should take about 1/2 a second. Breaking apart graphical effects can occure during this. Since dohickeys dont have any real impact on the game, they may pass though a destroyed widget.
Widgets

Click Here for the widgets in The Ship Game 3.
This section will describe each widget, unique ability, and reason for being added to the game
Command Module
Binds a player to a ship. The ship editor will only permit a control assignment to this if a camera is already placed on the contraption.
Responses
- Activate/Deactivate: Sets current view camera to the contraption this resides on.
Power Source
This allows a player to control a contraption. It represents the computer input. This should have been the only piece that could obtain input from the keyboard/other.
Responses
- Activate/Deactivate: Send turnon signals
- Create/Destroy: Send poweron signals
Thruster
Allows a contraption to move.
Responses
- TurnOn/TurnOff
- Client Frame{
Emit(FireFlameDohicky);
While On, this will apply a pretend force on simulated physics frame. This does not get placed in the actual physics engine. It is simply an estimate made by the display functions of where the ship will jump to if it gets permission from the master session to move there. This is a prediction on the client.
}
- Master Frame{
While On, this will apply a force each physics frame. A client activating a thruster will inform the server which frame it was activated on. The server will permit the client to retroactively turn the thruster on and skip to the position it would have been in. For this to be permitted, the client must be able to move to the new position and not touch any objects in the process. It must also not touch any objects in the new few frames to permit the movement change to propagate to all the clients.
Thrusters wait 1/8th of a second before thrusting, this will also help with network sync.
}
- Destroyed(Optional)
A destroyed thruster will continue to emit smoke during its 1/2 second last bit of life
Widget Launcher: Cocolauncher
A limit on the coconuts launched needs to be created.
Responses
- Client Frame{
Nothing! Or smoke to hide the actual initial position of the coco?
}
- Master Frame{
if (On){
Several frames ahead of the actual Cocolaunch, the server notifies all clients that the coco will be launched
}
}
Copyright 2004 © Polyart. All rights reserved.
Designed by Kenneth Manta