Tuesday, September 20, 2011

More Cowbell

I've been playing with Scala a bit since my last post, I actually took a little hiatus from Sedition to avoid burnout...

Scala is a very sexy language, it's very hard not to crack a sheepish grin when reading about it's features.

for instance:

class Foo[T <: { def bar(): Int }]
{
}

Tuesday, September 13, 2011

Scala and Random musings

I've always been a programming language geek. I love learning new programming languages, though C++ and C# (and to a lesser extent Java and Ada) have paid my mortgage over the years.

I'm more of a fan of statically typed languages, but when I have to, I can feel my way around Python. Windows Power Shell is also a fantastic dynamic language that doesn't get the credit it deserves. I'll admit the syntax can take a little getting used to, and if you don't use it frequently, you will forget a lot of it.

For a reason I can't remember now, I recently read about Scala. (Wikipedia) I'd heard its name thrown around for a few years, but never really looked much into it. If a language is not available for production use for me, I have a little less incentive to check it out. Scala's primary platform is the JVM, and it can also run on Android's Dalvik without too much fuss. There is a .Net variant that uses the Java-.Net bridge/abstraction framework IKVM, but it is apparently not quite ready for prime time.

Tuesday, September 6, 2011

Faster horses couldn't drag me away.

Henry Ford once said: "If I had asked people what they wanted, they would have said faster horses".

The profound truth to this is that 'customers' are often much better at describing their problems than coming up with solutions. Engineers too often are better at coming up with solutions than they are in seeing the true problems. The key to getting things done as an Engineer is to recognize when you are attempting to make a faster horse instead of inventing a car. You have to work with your 'customers' (be they clients, other departments, or even other engineers, consuming your code), to come up with the solution that matches the right problem.


I have thought this for a long time, and I blog about it, but I do it too all the time. It's very easy to fall into a trap, it's often hard to tell when you're building faster horses until your halfway done building them. Customers often give you a solution instead of a problem ( eg: "I need a file browser with twelve bookmark buttons", instead of "I need a faster workflow for frequent opening of files"). It's all to easy to build that fancy file browser, only to find out later the button for launching the browser was nested too deep in the UI, and moving it would have solved 99% of users problems.

--P

Saturday, September 3, 2011

Busy bee.

Usually, when I'm not posting, I'm working on things to post about, or Sedition.

I have a new version I'm putting out later today, with a ton of new features and polish.

I need to do some more heavy duty optimization. Some of my recent optimization seem to make the general framerate appear less stable, even though the code is doing less, and the frames are consistently rendering in less time.

I cannot wait to get back to hardware stuff!


--P

Tuesday, August 23, 2011

The missing link in my master plan.

Despite the risk of initiating a Singularity Event, one of my ultimate goal in self educating in electronics and embedded design and programming is to make robots. Not just robots for the sake of robotdom, but robots that are useful in everyday life.

I'm not sure I have figured out in what way I want my first robot to be useful, but I think I now have enough of an idea formed albeit vauge of what tech I want to use.

I just got this slice of nerd heaven from FedEx this morning:




It's got a 433 Mhz Transceiver in it, and a TI MSP 430 microcontroller, among other things.

Anyways, I decided it will serve as a "Command and Control" for my first robot. I will also use one of my LPC22XX boards running .Net Microframework as the high level "brain" for the bot.

Now to find  use for it :)


--P

Monday, August 15, 2011

Still Here.

Do not fear, I will not let this blog bitrot :)

It is funny how many cool blogs end with sparse posts about "Gee it's been a while, I'll do better", then go cold.

Or it's not funny I suppose. It's sad.

*I*ll do better.


Here are some of the things I'd like to post about in the near future:

Soon I will work on my long promised Attiny capacitance touch library for actual release. Last time I worked on AVR stuff, was on the old AVR Studio 4.x, the new version 5 looks nice and shiny, I have heard it is WPF based. Swell!

I have a post about a CPLD project I've been working on half written.

I'd also like to write about one project near to my heart, my .Net Micro Framework port to a custom LPC 22XX based board.

I also will continue my write up on the word clock.


--P


Wednesday, July 20, 2011

Sedition

After many months, and even a good deal of schedule slippage, I uploaded my game, Sedition, to the Android market. You can find it here:

Sedition Ad-Supported  and  Sedition Ad Free

I also have a Blog dedicated to my software endeavors, DigitalPopcorn


My baby

(Apologies to anyone reading this who might not be able to access it in the Android Market, I plan to expand offer to additional countries soon, as well as other distribution channels.)

Anyways, it is still in "Beta", but here is a run down of some of the technical/design details of it:

Android Library Management for publishing multiple editions of an android app

