Thursday, October 27, 2011

Repulser, pass #1



I modded the libgdx particle emitter class to allow the programmer to have old particles track a specific angle.  I did this so that I could get the effect you see above.  It's a repulse ray.  I need to polish it up a bit -- the player's tracer line appears when it shouldn't (this is a screenshot of the first, proof-of-concept pass).  But, it looks functional and I like how it emanates outward.  I was going to try to animate this action with multiple images, but using particles gives a waaaaay better effect.  Things should be fixed up tomorrow.

Wednesday, October 19, 2011

*DING*

Slide rule Android app - 10k user Achievement Unlocked.

Checked the developer console today and saw this:

"10012 total installs (users)"

Cool!  Broke the 10k barrier.

Sunday, October 9, 2011

Training Level 07 is done

Finally.  Done.  With training level 07.  I wanted to create a new pendulum object for this one and had a bit of trouble initially getting it to work the way that I wanted to.  After getting a tip from a Box2D guru, I was able to get things working.  The problem had to do with me creating an axle that had no fixture.  When I did this, the pendulum rod quit swinging.  Double plus ungood.  You need to have a fixture in place or the fixtureless body constrains rotation.

So, yeah, WOOT!  Here's a screenshot.

Saturday, October 8, 2011

Bobbing for crates

I wasn't happy that I had this fancy dancy new water texture but no physics behind it to make things (like crates) float.  I went out and discovered that the Box2DFlash port by "BoristheBrave" had already implemented this.  I ported that over to the libgdx library... and was able to do it by adding shape extensions so I didn't need any updates to the underlying libgdx JNI code which was cool.  After realizing that Box2DFlash's coordinate y-axis was inverted from my environment's y-axis AND fixing a couple of bugs I introduced, it's now working flawlessly.  Here's a screen shot of a couple of crates floating:






One other thing that I did last night was to integrate ACRA.  This is Application Crash Reporting for Android.  If you give your application Internet permission, it will send crashes off to Google docs for analysis.  This will give you the trace you need that the standard 'Force Close' window absolutely does not provide.

The best thing about this is that the overall impact on the app is minimal.  You add a new class and override the onCreate() method in that class, set up a Google docs form, and you are ready to go.  I was a bit confused at first because I wasn't sure how to integrate it with libgdx, but it really boils down to just adding the class as part of the Android project & including the acra .JAR file.  QED!

Monday, October 3, 2011

Training Level 06 is in the bag

Added a new water texture to short out the main character's circuits.  Take a peek below.

Sunday, October 2, 2011

Evolution

It's been a while since I've posted on here.  Why is that?  I've been working pretty damn hard on my game!  That's why!

Below are some screenshots of the current build.  I'm currently looking for an artist to give the game that extra polish.  I've been able to find one on indiegamer and have a offer extended to him that I'm waiting on for acceptance.  We'll see how it goes!  Very exciting stuff.

Monday, July 25, 2011

Rendering results... WAHOO!

Wow!  I can't believe how easy rendering is and the HUGE improvement I had versus the Box2D renderer.  I had it in my mind that it would be overly complicated, but it's that's not the case at all.  The results are so good that my conveyor belt actually WORKS on my phone.  That's great because I've got a couple of cool ideas for some levels using this construct.

My (simplistic) design, as mentioned in the previous post, is working great.  I created a new renderer class that is passed the the Box2D world instance.  From here, I get the list of bodies that are in the world.  I thought that I would have to iterate over all my fixtures in order to get things to appear.  That's not really the case.  Although your object may be comprised of several polygons (especially in the event that you want to a concave type object), your actual object is a single entity.  If you have a texture that 'fits over' that entity, then you are all set.  Much easier than trying to iterate over the fixture list to define individual elements!

I added some info to my user data class -- object texture, size, origin, and color.  The renderer uses these to scale textures appropriately.  When I get the real textures drawn up, it will use those instead.  I wanted to implement scaling because some of my objects don't have a predefined size at compile time (platforms have variable length, gears have variable radius, etc.)  Other objects, on the other hand, will have static sizes so handling those should have less of an impact on CPU time when I define the 'real' textures.

I added a grand total of 2 textures for my own debugging - one shape for circles and one for squares.  I also added a simple line so I can see rotation.  See the screenshot below for an example:


Observations:

1) I had defined some objects with rotation and instead of rotating the object, I rotated the fixture.  This resulted in rendering images that were out of whack with the body (a vertical platform, for example, rendered a texture horizontally).  Bad!  This was easily corrected by setting the shape's rotation to 0 and the body's .angle parameter to the desired angle.  I love quick fixes like that.

2) I need to have ordered rendering. I have some instances where objects overlap.  Sometimes the player's arm/gun is rendered before the body and sometimes it is rendered after.  You either see the gun peaking out when it is rotated or you see it 'correctly' on top of the player.  I need to correct this.  Since I'm iterating over the entire world of objects, I probably will skip this special case and have the player object render itself separately... it knows to draw the player body and then the arm next.  Skipping should be a snap because my user data includes object type info.

3) My fps on my phone on the conveyor belt map was on the order of 14 fps using the debug renderer.  Using my renderer, my fps shot up to close to the max -- 50-60 fps.

4) The screenshot above shows a capture of my game running on the desktop.  The fps says 4774.  With the debug renderer, I was getting 1/4 of that... say around 1400 fps or so.  Notably slower than what I am getting right now.  Most of the operational time was spent rendering joints (40%+).

5) This doesn't obsolete my usage of the debug renderer.  I can always run that AFTER I do my rendering to 'overlay' what the physics engine is thinking it should be displaying.  That's a pretty neat trick.

That's all for now. All in all, I'm pretty happy I got this working.  It was a big disappointment yesterday to see that the conveyor belt killed things!