Tag Archives: Uncategorized

QuadDistrust

onedayitwillmake No Comments

This is a project I recently created for an installation. It uses the kinect to place the user into a world that has many particles in it – and they basically interact with the particles which are also being influenced by some perlin noise.

It was a spin off of my previous project, CinderRibbons which I never finished because it was getting a little too out of hand.
For this project my goal was simple: Quads influenced by a 3d mapped human skeleton, and perlin noise
I figured that if i scaled down my previous goal, and made it something that was actually attainable i would actually be able to finish the project.

I also decided to put the project on Github, however the code inside is rather messy because as the installation deadline got closer I had to make some, ahem sacrifices. I was actually coding and changing it up until 1 minute before the performer started her dance, while my computer was already hooked up to the projector. That part was pretty frantic.

Here are some images, they are sort of in chronological order, sort of:

Initial “get something on the screen”

Creating a floor plane:


Making quads ‘rise’ from the floor plane

Now add some beautiful perlin noise (Actually this is simplex noise technically)

 

The view from above:

 

All hail the glowing cube:

 

User controlled gravity swarms using the kinect skeleton data mapped back into 3d space:

Project Source Code

https://github.com/onedayitwillmake/QuadDistrust

CinderRibbons project

onedayitwillmake No Comments

Here are some images from a project i’m working on titled CinderRibbons
I basically want to use the Kinect to flood the screen with nice imagery that is in some way or form controlled by the
user – but not in a way that’s easy to tell

Hopefully, you can see the progression as the time goes

 

 

 

 

 

 

 

 

PostADay-Round2#3 – Wheres that file!?

onedayitwillmake No Comments

Here’s a small tip I started using. When coding in C++ it can be tricky to figure out where a file is, relative to the application so there is an urge to simply load the file using an absolute path. It’s really a problem later on if you use a second computer, or time passes or you’re working on this project within a team.

Probably there’s a better trick, but what I do is load the program, pause it, then use the xcode console window (cmd+r) and type, ‘pwd’ and ‘cd’ right in there then browse to the by pressing file – since it starts off in the application you know if you can get to it then you can load it correctly.

PostADay-Round2#3 – List of xcode / GCC preprocessor macros

onedayitwillmake 3 comments

Here is a list of preprocessor defined macros when compiling in Xcode.
Xcode defines a few other macros as well, if anyone knows how to get those to output please share!

So useful!