[UPDATE 12/30/11: This post is a little out of date, I recently updated to r16 of the ADK, and eclipse 'Indigo' (3.7). I had to play around with the library settings to make the dex process happy, and the settings actually make a little more sense now. I'll make a new post]

Sorry for the long title, but I spent a frustratingly long time( hours ) doing something that should have been achievable in seconds.  My hopes are that I am able to document the steps needed here well enough that someone can save themselves some time.

As a last step before publishing, I needed to be able to quickly make two versions of Sedition, an Ad-supported version, and an Ad-free, paid version. In the Android market applications are distinguished from one another by the "package" property in your AndroidManifest.xml file. So simple, change your manifest name and re-build. Not so fast, the resources in your application, eg the files that get assigned an id in the infamous "R" class, are built to live in that class. So when you change your package, any code that references anything in your R class will break. For me this resulted in over 100 errors. I have some final static variables in that help me define code behavior for any given flavor of build. This was the closest I ever got to a #ifdef type mechanism that I mentioned a few months ago. Unfortunately, there is no solution for changing manifest files in a similar manner.

The conventional wisdom of the Web suggests moving your application into an android library, then make two new "Applications" that then link to the library, like so:





This is what I did. It should, by all accounts, have been quick. It wasn't, there were a ton of booby traps, and unless you have innate knowedge of the inner workings of the android build tools, it's a little bit of a mysterious beast. Here's what I did:

Friday, July 15, 2011

Almost Live

My game, unless something goes wrong at the last minute, will get submitted to the Android Market this weekend. It's far from "done", but I think it is a solid "Beta" level app. All the planned features are mostly working.

I figured it was about time I opened up a little more about it....

Without any fanfare, here is:

Wednesday, July 6, 2011

VDHL

I got a chance finally to play around with my Papilio One board, and the Button/LED Wing I got.

I'm fascinated by VHDL, though I'd consider myself a 'novice'. 

I think something may be amiss with my board, or the wing. 

I wrote some trivial 'hello world' VHDL, I made a component that I can "wire up" (technical term) to either the high side or low side of a wing. (The Papilio has 3 16 bit wing sockets, but the Button Wing is 8 bit, and can occupy either half of a wing).

So my component looks like this:

Monday, July 4, 2011

Back in the solder again

I finally made an initial release of my game, Sedition, not yet on the market, but to a few people I know personally. It is not complete, I'm torn whether to call it 'alpha' or 'beta' at this point. At any rate I intend to 'flip the switch' and Google's and Amazon's markets within a week or so. More on that in a future post.

I also have a Blog dedicated to my game and any future software I release: Digital Popcorn

Anyways, one thing that working on this game has kept me from is doing hardware hacks. Now that development efforts have (hopefully) peaked on Sedition, I want to get back into it.

Thursday, June 30, 2011

Conductive Ink

http://news.discovery.com/tech/roller-pen-writes-electronic-circuitry-110630.html

You can sort of already do this with graphite, aka pencil lead, though the conductivity is lower. You can mix powdered graphite and glue to get conductive glue.

Also, I have had a "conductive paint pen" in my lab for 2 years,(and for much less than $50) so this seems more evolutionary than revolutionary. Neat all the same.


-P

PS. My Wife and family are out of town, so I have a little extra free time over the next week or so. My game will go to beta/alpha testers this weekend, and I'll put it on the market within a week or two. I know I keep saying it, but I will post about it then. It has consumed a whole lot of my time, and distracted me from other things that I love. I feel like I am 9 months pregnant and ready to deliver this thing.

Saturday, June 18, 2011

North Carolina Maker Faire.

I dragged my family to the North Carolina Maker Faire today, though in the end, my wife probably had more fun than all of us.

I was absolutely giddy when I came across these:

This picture doesn't convey how tiny this thing is. For reference, check it out on the left
in the next picture. You can buy these here: Synthetos Word Clock




The booth was run by this group: 

They had some really high end looking clocks. 

Ok, this has motivated me to get working on continuing my word-clock series.


Sunday, June 12, 2011

Pre-shaved Yaks.

I wanted a way to keep track of bugs in my Android Game (I know, I promised a big reveal, it's really soon). I'm getting to the point that I have tons of loose ends and TODO's that I wanted collected in a central location. I am a one man dev team, so I thought I'd keep it simple and just use a spreadsheet. That fell apart before I really got started. I once worked on a project, right out of college, a long time ago, that used a spreadsheet in source control to track bugs. It was as bad as it sounds.

Anyways, there are a number of open source bug tracking systems out there. Almost all are web based. I'm not a web-developer. Every time I try to do something that involves setting up a web server, it's a frustrating exercise in shaving yaks.

Thursday, June 2, 2011

Music in Android. (Nothing to see hear Googlers)

(Yes I'm cheating from my bye-week on Blog posting for a mini rant)

I have to put music in my game. Why? Because games have music. I almost always disable the music, and often the sound on a mobile device if I am playing a game. Most mobile games do not do music well, and frankly I have low hopes for my game, since I have no musical talent. But it's just one of those things, that make a game complete, and lest ye forget, my main goal of making my game is self education and improvement. (Making a few bucks would be nice, but I'm not exactly reserving chartered jets at this point). So I have just a slight hope that maybe I can pull something off musically that ends up being pretty neat. The hard part with music in a game is that it has to be complementary and subtle, not obnoxious, but at the same time catchy. Nintendo does this masterfully. (obnoxious is in the ear of the beholder)


The Jet Creator tool/API in the Android SDK, is really a neat concept. You import music files(midi) and slice and dice them into "segments" that you can queue and play. You can also trigger clips(segments?) to play, and get callbacks in your code when certain events happen with the music.

The big letdown with all of this (besides my realization that making good game music is really really hard), is that the implementation and documentation for the system in the android SDK is seriously lacking. Most web searches result in 1) duplications of the SDK doc, or 2) other forums/blog lamenting the lack of documentation. My sincere apologies if Google brought you here seeking the same knowledge. Add this post to the list of the latter type of search hits.

