Tuesday, November 13, 2007

Papervision vs Sandy

After reading Sandy 3D's code and tutorials I found that I liked the organization of the code leagues better than Papervision 3D (which I have more experience in at this point). So I decided to do a little test.

In the past hour I wrote the same basic thing in both engines. Other than some features that one had and the other didn't (neither seemed to have a useful concept of 'lighting' - but in the Papervision case I'd already written my own primitive Lambertian reflectance shader so I just reused that), one thing I noticed was that both of them had problems with z-index culling - putting one triangle on top of another that shouldn't be.

I did a lot of reading on Sandy and tried all combinations of their culling and didn't manage to solve it. Only thing I could find in Papervision is an arbitrary z-depth sort for objects for the camera.

P.S. If this example looks familiar to you it's no mistake - I'm actively dreaming these days of making a Final Fantasy Tactics style game in full 3D (not just iso) in flash.

Sandy Example
Papervision Example

Also, the Papervision performs notably better. So as much as I like the structure of Sandy better I may not be using it as soon as I'd like.

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.
(RSS feed)