terminal:$ gcc -dM -E - < /dev/null
#define __DBL_MIN_EXP__ (-1021)
#define __FLT_MIN__ 1.17549435e-38F
#define __DEC64_DEN__ 0.000000000000001E-383DD
#define __CHAR_BIT__ 8
#define __WCHAR_MAX__ 2147483647
#define __DBL_DENORM_MIN__ 4.9406564584124654e-324
#define __FLT_EVAL_METHOD__ 0
#define __DBL_MIN_10_EXP__ (-307)
#define __FINITE_MATH_ONLY__ 0
#define __DEC64_MAX_EXP__ 384
#define __SHRT_MAX__ 32767
#define __LDBL_MAX__ 1.18973149535723176502e+4932L
#define __APPLE_CC__ 5664
#define __UINTMAX_TYPE__ long unsigned int
#define __DEC32_EPSILON__ 1E-6DF
#define __block __attribute__((__blocks__(byref)))
#define __SCHAR_MAX__ 127
#define __USER_LABEL_PREFIX__ _
#define __STDC_HOSTED__ 1
#define __DEC64_MIN_EXP__ (-383)
#define __DBL_DIG__ 15
#define __FLT_EPSILON__ 1.19209290e-7F
#define __LDBL_MIN__ 3.36210314311209350626e-4932L
#define __DEC32_MAX__ 9.999999E96DF
#define __strong
#define __APPLE__ 1
#define __DECIMAL_DIG__ 21
#define __LDBL_HAS_QUIET_NAN__ 1
#define __DYNAMIC__ 1
#define __GNUC__ 4
#define __MMX__ 1
#define __FLT_HAS_DENORM__ 1
#define __DBL_MAX__ 1.7976931348623157e+308
#define __DBL_HAS_INFINITY__ 1
#define __DEC32_MIN_EXP__ (-95)
#define OBJC_NEW_PROPERTIES 1
#define __LDBL_HAS_DENORM__ 1
#define __DEC32_MIN__ 1E-95DF
#define __weak __attribute__((objc_gc(weak)))
#define __DBL_MAX_EXP__ 1024
#define __DEC128_EPSILON__ 1E-33DL
#define __SSE2_MATH__ 1
#define __amd64 1
#define __tune_core2__ 1
#define __LONG_LONG_MAX__ 9223372036854775807LL
#define __GXX_ABI_VERSION 1002
#define __FLT_MIN_EXP__ (-125)
#define __x86_64 1
#define __DBL_MIN__ 2.2250738585072014e-308
#define __LP64__ 1
#define __DBL_HAS_QUIET_NAN__ 1
#define __DEC128_MIN__ 1E-6143DL
#define __REGISTER_PREFIX__
#define __DBL_HAS_DENORM__ 1
#define __NO_INLINE__ 1
#define __DEC_EVAL_METHOD__ 2
#define __DEC128_MAX__ 9.999999999999999999999999999999999E6144DL
#define __FLT_MANT_DIG__ 24
#define __VERSION__ "4.2.1 (Apple Inc. build 5664)"
#define __DEC64_EPSILON__ 1E-15DD
#define __DEC128_MIN_EXP__ (-6143)
#define __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ 1066
#define __SIZE_TYPE__ long unsigned int
#define __DEC32_DEN__ 0.000001E-95DF
#define __FLT_RADIX__ 2
#define __LDBL_EPSILON__ 1.08420217248550443401e-19L
#define __SSE_MATH__ 1
#define __k8 1
#define __LDBL_DIG__ 18
#define __x86_64__ 1
#define __FLT_HAS_QUIET_NAN__ 1
#define __FLT_MAX_10_EXP__ 38
#define __LONG_MAX__ 9223372036854775807L
#define __FLT_HAS_INFINITY__ 1
#define __DEC64_MAX__ 9.999999999999999E384DD
#define __DEC64_MANT_DIG__ 16
#define __DEC32_MAX_EXP__ 96
#define __DEC128_DEN__ 0.000000000000000000000000000000001E-6143DL
#define __LITTLE_ENDIAN__ 1
#define __LDBL_MANT_DIG__ 64
#define __CONSTANT_CFSTRINGS__ 1
#define __DEC32_MANT_DIG__ 7
#define __k8__ 1
#define __WCHAR_TYPE__ int
#define __pic__ 2
#define __FLT_DIG__ 6
#define __INT_MAX__ 2147483647
#define __FLT_MAX_EXP__ 128
#define __BLOCKS__ 1
#define __DBL_MANT_DIG__ 53
#define __DEC64_MIN__ 1E-383DD
#define __WINT_TYPE__ int
#define __SSE__ 1
#define __LDBL_MIN_EXP__ (-16381)
#define __MACH__ 1
#define __amd64__ 1
#define __LDBL_MAX_EXP__ 16384
#define __SSP__ 1
#define __LDBL_MAX_10_EXP__ 4932
#define __DBL_EPSILON__ 2.2204460492503131e-16
#define _LP64 1
#define __GNUC_PATCHLEVEL__ 1
#define __LDBL_HAS_INFINITY__ 1
#define __INTMAX_MAX__ 9223372036854775807L
#define __FLT_DENORM_MIN__ 1.40129846e-45F
#define __PIC__ 2
#define __FLT_MAX__ 3.40282347e+38F
#define __SSE2__ 1
#define __FLT_MIN_10_EXP__ (-37)
#define __INTMAX_TYPE__ long int
#define __DEC128_MAX_EXP__ 6144
#define __GNUC_MINOR__ 2
#define __DBL_MAX_10_EXP__ 308
#define __LDBL_DENORM_MIN__ 3.64519953188247460253e-4951L
#define __STDC__ 1
#define __PTRDIFF_TYPE__ long int
#define __DEC128_MANT_DIG__ 34
#define __LDBL_MIN_10_EXP__ (-4931)
#define __GNUC_GNU_INLINE__ 1
#define __SSE3__ 1

