Jump to content

  • Log In with Google      Sign In   
  • Create Account

Epic Zombie's Journal

Dope Runner milestone 3 reached!

Posted by , in Dope Runner 17 January 2013 - - - - - - · 746 views
Dope Runner, Android and 5 more...
It has taken a while, but I have reached the third milestone in Dope Runner. Things are starting to look very good now! After this one there’s one more major milestone, followed by the finishing touches, and then the game can be released.

So what new features have been added? In the previous version, you could only buy drugs from dealers. Prices fluctuated, and from time to time prices peaked or crashed. In this version, drug labs and farms have been added. From time to time, they will have a supply of drugs for sale at much lower prices, so huge profits can be made. The supply doesn’t last long, however, so you have to be fast!

Notifications now work properly. You’ll receive notifications of price peaks and crashes, and of new supplies in labs and farms. There was already a text notification in the app itself, but now you’ll also receive on through the notification bar when the app is running in the background. I’m thinking about getting rid of the in-app notification text, because it has become more or less obsolete.

Speaking of running in the background, this was a major obstacle for me to overcome. It’s the first time I used services, and it was a bit complicated to get it working as I wanted (see my previous post for more about this). I also had to implement a wake lock, because the app needs to keep running even when the screen is turned off.

So what will the next milestone introduce? Cops! From time to time, they will try to arrest you. To fight back, you’ll be able to buy guns. If you get shot, you’ll have to visit a doctor. Also, burglars may visit your safe house! It will make the game quite challenging, and it’s the last major feature to be added.

One more thing I’m gonna add is a settings screen. In my main menu, I’ve included an Instructions-button. This will be replaced by a Settings-button, and the instructions will be published on this website. When I started I didn’t think a settings screen would be necessary, but I changed my mind. For example, the GPS update interval. A short interval is more accurate but consumes more energy. I tried to find a good balance between accuracy and battery life, but it’s best to let the player decide.

Back on track

Posted by , in Dope Runner 04 January 2013 - - - - - - · 793 views

Things have been quite for a while, but I finally picked up where I left. Not exactly easy, because I kinda lost track of where I was. But I managed to figure it out, and the first thing I had to tackle gave me quite a headache.
So here's what the problem was. The app uses GPS, and it had to keep running even when the player opens another app. This means putting all GPS-related code in a background service. Even when the app isn't in the foreground, it keeps running. The real issue was communicating between the service and the app. There are several ways to do this. One is creating a bound service, and then you can access the background service like you would any other object. Doesn't sound too difficult, does it?
The problem arose when I searched for a way to stop the service. The game has an exit button. It doesn't really exit the app (this is frowned upon bigtime in Android), but rather it stops the background service and goes back to the start screen. The problem with bound services is that Android activities are bound to it, and as long as there are any bounds, you can't stop it. It keeps track of the number of bounds and stops automatically when this is zero. And that's what gave me such a headache, because at some times, I just couldn't stop the service!
So I decided to try something else. I started the service without binding it to the activity. This means you can't access it as an object, but instead you have to send messages between the activity and the service. This is a little bit more work, but you can always stop the service no matter what.
This was the first time I used services. It's a complicated subject, but I learned a lot in the process. Now I can move on with all the rest.

January 2013 »


Recent Entries

Recent Comments