BuysDB.nl

Home of Buys de Barbanson

WIP logic sandbox game part 3

This is a followup on part 2

I made many changes and will start to discuss the changes to the game engine. As I hadn�t taken any special attention to the performance of the engine so far, creating fancier effects resulted in the fps counter dropping dramatically and it was surely the right time to work on the performance. In the past the engine used a single canvas to draw all graphics on and every frame all graphics were refreshed. This method works fine for simple graphics but as I was adding shadows and many textures; many of these textures are static in appearance but expensive to render and thus a waste of resources to redraw every frame. I implemented an often used strategy; multiple stacked canvasses which are only updated when necessary. The temporary drawback is that I had to alter the render code of every element which I had put into the game so far; the engine changes and updating the render routines took about 8 hours. The result is worth it: the impact of adding more elements to the simulation on the frame has dropped severely and the new graphics result in a better experience.

Elements

Many new elements were added and others updated. First the logic gates; these have a symbol now which indicates its type and are configurable to allow for bus input; the logic gate will perform its logic operation on every line of the input busses and return the output per line in the input busses to the output bus. An option to allow for more than two logical inputs is planned.

A new input device has been added; the selector knob. This knob either performs line selection or returns a binary coded digit; in the first mode only the selected line is set to high in the output bus, in the latter mode the selected number is sent to the output in binary format. When clicked upon the knob will advance one position, the positions themselves are also clickable advancing the knob directly to the desired location.

A DAC (digital to analog converter) device has been added, which allows for picking a either digital or mechanical mode of operation. In the first mode the digital signal will be mapped in a range from zero to one. In the second this is performed by using a whiffle tree. The whiffle tree is completely animated (the amount of bits, and thus whiffles is customizable) and the output result is based upon the measured position of the top whiffle [animation on youtube]. A corresponding ADC has been added too; the analog input is mapped from a range from 0 to 1 to the selected digital range. Finally a device to create sine waves has been added.

Updates

The elements are now colored in order when placed (every next object you place will have a different color then the previous); this preset color can be changed later. By default when a wire is placed it will take the color of the sending element which makes working with bigger simulations a little easier as it�s easier to comprehend the structure.

I hope to make a public version soon, stay tuned!

On the left: the selector knob in two different modi. The binary mode configured selector knob signal is passed to a 7 segment display and a whiffletree DAC.Image of the logic gates configured to allow for bus input.
Link to this article