Basic Training in Mathematics: A Fitness Program For Science Students

onedayitwillmake one comments

I stumbled upon the Yale 2006 Physics 201 course on iTunes U. It’s very very good. The professor himself is actually quite a character. After watching about half of the first one, I looked him up on google to see what he was about. There’s no doubt about it, he’s the real deal. One of the first things he said in his physics course was – This is going to be hard. We can’t gloss over the math, there will be a lot of it. Sorry.

I liked him so much, per his recommendation as a study guide I bought his book on amazon.

The Book

Basic Training in Mathematics: A Fitness program For Science Students

It aims to go thru teaching the student (that’s us!) – the “maths” they’ll need to undertake a course in science.
In this case, the professor’s own physics course.

Chapter 1, Page 2

Don’t be impressed, or afraid by that page. It looks scary, but what is going on there is very simple. Thanks to the professors talent in explaining.
Of course you will be googling some math symbols, but again no need to fear “teh scary maff lawlz.”

In order to help me retain more of the knowledge.
I aim to write an example per every section (I would define section as individual significant pieces of knowledge, that make up a chapter. Where a new idea is presented, or previous idea elaborated on in depth).

This is the first one i’ve created. It’s actually laughably simple, but i wanted to make sure I made one before I went to bed. Also it is the FIRST section in the book so I wanted to stay true to that.

Here is ‘a function of x’, where f(x) is continuous, that is – a line can be drawn through it without lifting the pen from the paper:

f(x) = x^2+x/2;

A modest start. Tomorrow I will show the derivative of that function, which should be kind of cool. The classic example is that given the location of a particle P at a time T the derivative of that function is the instantaneous velocity of that particle.

Thoughts on Intelli-J IDEA

onedayitwillmake one comments

Wow. This is the single best code-editor I have EVER used in my life.

  • It is fast.
  • More importantly, It FEELS fast.
  • It gets syntax coloring correct (Can there ever be TOO much syntax-coloring? No. There can be too many colors used, but there cannot be too much syntax-coloring).
  • It has a debugger.
  • It has a very low memory footprint.
  • I can use it for my AS3 / Javascript / PHP / Python / Pearl / Java (I still prefer xcode for c/c++/obj-c)
  • It’s one of the few javascript editors that is not a glorified text editor. In other words it is aware of my properties and their methods!
  • Ctrl+J to quick-view Javadoc for selected method.
  • Ctrl+i to quick-view method implementation.
  • I can export ALL my settings with 3 clicks, and import them into my laptop!
  • It has so many options and things to play with – it recreates that – ooo look what you can do if you press this, feel that makes learning a new IDE fun.

It’s really awesome, and i’ve copied my xcode color settings that Apple probably spent millions of dollars tweaking and now im in coding heaven.

Most importantly, in terms of relative to editor IDE’s it’s “dirt cheap”. FDT is like 500 bucks? WITHOUT debugger? FlashBuilder is like 600 bucks, and it just plain sucks (Everything looks like default text, what are you providing me again? Oh right i forget, annoyance *cough* html-template errors *cough* compiling project keeps producing swf with old code *cough* )

The most basic away3d scene

onedayitwillmake No Comments

Time to get cracking getting back to doing 3D in AS3. I’m very excited for molehill, and i’m excited that at work I am just starting a new project in which we need to use one of the existing 3D packages. Previously i’ve always used Papervision3D, and i felt very comfortable with it and how it works and the ins-and-outs so I was able to get my hands dirty with it whenever I needed and not feel lost.

