Slight Overkill

sledgehammer-nut.jpg w=540

So, last week’s plan to use a HashMap of 3 Histograms – totalling 15510528 values initially, and then a further 304128 values on top of that (a total of 15814656!)- was a leetle beet over the top.

As I sat on the porcelain throne yesterday, it occurred to me…

Why not just have the first n frames without any “foreground” in it, and just process a quick average of those pixels into a backgroundPixelsHashMap?

See, I came face-to-face with the 64Mb Android  memory limit – which cannot be easily expanded in the old version of Android that I’m using (for backwards compatibility’s sake) – when I’d only processed about 13 images, so collecting a huge set of histograms was a non-starter really.

All I need now, for a 352 x 288 image, is a HashMap<Point, Integer> of size 101376 – a reduction of over 99%

I think the S3’s memory can stretch to that.

Now, onto the next part of the “remove background” problem – you can’t bitmap.setHasAlpha(true) until later versions of Android. Fuck! I will have to look into some “old school” ways of saving images with alpha. I’m sure it’s not impossible like.

Another thing that needs doing, relating to the AI (which I’m finally getting round to implementing), is to select the initial target move more sensibly; it’s no good calculating that some guy’s best move is pummeling in, and basing his whole strategy around going solely for that move, because there is no end-game there. He’d be like a moth bouncing round a fucking lightbulb.

No, I need to select “best” moves that either score points or submit, and then tailor the gameplan around that.

One thing I also noticed is that the current logic does not take into account moves that actually take the player away from the target – but now that I think about it, it might not matter… In a position where a certain move that takes you away is next to a move that takes you closer, the rank of the correct choice should make the difference (will need to confirm that, but…)

Anyway, I still need to write the logic to only select valid target moves. I shall have a little think about that.





Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s