I seem to have somehow cocked up a commit to the LibGDX demos and deleted some asset files for the Simple Shooter demo. My apologies to anyone trying to build this. The really bad thing is that I thought I had backups in my own subversion repository and to my horror it isn’t there at all so I am going to have to put the missing fonts and stuff together again which isn’t going to be quick. I’ll put a notice up when it’s fixed. Sorry about this.
Okay, I have fixed it. As noted in the comments I did look at the version history but it seems I may not have committed the files properly in the first place. Pretty lax of me not to check a fresh build out on my most popular github repo but I hopefully have learned my lesson. I am going to make sure I have a back up to my local SVN as well in future.
One last note is that the Android maven build seems to be broken still so I am going to look at that next.
Tonome is an matrix style sample player in the same vein as Tonematrix and Monome. This version is the result of a lot of attempts to get something which is usable. I think this is close but not quite there yet but I’m going to release the code as I’m tired of playing around with it and want to leave it for a while.
Source code here.
You can get a flavour of what’s involved from these screenshots below.
- Multiple panels with a nice sliding transition between them including a new diagonal transition.
- Matrix buttons with a toggle action so that as you slide over the buttons you are either setting or clearing. The buttons will also flash as the assigned sound is being played.
- Bar display to show which bar is currently being played.
- Touch buttons to navigate between panels which are animated to flash along to the bar display.
I couldn’t decided on how to present the settings for volume and BPM so I have placed them into a fairly boring setting view for the moment. There should be some kind of slide in panel which has these on the main interface but I’ll put that off for the moment. You can exit the touch panels by ESC on PC and the ‘back’ key on the phone.
The assigned samples are fixed for the moment as this is still technically a demo/prototype. You can see in the code where they are inserted if you want to change them.
I have only tried this in the emulator for the moment as my Nexus phone won’t talk to my PC anymore 🙁 The android project is bundled with the source. The emulator gives me a laughable 4fps which is unusable so there may be an issue with running it on a real phone. If it works can someone tell me.
I studied tonematrix to see what notes the application used as they have been chosen specifically to go together. These are A3,B3,D3,E3,G3,A4,B4,D4..and so on.
I spent ages trawling freesound to try and get some decent samples that sounded good together. I can’t say I have succeeded. This stuff is hard. I went through a ton of them before selecting the final choice. I’m still unhappy with how they sound. A future plan is to forego samples altogether and instead have OSC support but in the meantime the samples demonstrate the intention of how to build up a composition from the different panels. There are two panels with ‘lead’ type sounds, one bass panel and one drum machine panel with some nice samples from a TR909.
There is a subtlety in the sample choice which I should point out as you are bound to notice it. The samples on the second (right) panel appear to play together in polyphony okay. There is always going to be a slight delay in the launching of each sample but if your lucky it shouldn’t be noticeable. The samples on the first panel, on the other hand, don’t seem to sit so well together once you start to bunch them up on the same bar. For the first 4 notes on my PC it plays fine but thereafter increasing the number of simultaneous notes makes a scratching sound appear. I am convinced this is something to do with the sample itself as the other samples don’t exhibit this behaviour. If I get a chance I will try and fix this somehow. You can always insert your own samples. If you get some decent ones and want to share then drop me a line.
I think there the core of a nice control panel for audio here. It would require proper message support for OSC messages but should be doable. I haven’t managed to find a suitable OSC library (with the appropriate license) yet but I will keep looking.
Re-pitching Audio Samples
I tried to use SoundTouch to re-pitch a selected audio sample but could only get it to work on the desktop version as I put together a kind of hacky solution.
- Loading the base sample and re-pitching.
- Creating a WAV file sample image with the re-pitched data in memory.
- Creating a Sound class but hi-jacking the file load to pull the data from my in-memory WAV file image.
This actually worked really well but only for the Desktop since Android uses SoundPool to manage audio samples. You can find the code in a class called “AudioHelper”. As I say it never made the final cut but might prove useful if you are targeting a desktop application only.
Source code here. As usual Apache 2.0 license.
I am in the process of implementing OSC support. When I get this working the plan is to show how to hook the panel up to MIDI. I’ll probably drop the sample playing aspect if this as well as make the UI look a bit nicer.
This demo encapsulates some of the Scene2D and Box2D integration I have been playing around with. Specifically collision detection and selection by touch/mouse.
Below is a screenshot with random numbered elements bouncing around inside the view. The walls are supposed to act like pinball bumpers so that when an element hits them they give the element a ‘kick’. The implementation for this is pretty experimental but seems to work well enough for illustration.
I have implemented a layer which lets you ‘grab’ an element body. When picked up a selection animation is run around the selected element (the zooming white square). The selection mechanism is actually completely generalised in the sense that it broadcasts events which another layer responds to for the animation. Nice and loosely coupled.
When an element hits the wall it will bounce and make a clonk sound but when hits another element it will run a flashing animation at the points where the bodies touch and play a boing sound. This illustrates I am detecting what sort of collision is taking place. The layer which has the bouncing elements also has a pool of contact listeners which it can dish out to elements in the view. They are released from the pool when an element is removed (by clicking on it).
There is some neat stuff here (at least I think so).
- Separate ‘netthreads’ LibGDX extension library which gathers together most (but not all) of the scene, layer, action and event handling classes I have written to support my approach to the design of these demos so far. There is a pom for generating the library as a Maven component although it’s not used as such here. Note it pulls the LibGDX libraries as scope “system”.
- Gravity update Action which gives bodies in the World lighter than air behaviour.
- Body update Action as seen in the previous demo which maps a Box2D body to a Scene2D Actor.
- Walls to enclose the World.
- Contact listener elements which implement ‘bumper’ behaviour to the Box2D World walls.
- Touch Layer which decouples the selecting of bodies in the view through the use of the event pipeline.
- Pointer Layer which implements a nice ‘selection’ animation around the selected Actor when touched. Try grabbing one of the rolling numbers with your mouse and you will see what I mean.
- Clonk sounds for hitting the walls and a satisfying boinging sound for when elements hit each other.
These features will hopefully find their way into an actual application at some point. I have a whole load of bits and pieces which are slowly coalescing into something.
I haven’t created the Android wrapper for this. It’s trivial to put this together and it saves me using my webspace which I am starting to fill at an alarming rate.
Demo code here.
There is a test application bundled as well which uses the LibGDX debug renderer.
This uses LibGDX 0.9.3.
All the code is licensed as Apache 2.0.
Another update to the UI for new version of Simple Weather a very early Android application I wrote back in 2008.
I went though all the layouts and changed the LinearLayout references to RelativeLayout instead.
I think I will move the date up the top. It looks kind of strange where it is.
This is a work in progress.
I have been trying to learn how to write slicker interfaces for Android as the stock styling is fairly boring.
Note the rounded edges to the list activity and the colours nicked from the iPhone weather app.
Europa is a Android 2d game library which I have been working on for the past 5 months on and off.
This was created originally out of some frustration with the existing engines that were available. They all seem to focus heavily on providing classes which abstract the graphics layers of the Android platform. What I really wanted was a proper framework which I could use to organise the game elements. This desire had come about from my previous attempt to write a simple shoot-em-up style game. I got so far with the sprites but got bogged down in how to ‘manage’ the scene elements. When I examined cocos2d I was struck how similar the idea of ‘actions’ was to my original design where I was associating command objects with what I now know as elements from the scene graph.
In cocos2d there are actions which run in sequence on each tick of the game loop and are attached to ‘nodes’ where a node is merely an abstraction and can be sub-classed to implement scenes, layers and sprites. The actions form the basis of all animation and what’s more is they can be composed together to form chains of operations e.g. move from a to b and rotate by an amount. Europa basically follows the same design with a Director, scenes, layers, nodes and an action pipeline which operates in the node elements.
So far I have implemented
- Texture cache which can load images from file or resource. It can also load simple sprite sheets.
- Animated sprites.
- Base Node class which is very much simpler that the cocos2d version where the base class is loaded with masses of cruft.
- Actions for base animation, movement and scene transition.
- Control actions for sequence and parallel compositing of operations.
- Bitmap fonts build from the Android system fonts along with a font cache.
- Publish/subscribe sources for I/O events.
- Simple event pipeline to broadcast to subscribed handlers in nodes. This is not in the original cocos2d design.
- Ability to switch between Canvas and OpenGL.
- Touch areas which respond by broadcast events to subscribers.
- Touch labels.
- Simple buttons.
The framework has been designed with good practise in mind so there are lots of design patterns plus most importantly this has been written with Android in mind right from the start. When I say ‘android in mind’ I mean that there is nowhere where it creates objects with the game loop unless it is deliberate. This was a major design goal from the start.
I have also tried to keep the class hierarchy as flat as I can so it’s exceptionally lean and mean in terms of how it hangs together.
I am quite close to a version of the framework I am happy with and plan to publish it as a work in progress when I get a bit more into the shoot-em-up demo that I am using to iron out the parts needed.
I am no where near releasing this in reality. I rewrote all the graphics subsystem to use matrices for the transformation between the coordinate systems which was a massive mind bender as that stuff is all new to me. Now am at a stalemate. The library is supposed to support Canvas and OpenGL but I have reached the point where I have to decide whether to ditch the Canvas support but I can’t let it go. The problem is that Canvas does not support lots of features like offloading the images onto the graphics memory and also the sprite drawing is so slow when there are lots of images. The caching of images is not efficient. Analysis paralysis has set in big stylee. I know I should just ditch the Canvas support but cannot bring myself to design it out. I’ll come back to it when I’m ready.
I have scrapped this version and am now using LibGDX instead coupled with some of the same concepts.
The code for the vector shoot-em-up for Android is now available here.
This is a bit of an esoteric game to say the least but it is good fun once you get into it. I always thought that this was going to be a bit hit on the market but it kind of fizzled away without ever really taking off. I am somewhat confused as to why this happened since it was really the only decent shoot-em-up when it was first put on the market. Maybe just a bit too old-skool for the cool kids these days.
My hope is that maybe someone will attempt to pull the BulletML component out and make it into something that can actually be useful. The current implementation is baked into the game engine which makes it difficult to see where the joins are.
There are other possible improvements
- Better background graphics for the title screen.
- Better help.
- Different shapes for the enemies rather than the uniform cubes.
We’ll see how it goes.
I am so busy just now that I have not had a chance to get back into any current projects. I should hopefully have some more time soon and when I do I will be getting back into all the existing stuff with a vengeance.
I am due to receive a phone from Google due to my existing applications maintaining a good star rating over 5000 downloads. I know there are issues with newer phones so this should sort that out. I got in early enough to get some headway on the Market but I wouldn’t have got very far if the apps were rubbish so it’s heartening to get some recognition. I can’t wait to see what Android 2.1 looks like. My intention is to release an update to my traffic application. What form this will take I am not sure yet. I suspect the next one will be like gTraffic but will use the HA RSS feed provided from the cloud for speed. I have a cloud based feed ready to go but nothing to talk to it.
Palm WebOS Eclipse Plugin
The WebOS debugger is a strange one. I spent ages trying to get the Chrome DevTool to talk to the emulator but with no luck. I have been watching other attempts to get a debugger integrated and there has been no progress so I see I am not alone (you know who you are). The existing code is not ready for release. I think this will be a bit like the SPARQL browser where I plug away and then just bring it out and no-one will know that they needed it until it appears. I have no opinion on Ares other than it is an amazing web application. Do we still need an Eclipse based solution? I no longer care. It will be finished when it’s finished which might be never. It has been incredibly satisfying to get this half-working but also incredibly annoying that I can’t get to some sort of milestone.
Bada Epic Fail
Bada oh Bada where shall I start? I signed up for the SDK only to find out that I needed a registered business account to receive the SDK. Let’s just think about this for a minute shall we. Take a minute and mull these points over:
- A new OS platform which must compete with both the iPhone and Android.
- Require a strong developer community to get the platform going.
There is a clear whiff of old-school control-freakery in the air around this platform which I think is a big big mistake for Samsung. I looked at the demo for this OS on Engadget and it looks great (it should do after nicking all the best bits of their competitors UI elements). Where is the access for developers like me or others who want to bring their own applications to the phone OS but don’t want to go through their boss? It’s the lure of the gold-rush which kick-started the Apple app store and (even more) the Android market. Samsung are late to the party and they are only talking to the hip kids.
Well, it’s been a while since I worked on my UK Traffic application. With the release of the Android 1.6 SDK I thought it was time I made some updates. There are a couple of cosmetic changes most significantly I have ‘thickened’ the timebar marker. Also I applied a filter to the timebar colour to give a blur effect. Nice.
You can see this in the above screen-shot. The previous one didn’t stand out enough for my liking.
There are also a few changes under the hood. In particular the map API is slightly different so I had to refactor the code a little to bring it into line.
I’ve decided to go back to the traffic NY application as well and see if I can do something with it. There are still 200 active installs which is interesting. I occasionally boot the app up on my developer phone and the last time I looked all the NYSDOT data was out of date so I think I am going to have to look into what on earth is going on with their RSS feed. I did mail them before and got a reply when I was moaning about there roadworks feed so we’ll see.
Other news is that I emailed Palm developers about my development of the debugger plugin but so far I have had no reply. I was asking about using the Palm SDK jar files. Well it’s been a week and I thought I would at least have got a response (saying no way) but nothing. Oh well.
Development of this plug-in is (so far) for my own amusement. I was thinking that it might me something I could sell but I don’t think I will beat the Palm developers to it.
It looks to me that output of the debugger is in gdb format. This would make sense as the platform is Linux based. To this end I got thinking about Antlr and parsing the output. Searching for this stuff is hard! Not many references but I suspect I will have to write some Antlr grammar to extract the file references and methods from the debugger output.
I am play-testing version 1.3.0 just now. This has fast OpenGL renderer which should sort of a lot of the lag for the busier levels of the game.
The fast renderering of multiple lines and colours is handled using line and color arrays. The code for this has been put into the BulletML demo. If you are interested drawing lots of lines fast or OpenGL in general on Android then I would recommend you download the code and have a look at it. The demo features a switchable mechanism for flipping between OpenGL and Canvas.
I really wrestled with implementing the GL layer but I have definitely learnt a great deal and gained some confidence in my abilities to go on to put something together myself.