Well that time is over, Papervision3D has long since been dead.

With Away3D already working with adobe on their future release of their API that supports Molehill, and a new project at work that will require using one of the 3D packages, I can’t think of a better time to start using/learning Away3D. Especially with the aid of my fellow co worker, ‘wu media‘ – who’s a bit of a wizkid when it comes to 3D

Below is a very basic stub. It contains a barebones document class with barebones 3D scene, including one light source.

I find these useful when you need to just have something on the screen and then go from there. So this is also kind of a reference for myself as well.

package 
{
	import away3d.cameras.Camera3D;
	import away3d.containers.Scene3D;
	import away3d.containers.View3D;
	import away3d.lights.DirectionalLight3D;
	import away3d.primitives.Cube;
 
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.events.Event;
	import flash.geom.Vector3D;
 
	[SWF(width="800", height="800", backgroundColor="0x000000", frameRate="60")]
	public class MostBasicAwayDocumentClass extends Sprite
	{
		// Away3D 
		private var camera	:Camera3D;
		private var view 	:View3D;
		private var scene	:Scene3D;
		// Constants
		private const WORLD_SIZE	:Number = 800;
 
 
		public function MostBasicAwayDocumentClass()
		{
			if(stage) init();
			else addEventListener(Event.ADDED_TO_STAGE, init);
		}
 
		private function init(e:Event = null):void
		{
			removeEventListener(Event.ADDED_TO_STAGE, init);
 
			stage.align = StageAlign.TOP_LEFT;
			stage.scaleMode = StageScaleMode.NO_SCALE;
 
			initEngine();
			initObjects();
			addEventListener(Event.ENTER_FRAME, run);			
		}
 
		private function initEngine():void
		{
			camera = new Camera3D();
			view = new View3D();
			view.camera.moveTo(0, 0, -2000);
			view.camera.lookAt(new Vector3D(0, 0, 0));
			view.camera.zoom = 10;
			view.camera.focus = 50;
			view.x = stage.stageWidth/2;
			view.y = stage.stageHeight/2;
 
			addChild(view);
			scene = view.scene;	
		}
 
		private function initObjects():void
		{
			var light	:DirectionalLight3D = new DirectionalLight3D();
			light.color = 0xFFFFFF;
			light.ambient = 0.45;
			light.diffuse = 0.55;
			light.specular = 0.9;
			light.direction = new Vector3D(-1, -1, -1);
 
			scene.addLight(light);
 
 
			//
			var cube	:Cube = new Cube();
			scene.addChild(cube);
		}
 
		private function run(e:Event):void
		{
			view.render();
		}
	}
}

Better Eclipse Icon

onedayitwillmake 2 comments

Eclipse is awesome
Update: Eclipse sucks, use IntelliJ IDEA