--P

P.S. yes the misspelling in the post title is a lame pun.

Friday, May 27, 2011

Life is what happens when....

I probably wont get a real post out this week. No, it isn't blogapathy, life and work is a little hectic right now.
Next up will be my game announcement though. Then maybe I can get back to hacking :)

-P

Monday, May 23, 2011

Lot's todo

All developers are familiar with the infamous "//TODO" comment in code. It means "I know this code is not finished and will need work", or "I have deadlines and Fred's code is broken so this is the best that can be done until he fixes his library".  The problem is that these thing can linger forever. I know, I'm guilty of it myself.

Who hasn't seen things like:

//TODO fix after June

(But that comment was checked in 2 years ago)

//TODO see Fred for a fix.

(Fred doesn't work there anymore, by the way).

Amongst the many code quality techniciques and policies, such as unit testing, treating warnings as errors, and using static analysis tools, I propose a system for dealing with a "TODO" - something that has been identified as needing rework eventually.

In my Android Game, I have recently started using a class to denote such beasts. Behold:

Saturday, May 14, 2011

An alternative to the Android emulator and setting up ADB for TCP.

[Update 7/28/11 :See updated information at the end of this post]


I touched on it in my last post, but Android x86 running on Virtual Box can often (but not always) perform better than the standard Android emulator. OpenGL is painfully slow on either. I'm running one of their pre-built Froyo binaries, but Gingerbread source is on the site, if you're feeling adventurous.

The main advantages are:

  • it starts up faster
  • less prone to lockups the the SDK emulator
  • it depends somewhat on what you're app is doing, but many things, like file system IO and math intensive code, seem to execute much faster
The main disadvantages are:
  • Not very representative of a "main stream" Android device.
  • Cant be used if you're using NDK with native code targeting the Arm processor.
  • Configuration of things like screen dpi, and emulated hardware is not as easy or non existent.
  • You can't emulate certain operations like SMS
A guide to setting up your x86 virtual machine can found here: (It takes less than 10 minutes) Install Android Froyo on PC

Launching Android-x86 is not automated like the emulator and ADB takes slightly more effort to setup, but it's not hard. So here's my quick-start guide

Wednesday, May 11, 2011

Android OpenGL ES texture management.

My Android game is still 'coming along'. I'll be making an announcement post soon. It's consumed most of my late evening "dad time", I haven't touched a soldering iron in a while, I'll make up for lost time later.

Progress on the game has generally gone like this: bang out some framework code, bang out cool feature, cool feature, find a minor bug, spend the next few evenings pulling my hair out, framework code, cool feature, cool feature, rinse, repeat. This post is about one of those hair pulling moments and my solution. It revolves around Android's handling of the OpenGL texture buffer management API's.

Recently, I was reworking my texture management code in my "engine" (if you can call it that, it's really just a few folders of Java files with a focus on lower level Graphics and my own Collision detection). I wanted to add the ability to have "dynamic" textures, ones that could be created and modified in the middle of a game in progress. Android has been fun to work with, but the there is a dearth of documentation when it comes to the 3D stuff, you are typically refereed to external Open GL ES docs, or to the SDK samples, which invariably don't do what *you* are trying to do.

Disclaimer: Though I have been in the video game business for a long time, I have rarely done low level graphics rendering work. I would not consider myself a guru in that area, so take this post as food for thought and not as an authoritative doctrine. If you think I'm wrong on something, call me out!

Sunday, May 1, 2011

Rebuilt Swingset.

We inherited 1/2 a swing set from our neighbors. Last weekend, I turned it from this:



to this:


Alright, this isn't at all electronics or programming related, but it is still "hacking" in a form. The local hardware store doesn't stock parts for this purpose, they only sell "playground kits". It's mix and match, but they assume that you are buying a complete swingset, so they package some important parts in the big expensive kits, and don't sell them "loose". So I was on my own. At least they sold the actual swings separately, but I did have to make a return trip when I realized they did not come with hooks to mount the swing chains to the frame.