Sunday, October 28, 2007

Polar Color Test

More complicated Entity Test

Still entirely nondeterministic, but now I've added some more color controls. Some of these particles are positive poled and will naturally attract, some will repel. Hold down the mouse to invert the magnetic pole of the mouse (and increase the power of the magnet).

Tuesday, October 23, 2007

Companion Sphere

Abject return value chain abuse here:

em.addAffector(new MouseAttractor(5)).assign( em.addEntity(newe(0,0xEE0000)) );
em.addAffector(new MouseAttractor(-5)).assign( [em.addEntity(newe(90)), em.addEntity(newe(180)), em.addEntity(newe(270))] );

Creates this version, with 3 of them hating the Mouse and 1 loving it

(newe() in this case just makes an entity with a circle drawn and a start angle with a velocity of 10 and a color)

Uno Mas

Added a 4th Affector that will attract to the mouse cursor if you get close enough

Entity First Tests

First Entity Test

I'm rebuilding my particle system around a couple base objects: Entity, EntityManager, EntityEmitter(optional).

Entities are Sprites with the ability to be updated via a delta 'time' slice. They support nondeterministic animation through this system natively, but they also can each have their own timeline objects to have properties of themselves deterministic.

EntityManager objects manage groups of entities and serve as a single point of contact to update or evaluate an entire group. They also manage removal, and Affector chains.

The whole entity thing is basically a way to get things like Affectors without having emitters - so I can write an Artificial Intelligence Affector for an enemy that needs updating/main loop service.

This example has 4 entities and 3 affectors (WobbleAffector, VelocityClampAffector, RadialSoftBoundsAffector).

Flash? in my YouTube?

http://www.lostinactionscript.com/blog/index.php/2007/10/13/flash-you-tube-api/
Saved here for future usage.

Entity is coming

rewriting particle framework, brb

Saturday, September 22, 2007

Flash 9 Dance Dance Revolution

Very simple rhythm game written with help of my existing gemini lib for AS3. Game itself is 270 lines of code, including MXML. This doesn't include the libraries, but the two new classes RhythmTimeline and RhythmKeyframe are only a couple lines each on top of the existing timeline stuff.

Each keyframe has a 'radius', the distance at which a hit is viable. When a key is pressed, I dig through the behind and ahead heaps up to a given max distance (the maximum radius that you use is a good value), to build a list of possibly 'current' ones, and then I go over this list testing absolute distance versus radius to get a final list.

Most of the speed problems are due to the movement of the sprites (and the fact that I'm creating all the sprites ahead of time and not as needed - easy to fix). I really need to steal/write a good parallax scroller to do this for reals. I found when I added a clipping mask to the keyframes I lost like 20x more speed, so I left it out for now.

There are some small issues regarding visual position not syncing perfectly with the audio (it actually IS synced, but the write and flush delays are hurting it), so sometimes it may feel like you're being gypped. Also this song is probably not the best choice is it actually seems to drift in parts (the latter half of the song is almost perfectly mapped).

You can drag to scroll around the music, and hit the "a" and "q" keys on your keyboard to dance with intensity. You may need to click in the browser (anywhere) to get the keys to recognize (I know how to fix this).

Be patient if you have a slow connection, song is just under 3mb and I didn't make a loader.

Enjoy!

Silver Screen Dance

Wednesday, September 19, 2007

Introduction

Hello, welcome to my new experiments blog. Any and all posts before this were made in my livejournal before I had set this blog up. I figured I should have something specifically for code experiments so that it's separate from my personal journal.

Most all of these experiments are Actionscript 3.0+ and built in Flex 2.0+ and as such to view any of the examples, you must have the Flash 9 plugin installed. Some of the examples require additional things (web cams, mics, wiimotes, etc).

I will be posting source code for any of the projects that become mature enough to warrant posting. Source code is available for other examples on request (use at own risk).

Herd of Boxen

FROM http://oizys.livejournal.com/228030.html

Obvious next step

My particle emitter + Papervision3D

PaperVision Test 2

FROM http://oizys.livejournal.com/227760.html

Balls are out

click and drag to move the camera

3D? In my actionscript?

FROM http://oizys.livejournal.com/227335.html

I downloaded Papervision 3D today and started learning it.

So far I've made my own material (ShadedColorMaterial), based on the Lambertian reflectance half of Phong shading, and my own object with its own custom renderer (BoundingCube - has no faces but only vertexes and custom drawn edges).

My first Papervision Tests

You may find the shape/proportions of the object familiar. This is by all means intentional.

Shapes

FROM http://oizys.livejournal.com/226330.html

Last night I wrote a standardized shape baseclass with the important draw() and clone() abstracts and some handling of size/color/line etc, and then moved all my shape scraps to this.
Here is a Gear class which is derives from Star.. and a ShapeParticleEmitter that emits shapes by using their clone(). The joy of this is that you can change the "prototype" object at will and the next particle emitted will be a clone of it in its current state.

I realize there are better Shape libraries out there already (hell there are better Timeline libs out there than mine), but I like the joy of making it and of making it how I invision (plus being able to optimize it).

While digging around looking at flash stuff I found two amazing sites:
Papercritters.com - (here's my first one)

Let Them Sing it for you
(RSS feed)