Adrian Herbez Rotating Header Image

Posts Tagged ‘javascript’

The start of something… cardboard

This is an experiment in using composite modes with canvas rendering to achieve a 3d effect, allowing users to “paint” shapes in cardboard. At present, it’s possible to draw shapes with the mouse, and to erase them, all the while maintaining the illusion of 3d cardboard, thanks to both an interior and exterior layer.
This is just a start though- I’m hoping to develop this into something much more interesting.
To see what I have so far, head here, or just click on the image.

projects ,

SETI: the game

A few months ago, I attended SETIcon, which was all-around wonderful. However, I thought that the panel on science and videogames left quite a bit to be desired. Several SETI-themed games were presented, but I felt that they were more about overlaying a SETI theme on unrelated mechanics.

Which got me thinking… what would a game that lifted its mechanics (as well as its theme) from SETI look like? I had an idea that I thought could work, and it sat around in my notebook until this past Sunday when I found myself at a laundromat with a laptop and some time to kill.

setigame v0_1

The game takes the form of a puzzle game, where the player has to tweak settings to extract a digital image from a noisy analog signal. The fiction of the game is that aliens are sending a sequence of 1s and 0s that will create an image when properly viewed. However, there are a couple of obstacles in the way:

  • traveling through space has rendered the signal noisy
  • the player doesn’t know the specifics of the alien transmission standard

So, the player has three things that they can alter:

  1. the threshold of what amplitude constitutes a 1 This translates the analog signal (the top-left waveform) into a digital one (the bottom-left)
  2. the width (in time) for each sample This alters the way in which the analog signal is translated into the digital.
  3. the width of the image This controls how many pixels there are per row of the final image (displayed to the right

The threshold value can be changed by clicking and dragging the gray box, and is represented by the green horizontal line. The other two values have to be entered in the fields at the bottom of the interface (for now- I plan on making them visually draggable as well).

I wrote a small Python script that can be used to translate a given low-resolution image into a sequence of noisy values (like this). The demo only has one image, but it’s one that’s bound to be familiar to SETI enthusiasts and science nerds in general.

To try it for yourself, head here.

projects , ,

algoclass: week 1

As I work my way through Stanford’s excellent online class on the design and analysis of algorithms, I’ve decided to up the ante a bit on the homework assignments- not only will I do the stated assignment, but I will also wrap it up in some manner of game or game-like interactive demo. This is the first such demo.

This week’s assignment was to implement merge sort and then to modify the merge sort implementation to count the number of inversions (or out-of-order numbers) in an array of integers. Inversions are useful, as they allow two lists to be compared, with the number of inversions functioning as a metric of how similar they are.

In this game, the goal is to guess the correct ordering of the eight colors. Each time the page starts, a random order is selected. To play, try to guess what it is by clicking on the color swatches to the left in an order of your choice. Once you’ve ordered the eight colors, you’ll see a small version of the order with a red/green bar at the bottom. The red/green bar corresponds to how far away you are (number of inversions / max possible number) from the correct order. The game (although a very hard, possibly unfun one) is to use the information about past guesses to inform your choices.

projects , ,

jsdemo: void

I finally got around to playing Bastion this weekend, thanks to the always-amazing Humble Bundle.

I thought that the way in which the ground rose up to meet the main character was particularly beautiful, and decided to try my hand at recreating it in javascript, and this was the result. The arrow keys move the character around in the world as ground tiles rise up to greet him, and objects (well, an object, a television) falls from the sky.

Click on the image to see if for yourself. Art for the character and the television came from

projects ,

jsdemo: Plants

I was at a really great open studios event in Hunter’s Point, and saw some beautiful paintings that included (amongst other things), undulating plant forms.

I thought it would be fun to try to recreate such things but via code, and animated.

To see it in action, click on the image.

projects ,

Ludum Dare: Tiny World

I just participated in my first Ludum Dare competition, with the theme ‘Tiny World’. My game is a bit small, even by Ludum Dare standards, as I’m currently on vacation, so only had the plane ride, plus a bit of time here and there to work on it (not that I’m complaining ;) ).

In the game, you take on the role of a planet builder, tasked with creating planets from matter floating through space. The game lies in rotating the planet so that the matter is evenly distributed, and rejecting matter of the wrong type (each level has different requirements for the planet).

To play the game, either click on the image, or go here.

projects , , , ,

Rule 30: the game

I recently bought a conus textile seashell to give to a young relative of mine that loves science. Conus Textile shells are really cool, because the pattern on their surface is almost identical to that created by a simple 1-dimensional cellular automata with 30 as the ruleset. But instead of just giving her the shell, I wanted to make her earn the gift through a game-like exploration of cellular automata, with the shell being the big reveal after she’s completed it.

This is a first pass at such a game. At the start, a single line with random state is presented to the player, along with a blank line. Mousing over any of the cells will highlight the three previous cells that determine the state of the mouse-over cell, and clicking on the cell will toggle its state. Once all of the cells in the new line are correct, a new line is added to the display. Over time, the distinctive pattern found with rule30, and on conus textile shells, will emerge.

projects , ,

Projection party game (Things)

This was a small project I put together for my girlfriend’s birthday party. She wanted to play a party game whereby:

  1. a topic is presented
  2. each player writes out a response
  3. all the responses are read aloud (with ensuing hilarity)
  4. everyone tries to guess who said what

I put together a web-based version of the game that we then projected onto the wall of her living room. The game is controlled by a strip of controls along the bottom of the page which, when presented fullscreen, is cut off by the way I had the projector set up.

The controls allow for a new entry to be entered, with both the name of the person that said it and what they said. Only the actual statement is shown, with the name being hidden. Once everyone has submitted their answer, the ‘Reveal N’ button steps through each answer, revealing who said what.

The topics come from a simple MySQL table, but new topics can also be entered on the fly via javascript (to allow for audience suggestions). If you would like to try it, head here, or click on the image above.

projects , , ,

Minecraft player skins papercraft tool

mskinThis was a way to generate buildable papercraft templates from a given Minecraft skin image, written in javascript.

To check it out for yourself, go here.

projects ,

Hacking Mechanic demo

I was thinking about hacking and lockpicking minigame mechanics, and it occurred to me that it would be possible to modify nonogram puzzles to provide a fun “hacking” mechanic. I threw together a demo using HTML5/javascript, which can be played with here.

It ended up being more of a 2d Rubik’s cube than a nonogram variant, but I thought that that provided a more enjoyable experience.

projects , ,