Sunday, May 10, 2009

Physics test

Cool, sat down tonight and managed to make a completely elastic solution using Box2d:
[link]

This is after reading up on / trying out APE, fisix, and FOAM. Box2d is a lot more work and has rather poor documentation, but at least the project has had activity recently.

Tuesday, February 24, 2009

Camera capture for Paint

Paint 0.03 Up

New features - beginnings of a filter chain system, and the ability to capture input from a camera. If you have a webcam, click the 'camera' icon at the top. You can drag and rectangle on the video feed and then hit capture to send it to the image.

Friday, February 20, 2009

In AD2009, dungeon was beginning

New Tilepainting Demo

Click any of the tile icons above to change your 'brush' to that tile. What you're actually doing is changing your paintbrush to a color that is mapped to that tile and then painting with the color which is displayed as a tile. The little 'actual' representation in the corner is what is actually getting painted internally.

(EDIT: Ctrl+Click also works to eyedropper a tile, but I didn't do anything to make this work. Gotta love inheritance!)

Thursday, February 19, 2009

Weapon Editor Test

New version of Paint Example Up

This version is a complete rewrite as a flex component and adds color picking (Ctrl+Click - would've done Alt but you can't catch that event in flash *shakes fist*), a preserve transparency mode, support for non-square pixels, auto-stretching to the container size, more grid options, and improvements to the Graphic and GraphicResource classes.

This example also shows a GraphicResource being dynamically loaded, building auto clip names from a uniform grid (they're named "Xindex,Yindex"), loading clips by name, locating clips by pixel offset (click anywhere on the resource map to load that clip into the paint component).

I also have the first step towards a dungeon editor (TilePaintCanvas extending PaintCanvas - to paint with sprite tiles instead of just colored pixels)

And now, some SleepPaintCanvas.

Wednesday, February 18, 2009

Chunk and BitmapCamera

New system and test: BitmapCamera.
The only fast reliable form of panning is via bitmapData and draw()/copyPixels(), as far as I know. And I've tried a LOT - including writing pixelbender shaders, crazy memory flop tricks and every form of bitmap caching available.

The fastest method I call the BitmapCamera. Run a copyPixels on everything that the window 'sees' doing appropriate transforms. Don't render a single pixel that doesn't need to be there (especially not transparent). So, in taking from MMO client methodologies, here is a culling BitmapCamera. Basically, if we can't even see the object, it's not even going to be considered (and may not be in memory). You can expand that to include dynamic loading/unloading of tile pieces, and if you know enough about the prefetch paths (for example, with a Graph or BSPTree), you might know WELL in advance.

This code was written stealing the architecture from that of common 3D clients, abstracted down into simple classes, and then extended as "Bitmap" versions of them. However the scene type class that I have doesn't care what it is, so it could work to do a portalcast/scenegraph for a 3D flash renderer.

In this example, use the arrow keys to move the 'camera'. Sprites that are out-of-frame (represented in red) will go transparent to denote this. The blue doesn't mean anything here but the possibility of a loading/unloading hysteresis.

BitmapCamera test 01

(EDIT: I added mousewheel support... mousewheel while keyboarding around to change the camera size - on flash 10 it should still be quite fast even at 800+ pixels)

Quick Beginnings









[fullscreen]

Tuesday, February 17, 2009

mx.controls.Image

Blast you, Image class. The 'goods' are stored as an internal namespace'd variable named contentHolder. There are two methods to set this from the outside.
  • via source: this expects to be a url string or a IFlexDisplayObject class (generally one auto-generated by the @Embed directive)
  • via load(): see source above
Unfortunately, no one thought that maybe you would already have the data or you were generating it fresh. Of course, you'd ask, why would you need the Image class then - why not just make a custom component? Because then you'd have to rewrite any and all of Image's other features that you wanted (and making a horrible OO-fail example in the process). So basically I wanted a UIComponent that had all the features of Image but could also accept a bitmapData and some other stuff as inputs.

For what I'm doing (preloading resource chunks), I decided on a pattern of two coupled classes: GraphicResource and Graphic. They both derive from Image, but a Graphic is only really useful if it has a linked GraphicResource so it can pull bitmap clips out of it. There are probably better ways (maybe not better, but more Kosher) of doing this, but I'm sticking with this for now. Theoretically the GraphicResource can still be a Vector Sprite while the Graphic is a Bitmap in this setup, but I don't have a concept yet of having a Graphic pull out a vector asset from a swf contained in a GraphicResource. First show me wash the car.

Also ignore the fight menu stuff... none of that is functional.

Now with 100% more Dragon

Tuesday, February 3, 2009

Quick One

Made a Graphics Editor in 15 minutes. Should make it a proper component and remove some of the bitmap hax, but for another night. Scroll the mousewheel over the editor part to resize the editing window. Color picker on the top.

Monday, December 3, 2007

Sad Blue Faces

Haxxed it away for now: The tiled floor is always 'behind' the faces now. Made the tiled floor random (based on sine waves). Gave the tiles multiple textures now per tile. Create characters only on blue ones. Drag to rotate camera.








[fullscreen]

Familiar Faces

Ok, added some planes with textures on them that always point at the camera. Now the culling issue is quite obvious: whole objects (based on their centers) are being sorted first instead of dumping all the triangles into the same sorter.

I can see the reasoning for this but it ultimately fails at what I'm trying to do here. I may have to write my own split-triangle culler or even test out writing a z-buffer system (though think that will probably kill speed entirely).

Notes: Click and drag to move camera. Be patient for images to load.








[fullscreen]

Wednesday, November 14, 2007

Constructive Geometry

Made a TileTerrain class that uses constructive geometry to build it instead of cubes. Solves a lot of the problem - not perfect though but the final tweak to this method is much harder so that will come later.








(RSS feed)