Thursday, August 30, 2012

teamSize++ and Other Things

Lots of things to say today: the biggest is that I'm no longer working alone. My roommate has joined me. He's a pretty awesome programmer and really good at math.

Quicksand Fix:

We decided to fix my engine instead of using someone else's. I fixed the quicksand (for real this time) by adding the non impact force to the impact force (if impact is true). Here is the new snippet:

protected Vector calcContactForce(float theta) {
    if(impact) {                              
        if_contact = new Vector(theta, (float) (mass * velocity.magProj(new Vector((float) (theta + Math.PI), 1)) / dt)).add(new Vector(theta, sumForce.magProj(new Vector((float) (theta + Math.PI), 1))));
            // impact plus notImpact
        else {
            f_contact = new Vector(theta, sumForce.magProj(new Vector((float) (theta + Math.PI), 1)));
        return f_contact;

I was so happy when I finally got this.

Zooming and Cropping:

The view now moves with the player and scales with velocity according to a Gompertz Curve.

Redoing Collision:

My roommate is redoing the collision system to make it more general (so that it can support more shapes and maybe even rotated shapes down the line). It's not done yet though.

Size Update:

justin@agartha:src$ wc -l *.java
 1174 total
justin@agartha:src$ wc -c ../bin/*.class
  775 ../bin/AirBlock.class
 1200 ../bin/Block.class
  173 ../bin/CanDraw.class
  251 ../bin/CanMove.class
 1122 ../bin/GroundBlock.class
 2474 ../bin/KromFrame.class
 1632 ../bin/KromGenericLine.class
 1541 ../bin/KromLine.class
 6910 ../bin/KromPanel.class
 1474 ../bin/KromPoint.class
 4054 ../bin/KromRectangle.class
  423 ../bin/KromShape.class
 1302 ../bin/KromXLine.class
 1302 ../bin/KromYLine.class
 4327 ../bin/Map.class
 5169 ../bin/Physics.class
 1551 ../bin/Player.class
 1944 ../bin/SlantBlock.class
 2315 ../bin/Vector.class
39939 total

Huge size increases. We passed 1000 lines. Woohoo! Almost 40KB too.

Git is Magical:

We are using git for version control. The subheading sums it up.

I think that's it. I'll be showing a video of all the recent changes whenever the new collision system is working.

Sunday, August 12, 2012

Unity is better for 3d. All I need is a physics engine.

I've decided to use as my physics engine. I suggest you play with this:

This engine was used in Angry Birds and others, It is free and open source (zlib license). I've decided to stick with java because it is cross platform by default and a port to android wouldn't be too hard.

Sunday, August 5, 2012

Thinking about switching to Unity

So, that solution to the quicksand I stumbled upon wasn't a solution at all. It looked like it fixed the problem but the character was actually just bouncing a tiny bit. I knew the problem was still there because I could still push the character through walls.

I think at this point it is fair to say that my physics engine is broken. I don't know if it is worth the effort to go back and fix the entire engine. I've been thinking about using Unity instead. They've promised support for GNU/Linux with Unity 4. I assume this will include an editor too.

I've been wanting to learn C++ anyway and I don't want to give up on Kromapoka just because I made some mistakes in my physics engine that I can't find.

A friend of mine recently told me that I should be a lazier programmer. I realized that I should stand on the shoulders of giants instead of trying to right every line of code myself. The people that make these engines are much better than me and are asking coders to use their engine.

I just have to wait for unity 4. I will not boot into windows to code. That just seems so backwards to me.

EDIT: Just found out that the port is only for the publisher. Maybe Wine will have to do. Also, my comment about C++ might be incorrect. I think it's C#. O well, pretty close anyway.