However you have to set it up right. I recommend downloading and using only the stripped platform binary (http://download.eclipse.org/eclipse/downloads/drops/R-3.6.1-201009090800/index.php) it should be about ~49M – if it’s much larger then double check you’re downloading the ‘platform runtime binary.’

But let’s face it. The icon sucks

So after looking around I found this.
However as it is, it is a little unusable so i opened up photoshop and modified it a bit to work better at small sizes and decrease the visible hard edges.

Finally i’ve made the .icns file which contains all the appropriate sizes with mask.

Here is the final result

Here’s the icns file for OSX
Eclipse.icns
(if you’re on a PC – post a request and if anyone someone is interested i’ll try to make a .ico file)

To Install

Browse to the Eclipse directory inside your Applicaitons directory. Right click it and select, ‘show package contents’, Go into Contents > Resources and paste the extracted Eclipse.icns file. Restart eclipse.

After that

After that make sure you set the memory and a few other launch arguments correctly, i’m using these:

-startup
../../../plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar
--launcher.library
../../../plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.1.R36x_v20100810
-showsplash
-showlocation
org.eclipse.platform
--launcher.XXMaxPermSize
512M
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms512m
-Xmx1024m
-Xss2m
-XX:PermSize=1024m
-XX:MaxPermSize=1024m
-XX:MaxGCPauseMillis=10
-XX:MaxHeapFreeRatio=70
-XX:+UseConcMarkSweepGC
-XX:+CMSIncrementalMode
-XX:+CMSIncrementalPacing
-XX:CompileThreshold=5
-Dcom.sun.management.jmxremote
-Xdock:icon=../Resources/Eclipse.icns
-XstartOnFirstThread
-Dorg.eclipse.swt.internal.carbon.smallFonts

Again, The real thanks goes to ‘*domox’ for the original imagery, i just modified it a tad to my liking and made the icons.

Sharing a Javascript base class between Node.js Server / Client-side Browser

onedayitwillmake 2 comments

I’ve been using Node.JS a lot lately, and Im really enjoying it.

What is it / How does it work?

I was very hazy about that a few weeks ago other than, “It’s some kind of server and also a buzz word”
Node.js is a very very fast event-based server. Also equally important, the server-side code you write is itself written in javascript.

One of the good things about Node.js is that It has a strong following already. People have created many modules for it already. One such module is a Websocket implementation.

What might I use it for?

We are using it here at work to create an HTML5+Websockets real-time multiplayer game.

In order to make this game work, I have the server running a version of the game – while each individual client is running in their browser a version of the game as well. The server is ultimately the one in charge of killing players / tracking projectiles.

The users merely see a facade of this game they play. Their own character sends information to the server, which they implement in themselves instantly. For example when you fire a projectile, you send that information to the server (what / how fast / what angle). Once the server receives that message, and adds that projectile to it’s running of the game. You see the projectile move, but really the server is now in charge of it and it will let you know when it has hit another player. Other users characters movements are predicted based on the last received information, but continuously checked as new information is received.

For this methodology to work, the server needs to have a version of the game running. This is only viable if the server and client side can share base classes between one another. For example the character/projectile classes are no different on the client or server. We share both between them.

However ClientGameController and ServerGameController differ from one another, yet both inherit from AbstractGameController.

This is the beauty of node, it is very easy to do this and keep the code looking nearly exactly the same on both sides if you use Require.js.

Let’s see it in action

This is a shared Character class implementation.

var init = function()
{
	// some defaults we use
	this.velocity = { x: 0, y: 0 }; // how fast i am going
 
	var CharacterController =  function(aClientID) {
		this.clientID = aClientID;
		console.log('Character ID:', this.clientID); // Node has a console.log so this works perfectly on both.
	};
 
	CharacterController.prototype.doSomething = function() {
		console.log('(CharacterController) doSomething()!');
		return 'hi';
	}
 
	return CharacterController;
};
 
if (typeof window === 'undefined') {
// We're in node!
	exports.CharacterController = init();
} else {
// We're on the browser. 
// Require.js will use this file's name (CharacterController.js)
// to export an object called - CharacterController
	define(init);
 
/*
      // You could use this to require modules before your class is created
      define(['ClassCharacterUses', 'WeaponClass'], 'CharacterController', init); 
*/
}

We are taking advantage of the fact that the browser has a global ‘window’ property. Another thing to note, is how similar Require.js is to Node’s own require syntax.

Node.js+Socket.IO+OSC+Cinder+HTML

onedayitwillmake 6 comments

This weekend I created a way for many people to interact with a native application (and each other) via OSC.

Node.js+Socket.IO+OSC+Cinder+HTML from mario gonzalez on Vimeo.

What you’re seeing:
A native application I created running on OSX
User goes to a web-page via ordinary Safari browser on their iphone
User is interacting with the application
Multiple people interact with the application in real time, via browser on their mac/pc/iphone/android

Repository: