Artsy Programmer Vs Nerdy Artist

Just another confused site


The Magic Touch Part 1

The issue:

You are on your way to making a 3d android app and you want to be able to select an object by touching it. But wait, that’s not all, you’d actually like to have the selected object follow your finger as you drag it across the screen.

This was a battle for a couple days, first in just getting selection working, and then blowing up into a tripple dot problem* where I all of a sudden had to deal with thread synchronizing for the rendering thread (something I was hoping future me would have to deal with).

If you are also looking at how to select something and move it around, you are at the right spot. Since I’m building a desktop editor for PandaDroid, these examples will be using my own matrix 3d class and keep the low level opengl calls just that.

First problem: How do you select an object given only an x and y coordinate?

Some graphics api’s have a way to do this. Unfortunatly, opengl es 1.0 does not, thus you are left with couple options. One can be to render two images and color coding objects so that you can test which object was selected. Unfortunately overlapping cannot be handled in a custom way . Another way is to send out a ray and see where it intersects. This article will be covering the ray cast selection method.

The basic principle here is that you draw a line from a camera’s view to the x y coordinate and then you see if that line ever intersects an object. The simplest way to represent a line in 3d is by representing it as a ray. A ray is 2 3d vectors: one being a point that the line intersects, and another vector that is a unit vector describing the slope.

So here’s our ray:

public class Ray {
  public Vector3d position;
  public Vector3d direction;

  public Ray() {
    this.position = new Vector3d();
    this.direction = new Vector3d();
    //My Vector3d's have a 4th component that can be 1 or 0.
    //if it is 0, the vector won't be transformed by the translation, thus this
    //vector will only be rotated or scaled. If you do not have a 4th component
    //you will have to do 3x3 matrix transformations on the mDirection vector
    //or recompute the direction by subtracting the position and normalizing
    //the direction after the transformation.
    this.direction.makeDirectional();
  }
}

And we need to create a ray when given an x and y coordinate. To do this, I’d suggest making a camera class and it would be able to create a ray. The reason for this is that in order to create a ray you will need the near plane, the near height, the aspect ratio, and the inverse transform matrix.

Creating a ray is pretty simple, you just find the actual x y coordinates of the point on the screen based on scaling the points by finding the ratio of the positions and multiplying them by the near height and the near width (near height x aspect ratio). Then you set that as the direction and normalize that vector. The position is set as 0, 0, 0 and then you transform the ray by the inverse camera matrix so that the ray is now in the world space.

public class Camera {
  private Matrix3d mTransformation;
  private float mNear;
  private float mNearHeight;
  private float mAspectRatio;

  public Ray createRay(float x, float y){
    //first, convert x and y to a coordinate system where
    //(0, 0) is at the center of the screen
    float halfHeight = (float)this.mHeight/2;
    float halfWidth = (float)this.mWidth/2;
    float xUnit = (halfWidth - x)/halfWidth;
    float yUnit = (y - halfHeight)/halfHeight; //Flip the y for android.

    //now create the ray!
    Ray ray = new Ray();
    ray.direction.set(xUnit*this.mNearHeight*this.mAspectRatio, //x
                                  yUnit*this.mNearHeight, //y
                                  this.mNear); //z
    ray.direction.normalize(); //make it a unit vector
    ray.postion.set(0.0f, 0.0f, 0.0f);

    //invert the position of the camera so that we can transform the ray
    //into world space location.
    Matrix3d inverse = this.mTransformation.clone();
    inverse.invert();

    inverse.transform(ray.position);
    inverse.transform(ray.direction);
    return ray;
  }
}

Now that we can get a ray, we can find an object in the scene. This part gets a bit more difficult as there are many paths to pick depending on how you want to select things and what is considered selectable. Both of these issues depend on the application and the performance you need.

One thing that is probably the same with all the paths is that you need some type of list of selectable objects, and each object needs to have an accesible world space matrix and some way to test for ray intersection. A question that you must answer is how do you deal with overlapping objects. For me, I just sort the objects by how close they are to the camera so that the closest object is selected.

Once you have that part figured out, you need to figure out how you want to test for intersection. I’ll show a way to test intersection with an axis aligned box. An aab is simple to create. Basically its just the minimum and maximum values for x, y, z of a mesh’s vetices in the mesh’s local space. The creation of the aab can be done while importing a mesh. An aab is nice for testing because it runs constant time in respect to the mesh triangle count.

So before going onto the aab intersection, here’s an example of how the picking will be done.

public class Renderer {
  private List<Node> mSelectableNodes;
  private Camera mCamera;

  ...
  //Update the scene, sort the selectable items by some method, and
  //rendering code here
  ...

  public Node select(float x, float y) {
    Ray ray = mCamera.createRay(x, y);
    Ray objectRay = ray.clone(); //so we don't need to recreate the ray each loop
    for(Node node : this.mSelectableNodes){
      if(node instanceof Model){
        Matrix3d inverse = node.mTransform.clone();
        inverse.invert();
        inverse.transform(objectRay.position);
        inverse.transform(objectRay.direction);
        if(node.intersectsRay(objectRay)){ //test the intersection!
          return (Model)node;
        }
      }
    }
    return null;
  }
}

Now the hard part, the intersection. The method being used is by trimming the line represented by the ray by all the sides of the box and seeing if the line still exists.

public class Node {
  private Vector3d mMin;
  private Vector3d mMax;

  ...
  //code about how to render and update this node.
  ...

  public boolean intersectsRay(Ray ray){
    float distanceNear = Float.NEGATIVE_INFINITY;
    float distanceFar = Float.POSITIVE_INFINITY;

    //Reduce the problem to 2d by testing the box's sides for x, y, and z.
    for(int i = 0; i < 3; i++){
      float boxMin = mMin.get(i); //make Vector3d's iterable is helpful here
      float boxMax = mMax.get(i);
      float slope = ray.direction.get(i);
      float offset = ray.position.get(i);

      if(!Util.floatEquals(slope,0)){
        float distanceMin;
        float distanceMax;

        if(slope > 0) {
          distanceMin = (boxMin-offset)/slope;
          distanceMax = (boxMax-offset)/slope;
        } else {
          distanceMin = (boxMax-offset)/slope;
          distanceMax = (boxMin-offset)/slope;
        }

        //see if this is closer
        if(distanceMin > distanceNear){
          distanceNear = distanceMin;
        }
        if(distanceMax < distanceFar){
          distanceFar = distanceMax;
        }

        if(distanceNear > distanceFar){
          return false;
        }
      } else if(offset < boxMin || offset > boxMax){
        return false;
      }
    }
    //if we make it here, all is good!
    return true;
  }
}

And there you go. With all those components, you should be able to call the Renderer.select(x, y) method and get the selected node.

Stay tuned for Part 2! That’s where you’ll be able to have the object follow your finger’s position. so it’s like the reverse of selection.

Notes:

* Tripple dot problem: My college physics book would rank the difficulty of a problem by placing dots by them and the hardest problems had 3 dots by them.

References:

AAB Intersection
Ray Selection

Published by tespirit, on October 23rd, 2010 at 8:46 pm. Filled under: Android,Java,Pandadroid,ProgrammingNo Comments

When Apples Fall

They sometimes hit you on the head, and you have an epiphany. Or just a lump on your head… In both cases, the apple falls because of gravity. While the theory of gravity is interesting (seriously, how come everything just attracts without the concept of oposites attract?), it does not solve the problem of how to account for constant gravity in a particle system.

The big issue I ran into implementing constant gravity is that it is just an acceleration, not a force. So when computing the final force, I end up proving that heavier objects fall slower than lighter objects. Clearly that is not right… Or maybe I just found out another lie I was taught in school…

So I wasn’t able to treat constant gravity as the same as a force or I would have to treat all forces as accelerations and compute the force based on the acceleration. The latter has too many issues in that it wouldn’t allow for an external force. I thought back to how it was done at my previous job. Constant gravity was just built in to every physics object. Well that sucks, mostly because it makes programming hard for changing that value at runtime or dealing with things that don’t need that information.

After thinking about this for a bit, I ended up with creating a force class that applies a force to a particle and this way constant gravity can grab that important information needed for computing the gravitational force: mass.

Thus instead of adding up all the forces and then applying the final force to a particle, each particle is passed through each force, where the force can then properly apply itself to the particle.

How do you go about this?

First, create an interface for a force (this doesn’t have to be just a particle force system, though that’s the current application) and some type of object to have the force applied to.

public interface ParticleForce {
	void apply(Particle particle);
}

//new file obviously
public class Particle {
        //Vector3d is a 3d point class, you can use an array of 3 items for now
	private Vector3d mPosition;
	private Vector3d mVelocity;
	public Vector3d mForce;
	public float mMass;

        public void update(float deltaTime) {
                this.mVelocity.addScale(this.mForce, deltaTime/this.mMass);
		this.mPosition.addScale(this.mVelocity, deltaTime);
        }
}

Second, create some type of class that will handle updating the particles.

public class ForceUpdater{
	private List<ParticleForce> mForces;
	private List<Particle> mPatricles;

        ...
        //code to add forces and particles
        ...

	public void update(float deltaTime){
		for(Particle particle : this.mPatricles){
                        particle.mForce.set(0,0,0) //reset the forces
			for(ParticleForce force : mForces){
				force.apply(particle);
			}
                        particle.update(deltaTime);
		}
	}
}

Third, create a constant gravity class:

public class ContantGravityForce implements ParticleForce{
        private Vector3d mAcceleration = new Vector3d(0, -9.8, 0);
	public void apply(Particle particle) {
                Vector3d force = mAcceleration.clone();
                force.scale(particle.mMass);
                particle.mForce.add(force);
        }
}

All that is left from here is to add a gravity force and particles to the ForceUpdater. And of course implementing a Vector3d class (or just grab mine from the PandaDroid repo in the com.tespirit.bamboo.vectors package).

And with some more work, you can implement an actual gravitational force and create figure eights by placing two grvitational forces.

Published by tespirit, on October 23rd, 2010 at 1:21 am. Filled under: Java,Pandadroid,ProgrammingNo Comments

Rectangular Wings

I’m in 6th grade and we are learning about how planes fly. I’m told that they fly based off of Bernoulli’s principle where air on the top of the wing has to travel faster to get to it’s original point after the wing passes through. When this happens, the air pressure is less and you get lift. Now the shape of the wing is what determines this, and the basic principle is to create a wing that has more surface area on top than on the bottom, thus air has to travel further, thus it goes faster.

Completely fascinated with plane flight, I did my science fair project on wing design. It was a simple setup, put wooden wings on a balance and have a fan blow air into them and then figure out the lift based on how much weight it lifts up. So I had a traditional shaped wing and a wood block that I tested against, and a funny thing kept happening. The block design would just fling all the way up just like the traditional shaped wing. Thus I concluded that my experiment didn’t work according to the true theory so obviously I did something wrong…

I just learned this week that this theory is not applicable to how airplanes fly and that I failed as a young scientist back then in thinking my results were wrong instead of the theory being wrong because my empirical data showed this.

Why did my block wing work? Because air would eventually hit it on the bottom and the wing would angle up a little which would then cause more air to hit the bottom and then fling the wing up. This is a more accurate model of how any wing works. Now the reason why planes don’t use a block shaped wing is for another issue that is needed for flight: energy. You need energy to push the object forward since the wing will also be pushing it backwards. While a block shaped wing could be used, you would also need a more powerful engine, and with that you would need stronger materials to handle the increase power. This issue is known as the drag of a wing design. The less drag, the more efficient the design so that is why bird wings are shaped the way they are. Not because they cause air on top to flow faster, but instead because they need less energy to fly.

Had I known this in 6th grade, I would have made my experiment test how much the wing shape wants to slide back and which design had the least amount of slide, instead of seeing how much lift they can generate.

Published by tespirit, on October 22nd, 2010 at 10:17 pm. Filled under: RandomNo Comments

Blackhole

So in designing a particle system, I realized that I need to spend a little more time on how to create an ui editor for a new class with a bunch of properties.

The basic thing I want is automation. The less I have to worry about setting things up and the more I can focus on creating new features. Thus there were two problems to tackle with creating a ui editor: linking an editor to a class automatically, assigning properties to be edited.

So for the first issue:

Java is great in that it has reflections which is a fancy way of saying you can look up info about the actual class an object is. Unfortunately java doesn’t have a simple straight forward way to get all the classes in a package so that you can auto initialize them. The good news, for a simple package lookup, it’s not too hard to do. After searching around the internet, I found a library that did exactly this… but the documentation was terrible and didn’t list the required jar files needed to run this library. So I gave up (mostly because I kept getting bigger and bigger jar files, so I started thinking that what I want to do isn’t this heavy). Then I found this nice code snippet: http://snippets.dzone.com/posts/show/4831. This pretty much did the trick, only I made it so it would only get sub classes of a class passed in and also got rid of the recursive file checking:

public class ReflectionUtil{

	private static final String CLASS_EXT = ".class";

	@SuppressWarnings("unchecked")
	public static <T> Set<Class<? extends T>> getSubClasses(String packageName, Class<T> baseClass){
		HashSet<Class<? extends T>> result = new HashSet<Class<? extends T>>();

		ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
        assert classLoader != null;
        String path = packageName.replace('.', '/');

        URL resource = classLoader.getResource(path);
        File packageDir = new File(resource.getFile());
        File[] files = packageDir.listFiles(new FileFilter(){
			@Override
			public boolean accept(File pathname) {
				return pathname.getName().endsWith(CLASS_EXT);
			}
        });

        for(File file : files){
        	String className = file.getName();
        	className = className.substring(0, className.length() - CLASS_EXT.length());
        	Class<?> classy;
			try {
				classy = Class.forName(packageName+"."+className);
	        	if(baseClass.isAssignableFrom(classy)){
	        		result.add((Class<? extends T>)classy);
	        	}
			} catch (ClassNotFoundException e) {
				e.printStackTrace();
			}
        }
		return result;
	}
}

From there I designed a linking class that is basically a factory that can be put in a Map based on the class it links to. The tricky part here is making sure you compare the top level class and then all the super classes so that you can create a general editor for a base type but then come back and make a specific editor for a subtype.

So with those two things I was able to automate the lookup of an editor based on the class and also allow for loading all linking classes in a package (This also means that plugins can be made without having to download the whole project source code).

The second problem is more of an annoyance of mine with the lack of easy UI creation in java. So I built a bunch of simple property classes that generate their own swing components and just made it so you have to override the get and set methods. This way it’s super easy to plug in a bunch of properties and link them to a custom object.

public abstract class Property<T> {
	private String mName;

	public Property(String name){
		this.mName = name;
	}

	public String getName(){
		return this.mName;
	}

	public abstract void setValue(T value);
	public abstract T getValue();
	public abstract JComponent getEditor();

}

The name is a label that is placed next to the property (using my simple panel code) and then I just made a bunch of subclasses that implement the getEditor function. So the final result in creating a property looks like this:

...
this.mAnimation = animation;
this.addProperty(new StringProperty("Name"){
	@Override
	public void setValue(String value) {
		mAnimation.setName(value);
	}
	@Override
	public String getValue() {
		return mAnimation.getName();
	}
});

Life is now a lot easier. And to celebrate, here’s a bunch of particles orbiting a blackhole (ok, so it’s more like just orbiting a gravity field, but blackholes sound much cooler).

Published by tespirit, on October 15th, 2010 at 10:34 pm. Filled under: Android,Java,Pandadroid,Programming,UINo Comments

BAM BAM!

Pandadroid… what is it? I mean I have it listed as a category, and I’ve mentioned it a couple times, though I haven’t really said too much about it, other than it’s kind of the current driving force behind this blog.

Simply put, it’s an sdk/tools package for making 3d android apps that I’ve started. Today I’ve gotten to a good point on an import tool for it called BAMporter. It’s a java application that runs the actual Bamboo rendering pipeline so there shouldn’t be too many surprises when you load up the model. The important aspect about this is that it is the collection of my pasts experiences as an artist and programmer going through the art pipeline.

At my first job out of college, I decided, screw programming, I wanna do art. So I was a 3d artist making demo art to show off the Snap Dragon processor way before it was even called that. And this was the art pipeline:

1. Run some MEL script to launch a program that would save out your file.

2. View the file and celebrate that it exported correctly.

3. Now go back to your project, write down start and end frames for each clip.

4. Email or walk over to a programmer and tell him the clips and finally you were done.

So, while this wasn’t horrible… ok, it was a pain. The first part was nice, that’s actually something I don’t have yet, though I might make some scripts to do that. Though there is one issue with the frist part. It was app specific. And even though I’m glad I learned Maya, I went into this job mainly knowing 3ds max.

The second part was awesome once we figured out that the animation frame rate matters for exporting… So not only did you have to bake animations, you had to bake them at the correct frame rate (this is actually a difficult problem, though Pandadroid currently solves this by not having keyframe interpolation, it just finds the closest key to get the value).

The real killer was the animation clip part. First, I had to import all my animations into a single file . It was a process that would take a few minutes to save out all the clips and then import them. To speed things up, I ended up making some scripts to export clips so that it was easier to assemble the master file (but it still took a few minutes). Second, once imported, i had to still write down the clip information so that our programmers knew what clip was at what point.

So to solve the second problem I made a maya script that generated a text file with all the info about the animation, scheduled a meeting with a programmer and established an XML format for the animation data, and then installed visual studio to make a C# app for generating the XML file and allowing for editing it.

At my second company, I ended up being on the programmer side and working on importing data. At the time, there was a Collada exporter for maya that would export custom attributes. So in the file there were a bunch of custom attributes defining clips. The nice thing with this system is that all clips were actually just separate animation files. Artists were happy because they didn’t have to merge all their animations into one file and export it. But for those artists that did work that way, they could define multiple clips in one file. This worked well, except that collada no longer exports custom data and so in order to use this, you have to find an old collada exporter.

Thus taking from those experiences, I’ve come up with… BAMporter! It turns Collada into Bamboo (the name of the 3d engine for Pandadroid).

Instead of pounding your head on a wall, trying to run through some import pipeline, I’ve built this tool so that the pipeline is simple: create your art, load it into BAMporter, export the art, and… oh wait, you’re done. But how does that solve the clip problem? Well The way it works is it allows you to create clips and edit them in the application. Along with that, if you want it all in one file, you can merge animations in the application and it will automatically create a new clip. Nice and simple. The way art pipelines should be. And for programmers, there’s no need to go to an artist and ask “What’s in this file?” because they can view it and get important information like node names, clip names, animation names, etc. Now both artists and programmers can celebrate.

Published by tespirit, on October 7th, 2010 at 7:16 am. Filled under: 3d Art,Pandadroid,ProgrammingNo Comments

Swinging around a cup of Java

These last couple of days, I’ve been working with Java Swing. For the last few months I worked on a javascript/CSS/HTML widget system that included a web based editor, and so i was hoping Swing would be a lot easier to do… I mean it has to be better than C#, since Microsoft makes C# and they suck at making things :P

1st UI approach:

I figured just throw some components around and see what happens (after all, I was more concerned with functionality). This kinda worked, though it looked terrible. Buttons were huge in some places and panels seemed to have masive amounts of scrollbars that didn’t make sense.

2nd UI approach:

I looked into many layout managers and ways to use them to build my UI. I looked into making my own manager that would place things out in a simple way… Looked at some java library for laying out components, though these all just felt too complicated for how simple my UI needed to be.

3rd UI approach:

I spent time looking for an editor plugin for Eclipse and found some simple one, which helped alot in figuring out how to code stuff up, but is still a bit buggy on my computer. So then I found out about Netbeans. This actually looked like a nice editor. Maybe I should switch over to it? And so I spent a few hours trying to setup a netbeans project that would link up to eclipse. You’d think this would be easy, given that there’s an import option for this, but no. Libraries wouldn’t import. Then I tried to create my own library, which it would complain about it already existing but really not existing. So frustrated, I realized that you can still create forms and view them, so I went ahead and did that.

Now in Visual C#, you just drop things in, tell it how it anchors, and you’re done. This is not the case for Netbeans. The main problem is that Netbeans, along with other editors are trying to be too smart in allowing people to use custom themes that can be different on one computer to another. This just makes the whole problem a mess as you’re not just placing things down, you’re creating some monster of a beast that keeps track of relative offsets compared to other components. I’d adjust one component, and then all of a sudden other components would resize or move or blow up. It was too crazy for me and I ended up spending more time battling this than placing components down. But finally I managed to create some panels. Then I linked them up to data and realized that I need something way more simple. I just want to create lists of properties, and battling with Netbeans, switching back to Eclipse, then back to Netbeans was just too slow to work with.

4th UI approach:

Scrapped the Netbeans files and went to make a simple panel that allows you to create components and give them a label and it just draws them out as a vertical list:

public class SimplePanel extends JPanel{
	private Box mLabelPanel;
	private Box mInputPanel;

	private static final Dimension mInputSizeMin = new Dimension(50,25);
	private static final Dimension mInputSizePref = new Dimension(100,25);
	private static final Dimension mInputSizeMax = new Dimension(1000, 25);
	private static final Dimension mLabelSizeMin = new Dimension(50,25);
	private static final Dimension mLabelSizePref = new Dimension(75,25);
	private static final Dimension mLabelSizeMax = new Dimension(1000, 25);

	public SimplePanel() {
		this.mLabelPanel = Box.createVerticalBox();
		this.mInputPanel = Box.createVerticalBox();

	    this.setLayout(new BorderLayout());
	    this.add(this.mLabelPanel, BorderLayout.WEST);
	    this.add(this.mInputPanel, BorderLayout.CENTER);
	}

	public void addComponent(String label, JComponent input){
		JLabel labelField = new JLabel(label);
		labelField.setMinimumSize(mLabelSizeMin);
		labelField.setPreferredSize(mLabelSizePref);
		labelField.setMaximumSize(mLabelSizeMax);
		input.setMinimumSize(mInputSizeMin);
		input.setPreferredSize(mInputSizePref);
		input.setMaximumSize(mInputSizeMax);

		labelField.setAlignmentX(RIGHT_ALIGNMENT);
		input.setAlignmentX(LEFT_ALIGNMENT);

		this.mLabelPanel.add(labelField);
		this.mInputPanel.add(input);
		this.mLabelPanel.add(Box.createVerticalStrut(5));
		this.mInputPanel.add(Box.createVerticalStrut(5));
	}
}

For the amount of code that was finally generated, I feel a bit stupid. And as for my opinion of swing: It looks nice with the nimbus skin, once you are done, though honestly I would never use swing again for a ui app unless like this app, I need to make it in Java. C# is miles ahead in ease and in flexibility. Even Html/css/javascript is easier.

Published by tespirit, on October 7th, 2010 at 6:00 am. Filled under: Java,Programming,UI2 Comments

Candy has seen better days.

So, what the heck is that? That is why one must be careful in writing skinning code. Though at the same time, maybe I can turn this into an art piece. This is supposed to look more like this (yay for old artwork!):

As you can tell… I haven’t quite got there…

There are many issues to work with. Mainly the importing is a bit difficult since COLLADA likes to index vertex data independently, so there’s an index for the position data and a separate index for normal data. Bamboo (the 3d data system for Pandadroid) wants only one index per vertex. This creates a massive headache for models that have texture seams or hard edges. If only 3d programs could export data better. And apparently Maya does have an option for this. Except…. sometimes it doesn’t get it right (mind you, I’m using Maya 8.5, so it might just be the old version).

So the simple way to deal with this is to just create a map of the indices concatenated with each other to the actual new vertex that has all that data. Then you just look up to see if that set of indices already has been assigned an index, or you proceed to add all those vertices to a new index (aka, append a list and assign the last count). Problem solved… until you introduce skin data, since that refers to the old indices and you need it to remap to the new indices.

Welp, as you can see from above. I’m still working out the kinks in this.

Disclaimer: Candy was not harmed in the making of this post… Who am I kidding, look at how messed up she looks. That’s gotta be painful :P

Published by tespirit, on October 1st, 2010 at 3:06 am. Filled under: 3d Art,Pandadroid,ProgrammingNo Comments

Why can’t I just eat Serial?

Now just so you know, it’s been about 5 years since I last programmed in java and that was all high level school stuff. I never learned about Java’s object serialization. It’s so simple, just implement Serializable, then tell it what member variables should be written and you are done. So obviously I went to town on it for my Android 3d engine. Welp… my advice, be careful about that. Suprisingly object serialization can eat up your jvm stack and so I ended up getting this error when reading the file on my Android vm: StackOverflowException. Sad face.

So I was stuck… Not really looking forward to making my own object parser I looked into customizing the java serializing. That’s where I discovered the Externalizable interface. After going through and making sure only some data is written and also flattening out some of my data structures, I was finally able to generate a file that didn’t cause a stack overflow error. The basic thing is I flattened out a lot of data and then reconstructing a lot of the simple objects out there when loading. The nice thing with the Externalizable interface is that it knows what object is what when reading data that might have a common base class, which makes things so much easier than having to come up with your own object id system.

Published by tespirit, on September 30th, 2010 at 2:08 am. Filled under: Android,Pandadroid,ProgrammingNo Comments

There are no Libraries in the Android age

This is frustrating. All I want to do is create a custom view in Android that can be exported as a library. The catch is, I have custom attributes that can be used to initialize this view and I want to be able to declare this view in a layout resource file. The sad news is that doing something like this is not straight forward and involves more work than just having people download the attribute xml file and the java file for the actual view and just placing those in their project. Sad face.

So why bother with trying to do this? Why not just do it the quick and dirty way? It’s the philosophy around my project I’m working on (Pandadroid): making a 3d engine that is easy to setup and use. I want people to be able to get the engine library and then just place down a view in the common layout way so they can focus on making an app and not on trying to get a library to work or learning an unfamiliar API. I came up with this idea after trying to find a currently existing Android 3d engine and seeing that there was nothing out there that is easy to use and setup. And now I think I know why that doesn’t exist…

Look at a project like WordPress. Why is this so awesome? Because you don’t have to spend hours trying to configure it to get it to work. And not surprisingly, it is a very popular framework to use for both novice and professional web developers. It also allows serious developers to make plug-ins for new features for everyone to use. It uses the community to make itself better. And it accomplishes all this without getting rid of flexibility and power for serious developers.

So this leaves me wondering if the Android team is really thinking about how to make this a long lasting system or if they’re just throwing a few things together here and there. All I’m asking is for a way to share my work with others so that other people can make apps even faster. But no… instead the Android programming motto seems to be more inline with making sure each developer is his/her own island. Eventually the main land will take us over.

I hope the next release of Android looks into making it easy to share Android component code with each other without having to download an eclipse project.

Published by tespirit, on September 28th, 2010 at 8:05 am. Filled under: Android,Pandadroid,ProgrammingNo Comments

I like pizza!

Because it tastes yummy!

Published by tespirit, on September 25th, 2010 at 7:36 am. Filled under: RandomNo Comments